mdhiggins / PlexAutoSkip

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

Windows Roku TV "No Playable Items" and PlexAutoSkip: IndexError: list index out of range #53

Closed ExtremeFiretop closed 1 year ago

ExtremeFiretop commented 1 year ago

Hi @mdhiggins

I'm running the Plex app version: 7.6 Build 1 on a Roku TV, and PMS on Windows Version: 1.32.5.7349 With the latest commits and PlexAPI version 4.15 for python.

Sometimes content skips correctly and other times it fails all together with the below error in AutoSkip:

INFO - Websocket connected INFO - Found new session 1 [12362] (Modern Family s06e02 - Do Not Push) 55 Hisense Roku TV|49cea2b26a36823910c6a87cc6058375 viewOffset 0 ExtremeFiretop on Plex for Roku (proxying: False), sessions: 0 INFO - Found ended session 1 [12362] (Modern Family s06e02 - Do Not Push) 55 Hisense Roku TV|49cea2b26a36823910c6a87cc6058375 that has reached the end of its duration 1298304 with viewOffset 1297000 with skip-next enabled, will skip to next ERROR - Traceback (most recent call last): File "C:\Program Files\MKVToolNix\Custom Scripts\PlexAutoSkip-master\resources\skipper.py", line 275, in skipPlayerTo current = PlayQueue.get(self.server, mediaWrapper.playQueueID) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 133, in get c = cls(server, data, initpath=path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\base.py", line 62, in init self._loadData(data) File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 66, in _loadData self.selectedItem = self[self.playQueueSelectedItemOffset]


  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 71, in __getitem__
    return self.items[key]
           ~~~~~~~~~~^^^^^
IndexError: list index out of range
ERROR - Unable to create new PlayQueue for 1 [12362] (Modern Family s06e02 - Do Not Push) 55 Hisense Roku TV|49cea2b26a36823910c6a87cc6058375
Traceback (most recent call last):
  File "C:\Program Files\MKVToolNix\Custom Scripts\PlexAutoSkip-master\resources\skipper.py", line 275, in skipPlayerTo
    current = PlayQueue.get(self.server, mediaWrapper.playQueueID)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 133, in get
    c = cls(server, data, initpath=path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\base.py", line 62, in __init__
    self._loadData(data)
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 66, in _loadData
    self.selectedItem = self[self.playQueueSelectedItemOffset]
                        ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 71, in __getitem__
    return self.items[key]
           ~~~~~~~~~~^^^^^
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\MKVToolNix\Custom Scripts\PlexAutoSkip-master\resources\skipper.py", line 296, in skipPlayerTo
    pq = PlayQueue.create(server, episodes, startItem)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 190, in create
    c = cls(server, data, initpath=path)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\base.py", line 62, in __init__
    self._loadData(data)
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 66, in _loadData
    self.selectedItem = self[self.playQueueSelectedItemOffset]
                        ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Joel\AppData\Roaming\Python\Python311\site-packages\plexapi\playqueue.py", line 71, in __getitem__
    return self.items[key]
           ~~~~~~~~~~^^^^^
IndexError: list index out of range

and this error on the TV: No playable items

367921919_1031103921400914_7831245129902098444_n

Other times in the same series, same season on the same TV, it works and skips the 15 second countdown at the end. I know this has been brought up once before here: https://github.com/mdhiggins/PlexAutoSkip/issues/44

And I tried all the relevant troubleshooting I can think of...

  1. Restarting the Plex server
  2. Restarting the player TV
  3. Signing out and back into the Roku player app
  4. Resetting the Plex Server cache,
  5. Updating my Plex Token
  6. Even resetting the Plex Server DataBase and letting it rebuild from scratch after cache was wiped
  7. Updating python
  8. Updating Plex API all to the latest versions.
  9. Disabled Network DDOS protection on the firewall, etc...

The weird thing is, on another different TV on my network (A 2017 Samsung running Tizen OS) and Plex app version: 5.32.1 and it won't give the "No playable items" if the AutoSkip fails with this error, it simply counts down at the end as usual and then starts up the next episode, but on the Roku when it fails, it always gives the "No playable items" and I have to get the remote and click okay and select the next episode manually.

I'm at a loss why my Roku will randomly throw these errors and stop working, any ideas would be appreciated in this regard...

Here is the config file, it's all pretty default except the credentials left out:

[Server] address = 127.0.0.1 ssl = False port = 32400

[Security] ignore-certs = True

[Skip] tags = intro, commercial, advertisement last-chapter = 0.0 unwatched = True first-episode-series = Watched first-episode-season = Always next = True mode = skip types = movie, episode ignored-libraries = first-safe-tags =

[Offsets] start = 3000 end = 1000 duration = 0 command = 500 tags = intro

[Binge] ignore-skip-for = 0 safe-tags = same-show-only = False skip-next-max = 0

[Volume] low = 0 high = 100

ExtremeFiretop commented 1 year ago

Nvm. Closing this for now... The issue was the config file...

This below is how it was set. When the issues were happening.

[Server]
address = 127.0.0.1
ssl = False
port = 32400

This below never connected to the server. (Even though it does for my other tools like Ombi)

[Server]
address = 127.0.0.1
ssl = True
port = 32400

This below connected and has been working for both my secure and insecure clients on the network so far.

[Server]
address = ddns.address
ssl = True
port = 32400

Edit: Also seems to work with:

[Server]
address = localhost
ssl = True
port = 32400

or

[Server]
address = ACTUAL IP OF PC
ssl = True
port = 32400

Just not 127.0.0.1 for some reason....

ExtremeFiretop commented 1 year ago

It started happening again. Seems to be something specific with the Roku TV and how it "sleeps" instead of "turns off".

As soon as I reboot the TV (Hard shut down and restart) it works normally again without any changes to the server or config.

mdhiggins commented 1 year ago

Probably not going to be relevant since plex is implementing native auto skipping

https://forums.plex.tv/t/player-experience/857990

ExtremeFiretop commented 1 year ago

Probably not going to be relevant since plex is implementing native auto skipping

https://forums.plex.tv/t/player-experience/857990

I consider this good news, but I just wanted to advise since I still use the project for now.

mdhiggins commented 1 year ago

Not able to reproduce this on my Roku TV so not sure. It's failing to produce the data needed for the playqueue.

The official Plex update for Roku is live already though

ExtremeFiretop commented 1 year ago

Not able to reproduce this on my Roku TV so not sure. It's failing to produce the data needed for the playqueue.

The official Plex update for Roku is live already though

Ha! I just checked and both my TVs have it, I bet this might be part of the problem with the odd behavior's until i reboot.

Thanks for bringing this to my attention! Really valuable info!