diff options
author | Wim <wim@42.be> | 2019-02-27 00:41:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 00:41:50 +0100 |
commit | 26a7e35f2777b8424477eef1838125a6ae55fe48 (patch) | |
tree | d48cfdb02bb7a6d0558413cbad906f2ec59cb3a2 /bridge/telegram/handlers.go | |
parent | d44d2a5f0014fda12ce78d35e416dffab6b7c04a (diff) | |
download | matterbridge-msglm-26a7e35f2777b8424477eef1838125a6ae55fe48.tar.gz matterbridge-msglm-26a7e35f2777b8424477eef1838125a6ae55fe48.tar.bz2 matterbridge-msglm-26a7e35f2777b8424477eef1838125a6ae55fe48.zip |
Add MediaConvertWebPToPNG option (telegram). (#741)
* Add MediaConvertWebPToPNG option (telegram).
When enabled matterbridge will convert .webp files to .png files
before uploading them to the mediaserver of the other bridges.
Fixes #398
Diffstat (limited to 'bridge/telegram/handlers.go')
-rw-r--r-- | bridge/telegram/handlers.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go index e87466ca..93576fb4 100644 --- a/bridge/telegram/handlers.go +++ b/bridge/telegram/handlers.go @@ -245,6 +245,15 @@ func (b *Btelegram) handleDownload(rmsg *config.Message, message *tgbotapi.Messa if err != nil { return err } + if strings.HasSuffix(name, ".webp") && b.GetBool("MediaConvertWebPToPNG") { + b.Log.Debugf("WebP to PNG conversion enabled, converting %s", name) + err := helper.ConvertWebPToPNG(data) + if err != nil { + b.Log.Errorf("conversion failed: %s", err) + } else { + name = strings.Replace(name, ".webp", ".png", 1) + } + } helper.HandleDownloadData(b.Log, rmsg, name, message.Caption, "", data, b.General) return nil } |