Skip to content

Commit

Permalink
Move sync method from TraktUserListCollection to TraktListsPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Apr 30, 2024
1 parent c2d4442 commit bec58d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 7 additions & 2 deletions plextraktsync/sync/TraktListsPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ async def fini(self, dry_run: bool):
if dry_run:
return

with measure_time("Updated liked list"):
self.trakt_lists.sync()
with measure_time("Updated Trakt Lists"):
for tl in self.trakt_lists:
updated = tl.plex_list.update(tl.plex_items_sorted)
if not updated:
continue
self.logger.info(f"Plex list {tl.title_link} ({len(tl.plex_items)} items) updated",
extra={"markup": True})

@hookimpl
async def walk_movie(self, movie: Media):
Expand Down
7 changes: 0 additions & 7 deletions plextraktsync/trakt/TraktUserListCollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,3 @@ def add_list(self, list_id: int, list_name: str):
tl = TraktUserList.from_trakt_list(list_id, list_name)
self.append(tl)
return tl

def sync(self):
for tl in self:
updated = tl.plex_list.update(tl.plex_items_sorted)
if not updated:
continue
self.logger.info(f"Plex list {tl.title_link} ({len(tl.plex_items)} items) updated", extra={"markup": True})

0 comments on commit bec58d7

Please sign in to comment.