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
92 stars 6 forks source link

Error running MUMC #100

Closed keppo070 closed 6 months ago

keppo070 commented 7 months ago

I get this with version 5.4.0 but also with version 5.3.4

I was still running version 5.3.4 because this version does what i want. Yesterday is failed suddenly. Then I tried the new version.

This is version 5.3.4

Process Process-5:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/patrick/programmeren/python/mumc5/MUMC/mumc_modules/mumc_get_media.py", line 626, in get_mediaItems
    RecursiveItemCount=int(series_info['RecursiveItemCount'])
KeyError: 'RecursiveItemCount'
Traceback (most recent call last):
  File "/home/patrick/programmeren/python/mumc5/MUMC/mumc.py", line 106, in <module>
    MUMC()
  File "/home/patrick/programmeren/python/mumc5/MUMC/mumc.py", line 76, in MUMC
    cfg=init_getMedia(cfg)
  File "/home/patrick/programmeren/python/mumc5/MUMC/mumc_modules/mumc_get_media.py", line 803, in init_getMedia
    the_dict['episode_dict'].update(episode_returns['media_dict'])
  File "<string>", line 2, in __getitem__
  File "/usr/lib/python3.9/multiprocessing/managers.py", line 824, in _callmethod
    raise convert_to_error(kind, result)
KeyError: 'media_dict'

Yhis is version 5.4.0

----------------------------------------------------------------------------------------
During the configuration check, the following option(s) were added to mumc_config.yaml file...
   admin_settings > behavior > users > monitor_disabled
----------------------------------------------------------------------------------------
Process Process-5:
Traceback (most recent call last):
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/patrick/programmeren/python/mumc5b/MUMC/mumc_modules/mumc_get_media.py", line 626, in get_mediaItems
    RecursiveItemCount=int(series_info['RecursiveItemCount'])
KeyError: 'RecursiveItemCount'
Traceback (most recent call last):
  File "/home/patrick/programmeren/python/mumc5b/MUMC/mumc.py", line 105, in <module>
    MUMC()
  File "/home/patrick/programmeren/python/mumc5b/MUMC/mumc.py", line 76, in MUMC
    cfg=init_getMedia(cfg)
  File "/home/patrick/programmeren/python/mumc5b/MUMC/mumc_modules/mumc_get_media.py", line 833, in init_getMedia
    the_dict['episode_dict'].update(episode_returns['media_dict'])
  File "<string>", line 2, in __getitem__
  File "/usr/lib/python3.9/multiprocessing/managers.py", line 824, in _callmethod
    raise convert_to_error(kind, result)
KeyError: 'media_dict'
terrelsa13 commented 7 months ago

Please set DEBUG: 3. Run MUMC again. And attach the debug file.

keppo070 commented 7 months ago

I tried om my test environment and the script worked. So I guessed it was something related to my config. I started a new mumc_config.yaml and it worked. After putting in my own configuration I again got the error.

After some experimenting I found out that it is related to the minimum_episodes: 1 when I change it to zero everything works.

I have added my mumc_config.yaml

mumc_config.yaml.txt

When I started a fresh mumc_config.yaml it seems to default to blacktagged = true. Although when created a left the option blank when creating on first run.

terrelsa13 commented 7 months ago

After some experimenting I found out that it is related to the minimum_episodes: 1 when I change it to zero everything works.

Correct. The error is saying it cannot find a dictionary key (series_info['RecursiveItemCount']) it is looking for in the data returned from Emby. I have added special debug to the file I have attached. It will print the data causing the issue to the mumc_DEBUG.log.

mumc_get_media.py.txt

  1. Download the attached file
  2. Rename it to mumc_get_media.py
  3. Navigate to /home/patrick/programmeren/python/mumc5b/MUMC/mumc_modules/
  4. In this folder, rename the original mumc_get_media.py to mumc_get_media.py.orig
  5. Move the downloaded mumc_get_media.py from step#1 into /home/patrick/programmeren/python/mumc5b/MUMC/mumc_modules/
  6. Open /home/patrick/programmeren/python/mumc5b/MUMC/mumc_config.yaml in a text editor
  7. Turn off DEBUG (i.e. DEBUG: 0)
  8. Run the MUMC script again
  9. This time when the error occurs it should save the series_info writing it to mumc_DEBUG.log
  10. Attach the log in your reply
keppo070 commented 7 months ago

Thanks for your complete answer. Attached is the logfile. Hope this helps.

mumc_DEBUG.log

terrelsa13 commented 7 months ago

I tried this on both Emby versions 4.7.14.0 and 4.8.1.0.

Looks like from Emby 4.8.1.0 the field RecursiveItemCount needs to be explicitly specified in the API request.

Fix is in release of MUMC v5.4.1.

keppo070 commented 6 months ago

Thank you, for the quick fix