terrelsa13 / MUMC

Multi-User Media Cleaner aka MUMC (pronounced Mew-Mick) will go through movies, tv episodes, audio tracks, and audiobooks in your Emby/Jellyfin libraries deleting media items you no longer want.
GNU General Public License v3.0
99 stars 6 forks source link

Doesn't delete files (DELETE_FILES=True) #41

Closed TonioRoffo closed 2 years ago

TonioRoffo commented 2 years ago

Getting a traceback after MUMC lists all files to delete/keep (which is working correctly)

:*[DELETE] - Episode - Whose Line Is It Anyway - s17.e02 - Gary Anthony Williams 7 - ABC - Played 551 days ago - Play Count: 1 - Created 631 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - EpisodeID: 104736

Traceback (most recent call last): File "/home/xbmc/scripts/mumc.py", line 8683, in deleteItems=get_media_items() File "/home/xbmc/scripts/mumc.py", line 6873, in get_media_items deleteItems=get_minEpisodesToKeep(episodeCounts_byUserId, deleteItems) File "/home/xbmc/scripts/mumc.py", line 3618, in get_minEpisodesToKeep if (deleteItem['ParentIndexNumber'] > episodeTracker[deleteItem['SeriesId']]['MaxSeason']): TypeError: '>' not supported between instances of 'str' and 'int'

Files aren't being deleted.

Emby user used has rights to delete files.

Running with either python3 or python3.8

terrelsa13 commented 2 years ago

Hey @TonioRoffo

It looks like a value being compared is a string when the script is expecting an integer. TypeError: '>' not supported between instances of 'str' and 'int'

  1. Please set DEBUG=3 in the mumc_config.py file.
  2. Run the script again so the error happens.
  3. Reply back with the mumc_DEBUG.log located in the /home/xbmc/scripts/ folder attached to your reply.
TonioRoffo commented 2 years ago

Here are the results mumc_DEBUG.log

terrelsa13 commented 2 years ago

This appears to be the last API call the script sent before it failed.

http://192.168.1.14:8096/emby/Users/6d9b1697f9b042ffaa77811b6765a606/Items/104736?enableImages=False&enableUserData=True&Fields=ParentId,Genres,Tags&api_key=f03613eb65c64dec92f5a15570eab6bd

Put this link into a browser that can access your Emby server; then press enter.

If you are using Firefox

If you are using Chrome/Edge

TonioRoffo commented 2 years ago

Here is the text

result.txt

terrelsa13 commented 2 years ago

Still not able to reproduce this on my setup.

I have created a test script with debug already enabled and special debug output for the part that is failing. It should show exactly what the script is seeing before it fails.

  1. Download this test script: mumc.py.txt
  2. Copy/Paste mumc.py.txt into your /home/xbmc/scripts/ folder
  3. Rename the existing mumc.py to mumc.py.orig
  4. Rename mumc.py.txt to mumc.py
  5. Run the test script; it should fail
  6. Reply back with the mumc_DEBUG.log located in the /home/xbmc/scripts/ folder attached to your reply.
TonioRoffo commented 2 years ago

Thank you for your hard work :)

here is the debug log

[mumc_DEBUG.log](https://github.com/terrelsa13/MUMC/files/9762281/mumc_DEBUG.log)

terrelsa13 commented 2 years ago

No problem!

Good news. Found the exact media item that is causing the issue. For some reason the Season# (aka ParentIndexNumber) for the episode is "??" instead of a number. You can see this in the last section of the mumc_DEBUG.log.

deleteItem['ParentIndexNumber'] : Is String
deleteItem['ParentIndexNumber'] = ??

You will also be able to see all of the debug output sections above the last one show the Season# is an integer instead of a string.


Same steps; new link.

Put this link into a browser that can access your Emby server; then press enter.

http://192.168.1.14:8096/emby/Users/6d9b1697f9b042ffaa77811b6765a606/Items/105642?enableImages=False&enableUserData=True&Fields=ParentId,Genres,Tags&api_key=f03613eb65c64dec92f5a15570eab6bd

If you are using Firefox

  1. Click the "save" button in the top left corner
  2. Name and save the file
  3. Reply back with the file you just saved

If you are using Chrome/Edge

  1. Click anywhere in the Chrome window
  2. Select Ctrl+a to highlight all text
  3. Select Ctrl+c to copy all text
  4. Open a text editor (notepad, notepad++, visual studio, ultraedit, etc...)
  5. Select Ctrl+v to paste what was copied into the text editor
  6. Name and save the file
  7. Reply back with the file you just saved
TonioRoffo commented 2 years ago

aah, that makes sense. I've checked this show and it's a sport series, all of them had ?? as season entry, somehow.

Those were supposed to be deleted anyway, so I have removed them manually, after which the script runs without problem.

All solved - Thank you!

terrelsa13 commented 2 years ago

Great! Glad we got it working.

Do you mind still attaching the output from the link?

http://192.168.1.14:8096/emby/Users/6d9b1697f9b042ffaa77811b6765a606/Items/105642?enableImages=False&enableUserData=True&Fields=ParentId,Genres,Tags&api_key=f03613eb65c64dec92f5a15570eab6bd

I want to see if there are some other metadata attributes for this episode I can use to prevent this error for happening again or for anyone else that might have the same issue.

TonioRoffo commented 2 years ago

Hello, sorry, but I don't have the file anymore, was too late to see your remark, sorry.

terrelsa13 commented 2 years ago

It's all good!