Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR 'NoneType' object has no attribute 'strftime'

cleight opened this issue · comments

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if identical issue already exists
  • I have tried downgrading to find version that can be used as a workaround

The problem

Everytime I run the sync the application bombs out on processing TV Shows

Steps to reproduce the behavior

Run the initial Sync, It will error with the following type of message:

ERROR 'NoneType' object has no attribute 'strftime'

Error trace / logs

ERROR    'NoneType' object has no attribute 'strftime'                                                                                                                                                                                          
         ╭───────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────────────────────────╮
         │ /root/.local/share/pipx/venvs/plextraktsync/lib/python3.9/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(f"Program requested terminal, No terminal is                                                                                                                                             │
         │       connected: {e}")                                                                                                                                                                                                              │
         │    29 │   │   │   except ClickException as e:                                                                                                                                                                                       │
         │                                                                                                                                                                                                                                     │
         │ /root/.local/share/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/commands/sync.py:70 in sync                                                                                                                   │
         │                                                                                                                                                                                                                                     │
         │   67 │   │   │   w.print_plan(print=logger.info)                                                                                                                                                                                    │
         │   68 │   │   if dry_run:                                                                                                                                                                                                            │
         │   69 │   │   │   logger.info("Enabled dry-run mode: not making actual changes")                                                                                                                                                     │
         │ ❱ 70 │   │   runner.sync(walker=w, dry_run=config.dry_run)                                                                                                                                                                          │
         │   71                                                                                                                                                                                                                                │
         │                                                                                                                                                                                                                                     │
         │ /root/.local/share/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/sync/Sync.py:82 in sync                                                                                                                       │
         │                                                                                                                                                                                                                                     │
         │    79 │   │   │   episode_trakt_ids = set()                                                                                                                                                                                         │
         │    80 │   │   │   for episode in walker.find_episodes():                                                                                                                                                                            │
         │    81 │   │   │   │   self.sync_collection(episode, dry_run=dry_run)                                                                                                                                                                │
         │ ❱  82 │   │   │   │   self.sync_ratings(episode, dry_run=dry_run)                                                                                                                                                                   │
         │    83 │   │   │   │   self.sync_watched(episode, dry_run=dry_run)                                                                                                                                                                   │
         │    84 │   │   │   │   if not is_partial:                                                                                                                                                                                            │
         │    85 │   │   │   │   │   trakt_lists.add_to_lists(episode)                                                                                                                                                                         │
         │                                                                                                                                                                                                                                     │
         │ /root/.local/share/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/sync/Sync.py:159 in sync_ratings                                                                                                              │
         │                                                                                                                                                                                                                                     │
         │   156 │   │   │   │   rate = "plex"                                                                                                                                                                                                 │
         │   157 │   │                                                                                                                                                                                                                         │
         │   158 │   │   if rate == "trakt":                                                                                                                                                                                                   │
         │ ❱ 159 │   │   │   self.logger.info(f"Rating {m.title_link} with {m.plex_rating} on Trakt (was                                                                                                                                       │
         │       {m.trakt_rating})", extra={"markup": True})                                                                                                                                                                                   │
         │   160 │   │   │   if not dry_run:                                                                                                                                                                                                   │
         │   161 │   │   │   │   m.trakt_rate()                                                                                                                                                                                                │
         │   162                                                                                                                                                                                                                               │
         │                                                                                                                                                                                                                                     │
         │ /root/.local/share/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/util/Rating.py:24 in __str__                                                                                                                  │
         │                                                                                                                                                                                                                                     │
         │   21 │   │   return self.rating == other.rating                                                                                                                                                                                     │
         │   22 │                                                                                                                                                                                                                              │
         │   23 │   def __str__(self):                                                                                                                                                                                                         │
         │ ❱ 24 │   │   return f"Rating(rating={self.rating}, rated_at='{timestamp(self.rated_at)}')"                                                                                                                                          │
         │   25 │                                                                                                                                                                                                                              │
         │   26 │   @classmethod                                                                                                                                                                                                               │
         │   27 │   def create(cls, rating: int | float | None, rated_at: datetime | str | None):                                                                                                                                              │
         │                                                                                                                                                                                                                                     │
         │ /root/.local/share/pipx/venvs/plextraktsync/lib/python3.9/site-packages/trakt/utils.py:50 in timestamp                                                                                                                              │
         │                                                                                                                                                                                                                                     │
         │   47 def timestamp(date_object):                                                                                                                                                                                                    │
         │   48 │   """Generate a trakt formatted timestamp from the given date object"""                                                                                                                                                      │
         │   49 │   fmt = '%Y-%m-%dT%H:%M:%S.000Z'                                                                                                                                                                                             │
         │ ❱ 50 │   return date_object.strftime(fmt)                                                                                                                                                                                           │
         │   51                                                                                                                                                                                                                                │
         │   52                                                                                                                                                                                                                                │
         │   53 def extract_ids(id_dict):                                                                                                                                                                                                      │
         ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
         AttributeError: 'NoneType' object has no attribute 'strftime'                                                                                                                                                                          
Error: Error running sync command: 'NoneType' object has no attribute 'strftime'

Expected behavior

to finish the sync successully

Inspect of problematic items

No response

Workarounds

No response

Config file contents

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

Install method

pipx

Version

0.29.4

Python Version

3.9.2

Plex Server Version

1.40.1.8173-3e92df2db

Operating System and Version

Linux-6.5.11-7-pve-x86_64-with-glibc2.31

Workarounds

No response

disable sync options from config.

[x] I have tried downgrading to find version that can be used as a workaround

to what version did you downgrade then?