mdhiggins / PlexAutoSkip

Automatically skip content in Plex
MIT License
198 stars 11 forks source link

[Bug] Exception in skipPlayerTo when pq is None #65

Closed alainbryden closed 5 months ago

alainbryden commented 8 months ago

Just a minor issue I'm sure, but the following error was raised when a movie finished playing and there was nothing queued for afterwards:

INFO - Found ended session 63 [157736] (Luck) Roku|dddf31cbe30050cccbb61462054c09e2 that has reached the end of its duration 6324266 with viewOffset 6299801 with skip-next enabled, will skip to next
ERROR - Exception, removing from cache to prevent false triggers, will be restored with next sync
Traceback (most recent call last):
  File "C:\Users\Alain Bryden\Utilities\Plex\PlexAutoSkip\resources\skipper.py", line 217, in _seekTo
    self.seekPlayerTo(mediaWrapper.player, mediaWrapper, targetOffset)
  File "C:\Users\Alain Bryden\Utilities\Plex\PlexAutoSkip\resources\skipper.py", line 232, in seekPlayerTo
    return self.skipPlayerTo(player, mediaWrapper, pq, server)
  File "C:\Users\Alain Bryden\Utilities\Plex\PlexAutoSkip\resources\skipper.py", line 307, in skipPlayerTo
    if mediaWrapper.media.type == "episode" and not pq or not pq.items:
AttributeError: 'NoneType' object has no attribute 'items'

Looks like you have a pre-check on pq here, but it might be an order of operations issue, e.g. you might have intended to go: if mediaWrapper.media.type == "episode" and (not pq or not pq.items):

mdhiggins commented 5 months ago

18ea922a0ccb6904288fdbc63778641401b604cf

Thanks