ii7mood / LiveMood

Follow your favourite Twitch / YouTube streamers and recieve notifications of their streams through a number of outlets!
1 stars 0 forks source link

[ Feature / ? ] Filter out abandoned streams #7

Open ii7mood opened 5 months ago

ii7mood commented 5 months ago

What I mean by abandoned streams are ones that have been scheduled to start months ago but have yet to do so. i.e Inashiro Nene's stream was scheduled to stream ~2 years ago so we should automatically filter out such streams.

Before we decide how to do this I wanted to think about it's design. a) Should this be done at the detector-level, or b) Leave it up to each Listener to handle such cases

ii7mood commented 5 months ago

For instance streams that are scheduled to start in over 24h are filtered out by detector.py but I can think of several reasons a Listener would want to still be aware of such streams' existence so I've been thinking of making it a Listener's job to decide whether a stream should be filtered out or not, and not Detector's. Yeah.. I think it's better to make it a per-listener thing rather than a universal rule.

Okay, so we need to modify the Discord Listener & the Desktop Listener to both filter out streams scheduled to start in over 24h. We could also make this an option within files/config.js. We will consider the abandoned streams later.

ii7mood commented 5 months ago

Ugh I hit a roadblock.

So Detector's main job is to detect streams that have changed their live_status (that are not not_live) and pass their metadata to the Listeners. Knowing that, imagine if Listener A does not want to send a notification as hours_until_stream is >24 while Listener B doesn't care about hours_until_stream's value. Detector would update the streamer's status in the database and on the next iteration Detector would not detect a change in status for said streamer meaning Listener A would never receive the metadata of the stream, even if hours_until_stream is now <24.

This means there is now a burden on the Listeners as they have to remember which streams they refused to send notifications about and themselves will have to handle checking until conditions are met. This is undesirable.

I think the optimal solution would be to re-define Detector's role: from -> Detecting changes in streamers' live_status then passing the metadata to each Listener to -> Detecting condition fulfillment of metadata and passing that data to the corresponding Listener.

This means each Listener would need to define it's own set of rules for Detector.py to test against before passing it to the Listener.

This feature requires it's own issue, lol. I am currently abroad for the next ~1 week so.. this will have to wait. In the mean time I might work on more minor features i.e test cases.