diff options
author | Benau <Benau@users.noreply.github.com> | 2021-08-25 04:32:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 22:32:50 +0200 |
commit | 53cafa9f3d0c8be33821fc7338b1da97e91d9cc6 (patch) | |
tree | 964a225219099a1a1c282e27913767da588191b4 /bridge/telegram/telegram.go | |
parent | d4195deb3a6305c49c50ff30e8af978c7f1bdd92 (diff) | |
download | matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.tar.gz matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.tar.bz2 matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.zip |
Convert .tgs with go libraries (and cgo) (telegram) (#1569)
This commit adds support for go/cgo tgs conversion when building with the -tags `cgo`
The default binaries are still "pure" go and uses the old way of converting.
* Move lottie_convert.py conversion code to its own file
* Add optional libtgsconverter
* Update vendor
* Apply suggestions from code review
* Update bridge/helper/libtgsconverter.go
Co-authored-by: Wim <wim@42.be>
Diffstat (limited to 'bridge/telegram/telegram.go')
-rw-r--r-- | bridge/telegram/telegram.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 0f08a45b..199a76ab 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -17,8 +17,6 @@ const ( HTMLFormat = "HTML" HTMLNick = "htmlnick" MarkdownV2 = "MarkdownV2" - FormatPng = "png" - FormatWebp = "webp" ) type Btelegram struct { @@ -32,10 +30,10 @@ func New(cfg *bridge.Config) bridge.Bridger { if tgsConvertFormat != "" { err := helper.CanConvertTgsToX() if err != nil { - log.Fatalf("Telegram bridge configured to convert .tgs files to '%s', but lottie does not appear to work:\n%#v", tgsConvertFormat, err) + log.Fatalf("Telegram bridge configured to convert .tgs files to '%s', but %s does not appear to work:\n%#v", tgsConvertFormat, helper.LottieBackend(), err) } - if tgsConvertFormat != FormatPng && tgsConvertFormat != FormatWebp { - log.Fatalf("Telegram bridge configured to convert .tgs files to '%s', but only '%s' and '%s' are supported.", FormatPng, FormatWebp, tgsConvertFormat) + if !helper.SupportsFormat(tgsConvertFormat) { + log.Fatalf("Telegram bridge configured to convert .tgs files to '%s', but %s doesn't support it.", tgsConvertFormat, helper.LottieBackend()) } } return &Btelegram{Config: cfg, avatarMap: make(map[string]string)} |