Closed PearsonFlyer closed 1 year ago
I am having the same issue except mine will play the next episode after the timer has counted down. It skips the intro and credits as it should.
Windows 10 python 3.10 Same settings as PearsonFlyer except:
first-episode-season = Watched first-safe-tags = credits
As far as I can tell this is a Plex API problem. Its creating these play queues but not actually including the selected item and thus you get the index out of bounds error. I've tried multiple workarounds and can't find a solution. If Plex doesn't return a valid playqueue there isn't much I can do. I also haven't been able to reproduce this, what version of plex server are you running?
c2052f99315d86e130364be2d9887209f1def21a
Pushed a small update that does a couple things. It reworks how the on deck episodes are pulled in to try to make a playqueue which might help get you something, but that's essentially the third line of defense for intercepting this error
First the script tries to get the existing playqueue and just move to the next item, this is ideal. If there's an error then it will just pull a list of episodes from the show and go to the next episode in the master list
If that fails, then it tries to get on deck episodes (this wasn't fully working before and should be improved with this update, but if you can't get any playqueue data from your server this fix probably won't help)
If all that fails then you get no skip next cause it doesn't have any next episode data
For some reason there's a small subset of users who just can't get playqueue data from the server, the API returns invalid data so pretty much all of these fail
I've subclassed the PlayQueue class and added some more logging information to see if we can get to the bottom of what kind of data the server is returning to see if there's a workaround, but this is a plex issue ultimately. The fact that just trying to get the existing playqueue throws an indexerror makes very little sense
Try the update, which will probably still fail, but should give more detailed logging information about what Plex is returning, and share that and I'll see what I can do
I'm running Beta PMS 1.32.0.6865. I'll try the update, and provide further logging if it continues. Thank you!
Spun up a container with 1.32.0.6918 and its still working ok for me, I admittedly have been running an older version of Plex due to HDR tone mapping / hardware transcoding problems but behavior has been the same across versions in this quick test
Followup, this appears to be working properly now. Thank you!
Could you share the logs? The changes should have added more information
Here is my current log, from before the update through now.
https://gist.github.com/PearsonFlyer/674957c1f419a88e32e0e4240abf215f
Looks like a made a small mistake that was causing the 2nd fallback method to fail, looks like the change to the on deck one worked though so that's good so you got caught on the final net. If you wouldn't mind updating and trying one more playback with logs it'd be appreciated
11ea46791a283594c101ef769b778a143b3ff439
Here, installed the update, and watched a full episode. It worked great, although I still see some errors in the latest log.
https://gist.github.com/PearsonFlyer/15d848112a8163a7b0768f3680c1c60e
Thanks for that, very helpful
I made a small tweak that might be able to work around this error and added some more logging
83f2d6480a92c4c1ab00a1962885f3c73ef2802a
If you don't mind trying once more it's appreciated, I've been unable to reproduce this on my end so having someone test is super helpful
I replaced the skipper.py with the new one and I did not see any errors in the logs.
Excellent, looks like that latest change fixes this problem entirely, so now you're not even needing to fallback methods!
17b108fde9f4f85247c61fac02dbdb8cc9d68344 02fd8fc5bc63a742bba68839ac4c7f02ecf80f59
Two small updates to remove the debug prints and clean up the selected Index
If youre curious, the whole issue is that plex was returning an invalid playQueueSelectedItemOffset
which is supposed to be position of the selected item in the queue. On @PearsonFlyer Brooklyn99 example, the playqueue contained 97 total episodes but Plex was saying that item 105 was selected. Since this was out of bounds it would throw an IndexError
and fail, and it was doing this when just trying to read the existing queue not even create a new one (it would do this for new ones too) so seems like more of a plex problem since the original queue returning a bad index was happening before PAS was changing anything.
Either way, the workaround was to catch that IndexError
and instead of using playQueueSelectedItemOffset
which was invalid, to use playQueueSelectedItemID
and then loop through the items
until it found a matching ID and then set everything based on that position and just ignore the original playQueueSelectedItemOffset
(and actually correct this value to the appropriate index in this final commit)
Make sure that final update doesn't break anything but it looks like a reasonable fix for Plex randomly sending out an invalid position
In total it ended up being very little code
class PASPlayQueue(PlayQueue):
def _loadData(self, data):
try:
super()._loadData(data)
except IndexError:
self.selectedItem = next(item for item in self.items if item.playQueueItemID == self.playQueueSelectedItemID)
self.playQueueSelectedItemOffset = self.items.index(self.selectedItem)
This morning, I updated to the latest build, cleared logs, and played an item. After the credit skip, on the screen I'm getting "Playback Error: There are no playable items", but no errors in the PAS log.
https://gist.github.com/PearsonFlyer/1422ea7fca10a715c69b4fb9f364a332
Alright so I guess my attempt to bypass Plex providing bad PlayQueue data isn't going to work. The player isn't able to use the bad data.
Reverted that change but the fallback method to using the on deck data seems to be enough to keep things going so give that a try
89d48a494df1c8e7d29146c82cae768b9090fa20
Also it might be worthwhile to make a post on the Plex forums with some server logs since this shouldn't be happening
One thing to potentially try would be to shut down your Plex server software, go to your Plex library directory, and delete the Cache folder and then restart the server software and see if that helps, I've had that fix weird problems
https://www.plexopedia.com/plex-media-server/general/clear-cache/
I'm having an issue where the next item won't play when one is done, and it's throwing errors in the PlexAutoSkip log with "list index out of range". Attached is my log from my viewing last night of a few episodes of Brooklyn Nine Nine. It skips the intro, then skips the credits, and then instead of the next episode starting, it goes to the countdown timer, and when the timer ends, it doesn't play. I have to exit back out a screen, move to the next episode, and play.
I am running on the commit from 4 days ago, Windows 10, python 3.10
My config settings that might impact this:
[Skip] mode = skip tags = intro, commercial, advertisement, credits types = movie, episode ignored-libraries = last-chapter = 0.0 unwatched = True first-episode-series = Watched first-episode-season = Always next = True first-safe-tags =
[Binge] ignore-skip-for = 0 safe-tags = same-show-only = False skip-next-max = 0
autoskiplog.txt