streamlink / streamlink-twitch-gui

A multi platform Twitch.tv browser for Streamlink
https://streamlink.github.io/streamlink-twitch-gui/
MIT License
2.69k stars 203 forks source link

Watch time statistics #739

Closed Paralusion closed 6 months ago

Paralusion commented 4 years ago

Feature request

Watch time

Description

Watch time per channel. When clicking on someone channel, it shows the channel statistics. A bit of text could be added to show the user how long they have watched a particular channel for.

Additional comments, screenshots, etc.

bastimeyer commented 4 years ago

For that to happen, first, the currently used localstorage-based ember-data adapter (ember-localstorage-adapter) needs to be replaced with an alternative data adapter that is built on an index structure, because storing watch time statistics and related data requires a data structure which can be accessed faster without having to have everything in memory at the same time. The localstorage-adapter doesn't fit here, as it's just one giant JSON object loaded into memory, and storing watch stats will make this grow larger and larger over time, which will eventually become a problem, especially if it's read and written a lot. Not to mention that it's a synchronous API and could therefore block the DOM rendering if the data is too large.

Two options for the replacement are

Replacing the data adapter means that all the currently implemented models using this adapter, namely the settings, channel settings, window position, auth and versioncheck need to be converted, in addition to the localstorage instance initializer, which fixes old data schemes. That will be a bit of work, as everything needs to stay compatible when upgrading the app from an older version.

As a conclusion, the implementation effort for having a simple watch-time-stats feature alone is way too high. However, by changing the data adapter for locally stored data, which is something I've had in mind since years, other features could be implemented way easier, like a watch history for example.

Paralusion commented 4 years ago

I understand that this is seen as low priority for now, as the amount of work for just one little feature is tremendous. If you're ever planning on implementing user statistics, things such as "recently/last watched" and streamer sorting by "most watched" etc could also be implemented. Good luck and thanks for the detailed reply.