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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user