Open solstyce9 opened 4 years ago
Thanks for the information and detail (and I'm not judging :-). The Plex schedule priority is currently not taken into account at all, and I purposely didn't support it (hence my disclaimer in the readme). That said, I can see it being useful, so I'll take a stab at it.
I can see the priority in Plex's database and it's easy enough to retrieve, but the harder part is determining conflicts the same way that Plex is doing it (I don't know if Plex stores the conflict data anywhere or if it's calculated on-the-fly). How many internal tuners does your "Hauppauge USB tuner for Xbox One" have? I'm guessing it only has one based on a quick search. I currently use an HDHomeRun with dual tuners, and so I can actually record two shows at once. I'm asking because I think I'll also need to take the number of tuners into account when calculating the priority and conflicts.
Ah, sorry. I remember reading that some of the recording settings weren't supported, but didn't realize recording priority wasn't. There's my problem... :-)
Yeah, my tuner is a single tuner. My DVR setup started as an experiment - I had Plex Pass and an old OTA antenna, so I just asked for a USB tuner as a birthday present, and here I am. Plex DVR is interesting, but still has some serious usability gaps, so I don't think I'll be able to get my family on board with a quad tuner setup and external antenna for a while. So given the single tuner, I always have conflicts, but I think the time window for all my other conflicts completely overlap, so whether it's recording one show or the other doesn't matter as long as PDW wakes up my system and then Plex can figure it out. This is the only one where the preferred recording is significantly later than the lower priority conflict.
For now I went old school, and just created a manual task to wake at 12:29pm weekdays... And I can manage my conflicts to avoid this type of scenario. When / if you ever have a chance to work on this feature, I'd be happy to test it out, but I expect most people will have a dual or quad tuner and won't run into this problem, so no pressure. I really wish Plex would build auto-wake into PMS, but now that I've logged some time with the Plex DVR and run into all the weird bugs and hiccups and I see why it's not. My electricity bill and I thank you for making this possible! :-)
Just wanted to give an update on this....
I was able to get something seemingly working for "simple" recording schedule conflicts based purely on start time, priority, and the number of tuners available. However, when I started testing recording schedules with multiple "complex" overlapping conflicts, my results would no longer match the conflicts that Plex identified, and thus would not be useful because it would not wakeup the computer at the time that Plex would want to record.
After looking through the Plex logs, it appears that Plex actually performs some additional magical logic in figuring out which shows to identify as conflicts. It looks like it may run something like a gaming-tree of calculations and may weight each show somehow before calculating a "score" of some sort. It seems like it also gives some weight to, say, recording two 30 minute shows instead of a 1 hour show, but that's just a guess. It also appears to make some kind of http call (most likely authenticated with your Plex credentials) to either perform the calculation or store the results, possibly.
After discovering Plex's magical conflict behavior from its logs, I poured over the Plex database again in an attempt to find anything related to the final recording schedule. However, there simply does not seem to be anything there I can use.
So, at this point, I'm not sure what else to do, because I don't know if my "simple" logic is worth releasing or not since it won't always match Plex's more "complex" conflicts. And I'm not sure how I could explain how/why the conflicts wouldn't match sometimes. I'll keep this bug open, and maybe someday I'll stumble upon an idea or something to make this work.
Appreciate your efforts and the update!
The more I learn about Plex the more complicated I realize it is. I'm fine operating within its constraints now that I know what they are.
Hopefully at some point Plex will realize people want their systems to sleep when they're not being used and build this directly into the product. No reverse engineering magic required :-)
Describe the bug PlexDVRWaker isn't waking the system for the correct show when there is a scheduling conflict and the conflict starts before the prioritized show. I've seen this twice now for my 12:30pm recording of The Cat In The Hat (don't judge, it's for my son :-) Looking at the output of PlexDVRWaker.exe list, I don't see the 12:30pm recording in the list, so for some reason it's not being seen by PDW as scheduled.
To Reproduce Steps to reproduce the behavior:
Expected behavior PDW should wake the system at 12:30pm because the 12:30 show is the one Plex is going to record.
Actual behavior PDW wakes the system at 12n, for one of the lower priority shows. Then since I use Shutter to put the system to sleep after 15 mins of low CPU and low network, it falls asleep before 12:30 because there is no recording happening, and I miss the recording.
Desktop (please complete the following information):
Additional context Screenshot of my typical weekday 12n/12:30 conflicts - Nova, Waltons, and Cat In The Hat. 2nd column is Jul 7 and does not show conflicts because the recording time has passed so only shows the error for the missing Cat In The Hat because the system was asleep. Other 2 columns are tomorrow and the next day, so the conflicts are still shown in case I want to manually change them. Priority for these three shows is Cat In The Hat, then Nova, then Waltons.![2020-07-07_20-48-34](https://user-images.githubusercontent.com/65085358/86874584-8018f200-c095-11ea-9e64-2108ca95964b.jpg)
PDW log file excerpt showing sync running at noon with next show time being noon not 12:30p
PDW list output