4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-27 08:49:24 +00:00

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
This commit is contained in:
Wim
2019-02-27 00:41:50 +01:00
committed by GitHub
parent d44d2a5f00
commit 26a7e35f27
28 changed files with 4317 additions and 0 deletions

View File

@ -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
}