Xithrius / twitch-tui

Twitch chat in the terminal.
https://xithrius.github.io/twitch-tui/
Apache License 2.0
447 stars 32 forks source link

No Animations #581

Closed v4u6h4n closed 5 months ago

v4u6h4n commented 5 months ago

Describe the bug: Hey there :-) For some reason I'm not getting any animations for animated emotes.

System:

Xithrius commented 5 months ago

Hello! Could you post your config? Excluding your token, of course. Thanks!

v4u6h4n commented 5 months ago

Sure, here you go:

[twitch]
username = "<channel>"
channel = "<channel>"
server = "irc.chat.twitch.tv"
token = "oauth:<token>"

[terminal]
delay = 30
maximum_messages = 500
verbose = false
first_state = "Normal"

[storage]
channels = false
mentions = false

[filters]
enabled = false
reversed = false

[frontend]
show_datetimes = true
# datetime_format = "%a %b %e %T %Y"
datetime_format = "%H:%M"
username_shown = true
palette = "vibrant"
title_shown = true
margin = 0
badges = false
theme = "dark"
username_highlight = true
state_tabs = false
cursor_shape = "underscore"
blinking_cursor = true
inverted_scrolling = false
show_scroll_offset = false
twitch_emotes = true
betterttv_emotes = true
seventv_emotes = true
frankerfacez_emotes = true
favorite_channels = []
recent_channel_count = 5
border_type = "rounded"
hide_chat_border = true
right_align_usernames = false
show_unsupported_screen_size = true
v4u6h4n commented 5 months ago

Also, curious how you implement the animation. All I know is some basic python and bash, so couldn't really figure it out by looking at your code. I got some animations working with icat in a chatbot, but there would often be artefacts or ghosting.

Xithrius commented 5 months ago

I'm not the one who implemented the emotes code. @Nogesma could you provide a summary of how it's done?

Also, I'll try to recreate the animation bug within the next few days.

Nogesma commented 5 months ago

Hi, do you have any example emotes that I can test for?

My first guess would be that image.rs fails to decode it as an animated image, but I'm not sure why that would happen.

You might wanna try to delete the image cache with rm -r ~/.cache/twt. If there's any corrupted images it might fix it. A log would also be helpful, you can run twt -c <channel> -v -l debug.log to generate it.

Otherwise I'm not sure, I'm also running arch with latest kitty, and haven't noticed any issue.

For the implementation, the animated image is decoded into rgba frames by image.rs, then saved to a temp folder, and loaded by kitty by using the animations keys for the graphics protocol. The graphics protocol part is here: https://github.com/Xithrius/twitch-tui/blob/90bd67d680e1f0a67ba3f6cdbec4cc3a11f05310/src/emotes/graphics_protocol.rs#L111-L168

v4u6h4n commented 5 months ago

@Nogesma

Hey :-)

I tried removing the cache, but same result unfortunately. It is strange, I'm also running latest kitty and Arch, and it's the same with any animated emote. Here's the log:

[2024-04-24][11:22:11][twt][INFO] Logging system initialised
[2024-04-24][11:22:11][twt][INFO] Started tokio communication channels.
[2024-04-24][11:22:11][twt::terminal][INFO] Started UI driver.
[2024-04-24][11:22:11][twt::twitch][INFO] Spawned Twitch IRC thread.
[2024-04-24][11:22:11][twt::emotes][INFO] Starting emotes download.
[2024-04-24][11:22:11][irc::client::conn][INFO] Connecting via TLS to irc.chat.twitch.tv.
[2024-04-24][11:22:11][reqwest::connect][DEBUG] starting new connection: https://id.twitch.tv/
[2024-04-24][11:22:12][reqwest::connect][DEBUG] starting new connection: https://api.twitch.tv/
[2024-04-24][11:22:13][reqwest::connect][DEBUG] starting new connection: https://api.betterttv.net/
[2024-04-24][11:22:13][reqwest::connect][DEBUG] starting new connection: https://7tv.io/
[2024-04-24][11:22:13][reqwest::connect][DEBUG] starting new connection: https://api.frankerfacez.com/
[2024-04-24][11:22:13][twt::emotes][INFO] Emotes downloaded.
[2024-04-24][11:22:16][twt::twitch][DEBUG] Sending message to Twitch: testing
[2024-04-24][11:22:18][twt::twitch][DEBUG] Sending message to Twitch: DinoDance

Thanks for explaining how it works. If I can get twt working it'll be great for the short term, but me and my GF plan on multicasting to a few other platforms eventually so would love to try and implement something like that in my python bot sometime.

Xithrius commented 5 months ago

I'm running the same version of arch and kitty as you, and I'm unable to reproduce the issue. Have you modified your kitty config in any way?

Nogesma commented 5 months ago

Okay I found the issue, twitch by default returns the url of the static emotes with their api, so I just switched to downloading the animated versions.

I just opened a PR with the fix.

v4u6h4n commented 5 months ago

Okay that makes sense, I tried running twt in a fresh arch vm and still didn't have animations, so I knew something was up.

Xithrius commented 5 months ago

Fix is available in 2.6.7

v4u6h4n commented 5 months ago

Yup it's fixed. Thanks for the help you two :-)