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

Docker container does not work (ValueError: invalid literal for int() with base 10 on tautulli API) #29

Closed Merrick28 closed 1 year ago

Merrick28 commented 1 year ago

Describe the bug Using docker, bug in logs with tautulli

Additional context I launch eraserr using docker (tag latest)

My config file is

{
    "tautulli": {
        "api_key": "xxxxxxxxxxxxxxxxxxxxxxx",
        "base_url": "http://tautulli:8181/api/v2",
        "fetch_limit": 25
    },
    "radarr": {
        "api_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "base_url": "http://radarrnightly:7878/api/v3",
        "exempt_tag_names": [
            "do-not-delete"
        ]
    },
    "sonarr": {
        "api_key": "xxxxxxxxxxxxxxxxxxxxx",
        "base_url": "http://sonarr:8989/api/v3",
        "monitor_continuing_series": true,
        "exempt_tag_names": [
            "do-not-delete"
        ]
    },
    "overseerr": {
        "api_key": "xxxxxxxxxxxxxxxxxxx",
        "base_url": "http://overseerr:5055/api/v1",
        "fetch_limit": 10
    },
    "plex": {
        "base_url": "http://plex:32400",
        "token": "xxxxxxxxxxxxxxxxx",
        "refresh": true
    },
    "last_watched_days_deletion_threshold": 90,
    "unwatched_days_deletion_threshold": 30,
    "dry_run": true,
    "schedule_interval": 86400
}

The docker logs show

JOB :: Starting
Traceback (most recent call last):
  File "/app/eraserr.py", line 34, in <module>
    main(args)
  File "/app/src/main.py", line 25, in main
    job_runner.run()
  File "/app/src/jobs.py", line 23, in run
    self.job()
  File "/app/src/jobs.py", line 38, in job
    total_size = self.fetch_movies()
                 ^^^^^^^^^^^^^^^^^^^
  File "/app/src/jobs.py", line 57, in fetch_movies
    all_tmdb_ids = self.tautulli.fetch_and_count_unplayed_titles(section_ids)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/tautulli.py", line 192, in fetch_and_count_unplayed_titles
    count, item_ids = self.fetch_and_count_unplayed_titles_in_section(section_id)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/tautulli.py", line 161, in fetch_and_count_unplayed_titles_in_section
    if item["last_played"] is None and int(item["added_at"]) < unwatched_threshold_timestamp:
                                       ^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

And the container keeps restarting.

The api keys are correct.

Merrick28 commented 1 year ago

UPDATE : this comes from items in Tautulli that have a empty value on "added_at". When I remove this items from plex, all is OK. Maybe add a try/exception in this case, or a test on this value ?

everettsouthwick commented 1 year ago

Thank you for the bug report! I am in the process of phasing out the dependency on Tautulli in favor of Plex, since all the same information is available there and I can reduce the dependencies on external services / make set up easier. I will fix this with that change.

everettsouthwick commented 1 year ago

Resolved #31