MCPcopy
hub / github.com/42wim/matterbridge / maybeConvertTgs

Method maybeConvertTgs

bridge/telegram/handlers.go:288–304  ·  view source on GitHub ↗
(name *string, data *[]byte)

Source from the content-addressed store, hash-verified

286}
287
288func (b *Btelegram) maybeConvertTgs(name *string, data *[]byte) {
289 format := b.GetString("MediaConvertTgs")
290 if helper.SupportsFormat(format) {
291 b.Log.Debugf("Format supported by %s, converting %v", helper.LottieBackend(), name)
292 } else {
293 // Otherwise, no conversion was requested. Trying to run the usual webp
294 // converter would fail, because '.tgs.webp' is actually a gzipped JSON
295 // file, and has nothing to do with WebP.
296 return
297 }
298 err := helper.ConvertTgsToX(data, format, b.Log)
299 if err != nil {
300 b.Log.Errorf("conversion failed: %v", err)
301 } else {
302 *name = strings.Replace(*name, "tgs.webp", format, 1)
303 }
304}
305
306func (b *Btelegram) maybeConvertWebp(name *string, data *[]byte) {
307 if b.GetBool("MediaConvertWebPToPNG") {

Callers 1

handleDownloadMethod · 0.95

Calls 4

SupportsFormatFunction · 0.92
LottieBackendFunction · 0.92
ConvertTgsToXFunction · 0.92
GetStringMethod · 0.65

Tested by

no test coverage detected