blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.66k stars 308 forks source link

Issue with media_manager.py when running on Anime Series #366

Closed soldius closed 1 year ago

soldius commented 1 year ago

Describe the bug

I was able to use the script perfectly when running on a regular movies database with Plex meta agent.

I tried to run it on my Anime Series database using the following command: python3 /mnt/user/appdata/media_manager.py --libraries "Anime Series" --select rating --selectValue "<_5" --action show

and I got the following errors:

Checking library: 'Anime Series' items with <5 rating...
Traceback (most recent call last):
  File "/mnt/user/appdata/media_manager.py", line 818, in <module>
    rating_lst += rating_work(sectionID=_library.key, operator=op, value=value)
  File "/mnt/user/appdata/media_manager.py", line 512, in rating_work
    metadata = Metadata(_meta)
  File "/mnt/user/appdata/media_manager.py", line 149, in __init__
    self.file = show.locations[0]
IndexError: list index out of range

This database uses Absolute Series Scanner as the agent. I figured it was not the right format for the script so I refresh all the meta data inside it using Plex TV Show meta agent. Ran the same command again and got:

Checking library: 'Anime Series' items with <5 rating...
Traceback (most recent call last):
  File "/mnt/user/appdata/media_manager.py", line 818, in <module>
    rating_lst += rating_work(sectionID=_library.key, operator=op, value=value)
  File "/mnt/user/appdata/media_manager.py", line 512, in rating_work
    metadata = Metadata(_meta)
  File "/mnt/user/appdata/media_manager.py", line 158, in __init__
    show_size.append(int(episode.file_size))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Provide logs

Tautulli logs - https://gist.github.com/soldius/4d277bd37e2fae03c57d6433b6656df5

PlexAPI logs - https://gist.github.com/soldius/ba74e914105f78f48b9647e95e28a437

Link to script with bug/issue https://github.com/blacktwin/JBOPS/blob/master/utility/media_manager.py

Expected behavior It should have remove a lot of anime series.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

blacktwin commented 1 year ago

The size issue is likely due to Tautulli not knowing the size of the items. In Tautulli settings > General > Show Advanced and have this option checked. image

Then you'll need to run the media scan on Tautulli for any library you want to see the file sizes. image

If size does not matter to you, then you'd need to comment out any references to size.