kompot / nhl-tv-geeky-streams

Best way to download NHL games. NHL.TV, NHL LIVE, or WatchESPN account is required.
MIT License
35 stars 7 forks source link

Add passive mode #41

Closed rseanhall closed 3 years ago

rseanhall commented 4 years ago

Sorry about the huge PR, I tried to break it up into smaller commits to make it easier to review.

Closes #11. Not sure if you think this implements #15.

kompot commented 4 years ago

Sorry for the delay.

I see right now that if a game is not found today (and today is a tricky thing to get right considering different time zones, that's why there's explicit timezone setting) then the process exits with The game couldn't be autoselected.. Despite that my fav team played ~12 hours ago and I have not yet watched it (as it's hard to do it when basically all the games are being played deep into the night on Europe time).

I see this maybe this way.

There is a log of all fav team's games downloaded. And this --passive mode tries to find earliest not watched game. There are some problems though:

  1. What if you've just added a fav team (so no games were downloaded for it yet). How far into the past should we look for game download?

  2. Or you have not watched games for 3 months (how is that even possible, right? it's hockey! but still). I bet you don't want to auto download a 3 month old game.

Maybe there should be a config setting like passiveModeWeeksToConsider with a default value of like 2 weeks. So that this passive mode will download earliest not watched game within these 2 past weeks.

And also we should consider how to mark game as completely downloaded. So that if there's network outage in the middle of this passively downloaded game then the second passive run would continue downloading that game.

What do you think?

rseanhall commented 4 years ago

When implementing this, I tried to stand back and see what nhl-tv-geeky-streams was doing: let the user choose the game (and the feed and the stream quality) to download, then download it. So in this pull request, I was trying to get it so that given the config and the start date (nhl-tv-geeky-stream's today), it would be able to auto select everything. FYI, I have since noticed that there's a couple of bugs in the passive selection code which I haven't fixed yet. It currently ignores the disabled status of a game (like if it hasn't started yet). Also, for feeds sometimes there's a feed for the favorite team and a Canada national feed for the other team and it doesn't know which one to select.

I was thinking that if you have a media server and you want it to automatically download the games, then you would schedule nhl-tv-geeky-streams to run once a day at the end of the US day with --passive. If you have multiple favorite teams, I thought we could add an additional command line parameter for the favorite team that would override the config. As you point out, this potentially has problems because of things like network outages. Though we could add a command line parameter for the start date and you could schedule it to run multiple times for the previous day.

I feel like it would be a separate feature from --passive if we want nhl-tv-geeky-streams to be able to look at the download history to figure out how far back to go and then download all the games from that point (--managed? add an option in the UI to select this as well?). If we put it in the UI, then the first time it runs for a fav team we could get the user to pick the starting game. If it's not the first time then we could get the user to confirm the starting game, or choose a new one. And if they didn't use the UI, then we could start at the beginning of the current season (or block and force them to use the UI the first time?).

I have been playing with other features and have already figured out how to know when the download completed successfully.