justinemter / pseudo-channel

This is a python based cli-app using the python-plex-api to control a plex-client and act like a real TV channel with show scheduling, commercial breaks, movie nights, etc. "Home-Brewed TV Channel(s) for Hackers"
GNU General Public License v3.0
130 stars 18 forks source link

Issues of shows stopping at midnight, going into the next day #70

Open mutto233 opened 6 years ago

mutto233 commented 6 years ago

I have mentioned this issue on the Discord, but I wanted to raise it as an issue here as well for the future.

There was a problem around midnight where certain shows would not correctly run once midnight was reached. For instance, if a show started at 11:50PM and should run until 1:30AM, after midnight the show would seemingly stop.

The cause for this ended up being the definition of closest media and "now". Here is basically how the script works:

This usually works well, but in certain cases has issues. If the previous element is determined to start at 11:50PM, and "now" is 1:00AM, the difference of "now" and the start time of the previous object is instead basically a whole day since that is the absolute distance between those two times.

To fix this, I have a modified script for PseudoChannel.py that has been holding up quite well. This version senses if a day has passed, and correctly identifies the time that has elapsed for the element that crosses over the day skip. Can others let me know how this is working?

I have also put this script into my fork of the project. File is here: PseudoChannel.zip