maunium / stickerpicker

A fast and simple Matrix sticker picker widget
GNU Affero General Public License v3.0
312 stars 592 forks source link

Added animated telegram sticker support for sticker-import #63

Open dzoidbrg opened 1 year ago

dzoidbrg commented 1 year ago

Commit message is self explanatory. I have tested this and according to some users in the matrix channel, it works.

LuckyTurtleDev commented 1 year ago

this is currently already supported by LuckyTurtleDev/mstickereditor

dzoidbrg commented 1 year ago

I just recently saw your program after submitting this pull request but I thought it would be easier or more convenient for some users to use the Python script directly.

dzoidbrg commented 1 year ago

And for many users, like me, the functionality of the program you created is not needed.

dzoidbrg commented 1 year ago

But I do think that for some users, your program is more useful.

LuckyTurtleDev commented 1 year ago

Would using webp instead of gif not be the better choice? Gif does not support semitransparent pixel, which leads to ugly effects, if the background of the client does not match the color used for semitransparent background.

Also webp is now widely supported by matirx clients: Client gif webp stickerpicker type
Cinny ponies
Element Desktop/Web widget
Element Android no autoplay widget
FluffyChat ponies
Nheko ponies
Schildi Desktop/Web widget
Schildi Android widget
mautrix-telegram-bridge static image only -
dzoidbrg commented 1 year ago

Thanks for your input, I will move over to webp

LuckyTurtleDev commented 1 year ago

However I am not sure how active this project is. There are some pr that have been open for over a year and have zero comments.

0x416c69 commented 1 year ago

@LuckyTurtleDev @dzoidbrg

It appears that both of your repositories lack the support for win32/windows, I tried using @dzoidbrg's code since it looks to need less dependencies but I don't think there is a win32 build of lottieconverter or if lottieconverter's source code can be compiled in win32 or not.

It'd be really cool if you could add win32 support.

LuckyTurtleDev commented 1 year ago

@0x416c69 The problem is that i have no experience with linking c libs on windows. I am not sure if the rlottie crate does even support compiling on windows. Probably @msrd0 knows more. But everything else should be possible to build and run on windows too. So if some would provide build instruction or would build it at the ci, pr would be welcome.

However I am currently adding feature flags https://github.com/LuckyTurtleDev/mstickereditor/pull/36, so some functionality can be disable, to reduce the count of needed dependencies.

msrd0 commented 1 year ago

I have 0 idea about how windows and linking on windows works. The rlottie Rust bindings expect that pkg-config can be used to find rlottie. I have no idea if that works on windows. It might be easiest to use Windows subsystem for Linux, as mstickereditor is a command-line application anyways.

LuckyTurtleDev commented 1 year ago

@msrd0 both crates (rlottie and rlottie-sys) claim to be platform independent

A platform independent standalone library that plays Lottie Animation

msrd0 commented 1 year ago

Oh that's just the description of the rlottie C library xD

But it should work an Linux, Android, MacOS, ... basically everywhere rlottie compiles and pkg-conf works

0x416c69 commented 1 year ago

I am well versed in c/cpp, but I haven't tried using rust or its package managers.

I think I'm better off using WSL for this, isn't there a better alternative to maunium's stickerpicker? I was previously using Dimension which is now discontinued.

msrd0 commented 1 year ago

I think I'm better off using WSL for this

Yeah it'd take someone with windows and some knowledge with c and rust to make rlottie-rs work on Windows. I haven't used Windows in the last 8 years or so so I can't even test whether it works.

Also thought I'd mention https://github.com/msrd0/tg2mx_bot for ppl that have a linux server and use MSC2545 supporting clients (fluffy, nheko, cinny, etc). I plan on eventually hosting a version of it for public (but heavily resource limited) usage, but I haven't gotten around to it yet. It should also be possible to add support for maunium's json format to it should someone have the time and need for it.

dzoidbrg commented 1 year ago

@LuckyTurtleDev gif's dont work for me on Schildi Android

dzoidbrg commented 1 year ago

