lay295 / TwitchDownloader

Twitch VOD/Clip Downloader - Chat Download/Render/Replay
MIT License
2.77k stars 261 forks source link

Emote cache for faster chat rendering #1244

Open hianick opened 2 weeks ago

hianick commented 2 weeks ago

Checklist

Write your feature request here

Currently you have to spend quite a bit of the chat render process looking up the emotes. There are a lot of universal emotes and editing for a single channel will use the same emotes most of the time and a local cache of emotes would be useful.

ScrubN commented 2 weeks ago

Emotes are already cached locally on the disk.

The reason it takes a while to fetch emotes is because we decode each image file sequentially. We do it this way because its simpler to handle. We also don't retain the decoded emotes in memory between renders because of both simplicity and for the rare case that emote definitions change while the app is open.

ScrubN commented 2 weeks ago

I would be willing to look into refactoring the image fetching service to parallelize decoding cached images, but I will not be retaining emotes in memory between runs because that opens up a whole host of issues.

superbonaci commented 2 weeks ago

The emotes as far as I know never change, so could not be better to have an assets folder in the project or a zip file where all the known emotes are there? Only fetch the new emotes until the project is updated, or just let the assets folder be updatable separately.

this can fix also https://github.com/lay295/TwitchDownloader/issues/1241

ScrubN commented 2 weeks ago
  1. Twitch global emotes are the fastest to fetch. The issue lies in Twitch channel emotes (on big channels like xqc) and 3rd party emote providers (especially 7tv with up to 1000 slots).
  2. I don't want to bloat the executable size by another few megabytes just to save a few seconds of download time.
  3. Implementing that would require a substantial amount of time and effort.
  4. Embedding Twitch global emotes wouldn't save any time in the scenario that @hianick was describing. It would only save time once by unpacking the global emotes from the executable instead of a dozen HTTP requests.
  5. This sounds like a huge legal issue as Twitch owns the exclusive rights to all of the emote images, which would allow them to DMCA this repo. They cannot DMCA the repo as it stands because Oracle vs. Google proved APIs are not copyrightable.
glubsy commented 2 weeks ago

The emotes as far as I know never change

They actually do change sometimes, albeit rarely.