5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-12-26 07:25:42 +00:00
matterbridge/bridge/telegram
Ben Wiederhake b2af76e7dc
Support Telegram animated stickers (tgs) format (#1173)
This is half a fix for #874

This patch introduces a new config flag:
- MediaConvertTgs

These need to be treated independently from the existing
MediaConvertWebPToPNG flag because Tgs→WebP results in an
*animated* WebP, and the WebP→PNG converter can't handle
animated WebP files yet.

Furthermore, some platforms (like discord) don't even support
animated WebP files, so the user may want to fall back to
static PNGs (not APNGs).

The final reason why this is only half a fix is that this
introduces an external dependency, namely lottie, to be
installed like this:

$ pip3 install lottie cairosvg

This patch works by writing the tgs to a temporary file in /tmp,
calling lottie to convert it (this conversion may take several seconds!),
and then deleting the temporary file.
The temporary file is absolutely necessary, as lottie refuses to
work on non-seekable files.
If anyone comes up with a reasonable use case where /tmp is
unavailable, I can add yet another config option for that, if desired.

Telegram will bail out if the option is configured but lottie isn't found.
2020-08-23 22:34:28 +02:00
..
handlers.go Support Telegram animated stickers (tgs) format (#1173) 2020-08-23 22:34:28 +02:00
html.go Fix regression in HTML handling (telegram). Closes #734 2019-02-24 15:13:56 +01:00
telegram.go Support Telegram animated stickers (tgs) format (#1173) 2020-08-23 22:34:28 +02:00