To be honest, I don't like Python either, so I would rather work getting @LuckyTurtleDev's program working on win32

msrd0 commented 1 year ago

@dzoidbrg I have created an issue for this: https://github.com/msrd0/rlottie-rs/issues/43. Let's discuss the Rust part there.

LuckyTurtleDev commented 1 year ago

@LuckyTurtleDev gif's dont work for me on Schildi Android

Strange the last time I have checkout this, it has works fine.

0x416c69 commented 1 year ago

Unfortunately I haven't made any changes to the code but I was thinking about creating one. I don't know if it's worth waiting for https://github.com/matrix-org/matrix-spec-proposals/pull/1951 or not, it's been submitted since 2019 which is roughly 4 years ago.

Is it really this hard to get a specification into matrix' specs? What's stopping these people? Can we help them instead?

dzoidbrg commented 1 year ago

A better matrix spec would be the solution

msrd0 commented 1 year ago

@0x416c69: I think MSC1951 is dead as MSC2545 is being implemented by a bunch of clients already.

LuckyTurtleDev commented 1 year ago

It is implemented by nearly everything with the exception of element and element based clients.

LuckyTurtleDev commented 1 year ago

But I do not like this MSCs because the allows only one personal sticker pack. Also I do not expect them to be decided in the near future.

0x416c69 commented 1 year ago

A better matrix spec would be the solution

Which might require a ton of work to maintain it, I don't know if that's viable or not 😄

@0x416c69: I think MSC1951 is dead as MSC2545 is being implemented by a bunch of clients already.

It is implemented by nearly everything with the exception of element and element based clients.

Exactly, it's not supported by Element and we mainly use Element since it's maintained by the OG guys, there seems to be a conflict between whether using that spec or this one with the riot team, I really liked FluffyChat's implementation but Fluffy is unavailable in win32.

msrd0 commented 1 year ago

But I do not like this MSCs because the allows only one personal sticker pack.

Yes but I don't think that (a) changing it now would make much sense, as that just further delays getting merged, and (b) not that big of a deal, as you can just create a room with yourself being the only member (which your client could also do and hide from you entirely) where you add all the sticker packs you're interested in. Telegram bdw does not have any notion of user account sticker packs, all sticker packs are "global", so it's really not a big deal. By now we probably already have a few hundred versions of the same commonly used telegram sticker packs as every user individually uploads them to matrix xD.

dzoidbrg commented 1 year ago

I mean, this I will leave to the matrix wizards. I will try getting rlottie working on windows and making @LuckyTurtleDev's code work with Win32. I think that this is better than my hacked python script. I will still try to get it merged because for simple use cases, python is way more portable.

LuckyTurtleDev commented 1 year ago

@dzoidbrg the only this which block mstickereditor to be run on windows should be the rlottie crate. So if the crate works on win an update of the dependencies should make mstickereditor also win compatible.

dzoidbrg commented 1 year ago

I will try working on the rlottie crate.

dzoidbrg commented 1 year ago

Should we close this? I think the main work has to be done on rlottie, and their is a PR relating to that.

LuckyTurtleDev commented 1 year ago

Git version of mstickereditor does now support win with lottie feature-flag disable. So only video and static features are support on win for now.

0x416c69 commented 1 year ago

@LuckyTurtleDev thank you, I tried it and compiled it but my stickers are not working (?) The media files appear to be there but nothing is showing, not even in Element. image

https://0x416c69.github.io/stickerpicker/web/#pack-tg_name_MyQuby (latest pack)

My synapse server is up to date. Is it required to enable dynamic_thumbnails in synapse for this to work? When trying to fetch those webp images, I'm getting this error 400:

{"errcode":"M_UNKNOWN","error":"Cannot find any thumbnails for the requested media ([b'ag5.ir', b'qAsAxJsWpWXAlGaJaeZrJwQC']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.)"}

Pack: https://t.me/addstickers/MyQuby

LuckyTurtleDev commented 1 year ago

@0x416c69 issue moved to https://github.com/LuckyTurtleDev/mstickereditor/issues/38