RemiRigal / Plex-Auto-Languages

Automated language selection for Plex TV Shows !
MIT License
409 stars 15 forks source link

JSONDecodeError when launching the container #75

Closed ethw closed 1 year ago

ethw commented 1 year ago

Hello, I'm getting a JSONDecodeError that seems to have something to do with grabbing either the plex.url, plex.token, or notifier. My config.yaml was working fine awhile back, not sure what changed. I have tried checking that my token is correct, and tried multiple plex urls. Nothing has fixed the issue. Any help would be much appreciated, I've found this tool invaluable for watching shows with poorly labelled subtitles.

My container version tag is latest, my plex version is 1.31.3.6868.

Here's the log containing the error.

2023-04-01 13:26:15,147 [INFO] Parsing config file '/config/config.yaml'
2023-04-01 13:26:15,155 [INFO] The provided configuration has been successfully validated
2023-04-01 13:26:15,155 [INFO] Starting scheduler
2023-04-01 13:26:16,441 [INFO] Successfully connected as user '<censored>' (id: 1)
Traceback (most recent call last):
  File "main.py", line 118, in <module>
    plex_auto_languages.start()
  File "main.py", line 68, in start
    self.init()
  File "main.py", line 45, in init
    self.plex = PlexServer(self.config.get("plex.url"), self.config.get("plex.token"), self.notifier, self.config)
  File "/app/plex_auto_languages/plex_server.py", line 110, in __init__
    self.cache = PlexServerCache(self)
  File "/app/plex_auto_languages/plex_server_cache.py", line 41, in __init__
    if not self._load():
  File "/app/plex_auto_languages/plex_server_cache.py", line 114, in _load
    cache = json.load(stream)
  File "/usr/local/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Here's my config.yaml file

plexautolanguages:
  # Update language for the entire show or only for the current season
  # Accepted values:
  #   - show (default)
  #   - season
  update_level: "show"

  # Update all episodes of the show/season or only the next ones
  # Accepted values:
  #   - all (default)
  #   - next
  update_strategy: "all"

  # Whether or not playing a file should trigger a language update, defaults to 'true'
  trigger_on_play: true

  # Whether or not scanning the library for new files should trigger a language update, defaults to 'true'
  # A newly added episode will be updated based on the most recently watched episode, or the first episode of the show if it has never been watched
  trigger_on_scan: true

  # Whether or not navigating the Plex library should trigger a language update, defaults to 'false'
  # Only the Plex web client and the Plex for Windows app support this feature
  # Set this to 'true' only if you want to perform changes whenever the default track of an episode is updated, even when the episode is not played.
  # Setting this parameter to 'true' can result in higher resource usage.
  trigger_on_activity: false

  # Whether or not to refresh the cached library whenever the Plex server scans its own library, defaults to 'true'
  # Disabling this parameter will prevent PlexAutoLanguages from detecting updated files for an already existing episode
  # It is recommended to disable this parameter if you have a large TV Show library (10k+ episodes)
  refresh_library_on_scan: false

  # Plex configuration
  plex:
    # A valid Plex URL (required)
    url: "https://plex.<censored>.ca"
    # A valid Plex Token (required)
    token: "<censored>"

  scheduler:
    # Whether of not to enable the scheduler, defaults to 'true'
    # The scheduler will perform a deeper analysis of all recently played TV Shows
    enable: true
    # The time at which the scheduler start its task with the format 'HH:MM', defaults to '02:00'
    schedule_time: "04:30"

  notifications:
    # Whether or not to enable the notifications through Apprise, defaults to 'false'
    # A notification is sent whenever a language change is performed
    enable: false
    # An array of Apprise configurations, see Apprise docs for more information: https://github.com/caronc/apprise
    # The array 'users' can be specified in order to link notification URLs with specific users
    #   Defaults to all users if not present
    # The array 'events' can be specified in order to get notifications only for specific events
    #   Valid event values: "play_or_activity" "new_episode" "updated_episode" "scheduler"
    #   Defaults to all events if not present
    apprise_configs:
      # This URL will be notified of all changes during all events
      - "discord://webhook_id/webhook_token"
      # These URLs will only be notified of language change for users "MyUser1" and "MyUser2"
      - urls:
          - "gotify://hostname/token"
          - "pover://user@token"
        users:
          - "MyUser1"
          - "MyUser2"
      # This URL will only be notified of language change for user "MyUser3" during play or activity events
      - urls:
          - "tgram://bottoken/ChatID"
        users:
          - "MyUser3"
        events:
          - "play_or_activity"
      # This URL will be notified of language change during scheduler tasks only
      - urls:
          - "gotify://hostname/token"
        events:
          - "scheduler"
      - "..."

  # Whether or not to enable the debug mode, defaults to 'false'
  # Enabling debug mode will significantly increase the number of output logs
  debug: false
rickfo97 commented 1 year ago

Got the same error on latest(). Something was wrong with the cache. Deleting the file in the cache folder fixed it. Think it's already fixed on master tag with #59

ethw commented 1 year ago

Much appreciated @rickfo97, that fixed my problem. Glad to see it's fixed on master already.