Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)
MIT License
1.62k stars 106 forks source link

sync not working on tool which installed by pips #1990

Closed SupunLakshithe closed 5 months ago

SupunLakshithe commented 5 months ago

Confirmation

The problem

when run the script it gives an error saying (logging is done in both plex and trakt)

KeyError: 'liked_list' Error: Error running sync command: 'liked_list'

Steps to reproduce the behavior

  1. Install latest script by pipx on dabian
  2. run script

Error trace / logs

WARNING  plextraktsync without command is deprecated. Executing "plextraktsync sync"
INFO     PlexTraktSync [0.31.0]
INFO     Connecting with url: https://192-168-1-237.ef8a40a56efa4759a5ebdb07a505d587.plex.direct:32400, timeout 300 seconds
ERROR    'liked_list'
         ╭───────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────────────────────────╮
         │ /home/server0/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/cli.py:26 in wrap                                                                                           │
         │                                                                                                                                                                                                      │
         │    23 │   │   │   cmd = getattr(module, name)                                                                                                                                                        │
         │    24 │   │   │                                                                                                                                                                                      │
         │    25 │   │   │   try:                                                                                                                                                                               │
         │ ❱  26 │   │   │   │   cmd(*args, **kwargs)                                                                                                                                                           │
         │    27 │   │   │   except EOFError as e:                                                                                                                                                              │
         │    28 │   │   │   │   raise ClickException(                                                                                                                                                          │
         │    29 │   │   │   │   │   f"Program requested terminal, No terminal is connected: {e}"                                                                                                               │
         │                                                                                                                                                                                                      │
         │ /home/server0/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/commands/sync.py:75 in sync                                                                                 │
         │                                                                                                                                                                                                      │
         │   72 │   │   return                                                                                                                                                                                  │
         │   73 │                                                                                                                                                                                               │
         │   74 │   with measure_time("Completed full sync"):                                                                                                                                                   │
         │ ❱ 75 │   │   runner = factory.sync                                                                                                                                                                   │
         │   76 │   │   if runner.config.need_library_walk:                                                                                                                                                     │
         │   77 │   │   │   w.print_plan(print=logger.info)                                                                                                                                                     │
         │   78 │   │   if dry_run:                                                                                                                                                                             │
         │                                                                                                                                                                                                      │
         │ /usr/lib/python3.11/functools.py:1001 in __get__                                                                                                                                                     │
         │                                                                                                                                                                                                      │
         │    998 │   │   │   │   # check if another thread filled cache while we awaited lock                                                                                                                  │
         │    999 │   │   │   │   val = cache.get(self.attrname, _NOT_FOUND)                                                                                                                                    │
         │   1000 │   │   │   │   if val is _NOT_FOUND:                                                                                                                                                         │
         │ ❱ 1001 │   │   │   │   │   val = self.func(instance)                                                                                                                                                 │
         │   1002 │   │   │   │   │   try:                                                                                                                                                                      │
         │   1003 │   │   │   │   │   │   cache[self.attrname] = val                                                                                                                                            │
         │   1004 │   │   │   │   │   except TypeError:                                                                                                                                                         │
         │                                                                                                                                                                                                      │
         │ /home/server0/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/util/Factory.py:143 in sync                                                                                 │
         │                                                                                                                                                                                                      │
         │   140 │   │   plex = self.plex_api                                                                                                                                                                   │
         │   141 │   │   trakt = self.trakt_api                                                                                                                                                                 │
         │   142 │   │                                                                                                                                                                                          │
         │ ❱ 143 │   │   return Sync(self.sync_config, plex, trakt)                                                                                                                                             │
         │   144 │                                                                                                                                                                                              │
         │   145 │   @cached_property                                                                                                                                                                           │
         │   146 │   def progressbar(self):                                                                                                                                                                     │
         │                                                                                                                                                                                                      │
         │ /home/server0/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/util/Factory.py:301 in sync_config                                                                          │
         │                                                                                                                                                                                                      │
         │   298 │   def sync_config(self):                                                                                                                                                                     │
         │   299 │   │   from plextraktsync.config.SyncConfig import SyncConfig                                                                                                                                 │
         │   300 │   │                                                                                                                                                                                          │
         │ ❱ 301 │   │   return SyncConfig(self.config, self.server_config)                                                                                                                                     │
         │   302 │                                                                                                                                                                                              │
         │   303 │   @cached_property                                                                                                                                                                           │
         │   304 │   def queue(self):                                                                                                                                                                           │
         │                                                                                                                                                                                                      │
         │ /home/server0/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/config/SyncConfig.py:19 in __init__                                                                         │
         │                                                                                                                                                                                                      │
         │    16 │   def __init__(self, config: Config, server_config: PlexServerConfig):                                                                                                                       │
         │    17 │   │   self.config = dict(config["sync"])                                                                                                                                                     │
         │    18 │   │   self.liked_lists = config["liked_lists"]                                                                                                                                               │
         │ ❱  19 │   │   self.liked_lists_overrides = config["liked_list"] or {}                                                                                                                                │
         │    20 │   │   self.server_config = server_config.sync_config                                                                                                                                         │
         │    21 │                                                                                                                                                                                              │
         │    22 │   def __getitem__(self, key):                                                                                                                                                                │
         │                                                                                                                                                                                                      │
         │ /home/server0/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/config/Config.py:54 in __getitem__                                                                          │
         │                                                                                                                                                                                                      │
         │    51 │   def __getitem__(self, item):                                                                                                                                                               │
         │    52 │   │   if not self.initialized:                                                                                                                                                               │
         │    53 │   │   │   self.initialize()                                                                                                                                                                  │
         │ ❱  54 │   │   return dict.__getitem__(self, item)                                                                                                                                                    │
         │    55 │                                                                                                                                                                                              │
         │    56 │   def __contains__(self, item):                                                                                                                                                              │
         │    57 │   │   if not self.initialized:                                                                                                                                                               │
         ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
         KeyError: 'liked_list'
Error: Error running sync command: 'liked_list'

Expected behavior

shoud run as normal.

Inspect of problematic items

No response

Workarounds

change "liked_list" to "liked_lists" on the line 19 in SyncConfig.py at /home/$user/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/config/

Config file contents

cache:
  path: /home/server0/.cache/PlexTraktSync/trakt_cache
excluded-libraries:
- Private
- Family Holidays
config:
  dotenv_override: true
plex:
  timeout: 300
logging:
  append: true
  console_time: false
  debug: true
  filename: plextraktsync.log
  filter_loggers: null
  filter: null
sync:
  rating_priority: plex
  plex_to_trakt:
    collection: true
    clear_collected: true
    ratings: true
    watched_status: true
    watchlist: true
  trakt_to_plex:
    liked_lists: false
    ratings: true
    watched_status: true
    watchlist: true
    watchlist_as_playlist: true
    playback_status: false
liked_lists:
  keep_watched: true
watch:
  add_collection: false
  remove_collection: false
  scrobble_threshold: 80
  username_filter: true
  media_progressbar: true
  ignore_clients: null
xbmc-providers:
  movies: imdb
  shows: tvdb

Install method

pipx

Version

0.31.0

Python Version

3.11.2

Plex Server Version

4.15.13

Operating System and Version

Linux-6.1.0-21-amd64-x86_64-with-glibc2.36

apriliars3 commented 5 months ago

Works?

sasagr commented 5 months ago

I have the same error "Error: Error running sync command: 'liked_list'" after first run on my raspberry pi arm64. Installed with docker-compose, but same error comes with other kind of installation.

Connecting with url: http://xx.xx.xx.xx:32400, timeout 30 seconds ERROR 'liked_list'

the IP is correct. Here the full traceback:

Traceback (most recent call last) ─────────────────────────────────────╮ │ /app/plextraktsync/cli.py:26 in wrap │ │ │ │ 23 │ │ │ cmd = getattr(module, name) │ │ 24 │ │ │ │ │ 25 │ │ │ try: │ │ ❱ 26 │ │ │ │ cmd(*args, **kwargs) │ │ 27 │ │ │ except EOFError as e: │ │ 28 │ │ │ │ raise ClickException( │ │ 29 │ │ │ │ │ f"Program requested terminal, No terminal is connected: {e}" │ │ │ │ /app/plextraktsync/commands/sync.py:75 in sync │ │ │ │ 72 │ │ return │ │ 73 │ │ │ 74 │ with measure_time("Completed full sync"): │ │ ❱ 75 │ │ runner = factory.sync │ │ 76 │ │ if runner.config.need_library_walk: │ │ 77 │ │ │ w.print_plan(print=logger.info) │ │ 78 │ │ if dry_run: │ │ │ │ /usr/local/lib/python3.12/functools.py:995 in get │ │ │ │ 992 │ │ │ raise TypeError(msg) from None │ │ 993 │ │ val = cache.get(self.attrname, _NOT_FOUND) │ │ 994 │ │ if val is _NOT_FOUND: │ │ ❱ 995 │ │ │ val = self.func(instance) │ │ 996 │ │ │ try: │ │ 997 │ │ │ │ cache[self.attrname] = val │ │ 998 │ │ │ except TypeError: │ │ │ │ /app/plextraktsync/util/Factory.py:143 in sync │ │ │ │ 140 │ │ plex = self.plex_api │ │ 141 │ │ trakt = self.trakt_api │ │ 142 │ │ │ │ ❱ 143 │ │ return Sync(self.sync_config, plex, trakt) │ │ 144 │ │ │ 145 │ @cached_property │ │ 146 │ def progressbar(self): │ │ │ │ /app/plextraktsync/util/Factory.py:301 in sync_config │ │ │ │ 298 │ def sync_config(self): │ │ 299 │ │ from plextraktsync.config.SyncConfig import SyncConfig │ │ 300 │ │ │ │ ❱ 301 │ │ return SyncConfig(self.config, self.server_config) │ │ 302 │ │ │ 303 │ @cached_property │ │ 304 │ def queue(self): │ │ │ │ /app/plextraktsync/config/SyncConfig.py:19 in init │ │ │ │ 16 │ def init(self, config: Config, server_config: PlexServerConfig): │ │ 17 │ │ self.config = dict(config["sync"]) │ │ 18 │ │ self.liked_lists = config["liked_lists"] │ │ ❱ 19 │ │ self.liked_lists_overrides = config["liked_list"] or {} │ │ 20 │ │ self.server_config = server_config.sync_config │ │ 21 │ │ │ 22 │ def getitem(self, key): │ │ │ │ /app/plextraktsync/config/Config.py:54 in getitem │ │ │ │ 51 │ def getitem(self, item): │ │ 52 │ │ if not self.initialized: │ │ 53 │ │ │ self.initialize() │ │ ❱ 54 │ │ return dict.getitem(self, item) │ │ 55 │ │ │ 56 │ def contains(self, item): │ │ 57 │ │ if not self.initialized: │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ KeyError: 'liked_list' Error: Error running sync command: 'liked_list' ERROR: 1 pi@raspberrypi2:~/ptsync $

sasagr commented 5 months ago

just saw that this error was solved a few hours ago with https://github.com/Taxel/PlexTraktSync/pull/1991

endless1651 commented 5 months ago

yes,0.31.1 has resolved this bug.