everettsouthwick / Eraserr

Python script for deleting unwatched or stale media from Plex servers using Radarr, Sonarr, and Overseerr.
GNU General Public License v3.0
24 stars 1 forks source link

TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime' #66

Closed Jmanhale1 closed 10 months ago

Jmanhale1 commented 10 months ago

Describe the bug Running the script through docker in a dryrun and got this error. Traceback (most recent call last): File "/app/eraserr.py", line 30, in main(args) File "/app/src/main.py", line 24, in main job_runner.run() File "/app/src/jobs.py", line 56, in run self.get_and_delete_job() File "/app/src/jobs.py", line 83, in get_and_delete_job self.get_and_delete_series() File "/app/src/jobs.py", line 141, in get_and_delete_series media = self.plex.get_expired_media("show", self.sonarr_watched_deletion_threshold, self.sonarr_unwatched_deletion_threshold, self.schedule_interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/decorator.py", line 232, in fun return caller(func, *(extras + args), *kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/retry/api.py", line 73, in retry_decorator return __retry_internal(partial(f, args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/retry/api.py", line 33, in retry_internal return f() ^^^ File "/app/src/clients/plex.py", line 114, in get_expired_media if self.__media_is_expired(item, watched_media_expiry_seconds, unwatched_media_expiry_seconds, schedule_interval): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/src/clients/plex.py", line 73, in media_is_expired added_at = max(episode.addedAt for episode in media.episodes()) if media.episodes() else added_at ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime'

To Reproduce Steps to reproduce the behavior:

  1. Run Script after setting up config with all details needed.
  2. Wait for program to run into error.
  3. get error

Expected behavior First time i've run the script. Not really sure what happens once it finishes scan. I was hoping for some kind of output file to be created that shows what is going to be deleted.

Screenshots image

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

Jmanhale1 commented 10 months ago

I assumed that this was possibly a issue with my library so i removed the libraries and re-added them and it seems to have fixed the issue for me. However might be worth adding a catch for that error.