Skip to content

Commit

Permalink
Cleanup now uneeded add_to_lists, trakt_lists.is_empty checks
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Apr 28, 2024
1 parent c748da2 commit b9fa05a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions plextraktsync/sync/TraktListsPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class TraktListsPlugin:

def __init__(self):
self.trakt_lists = None
self.add_to_lists = None

@staticmethod
def enabled(config):
Expand All @@ -33,28 +32,23 @@ def factory(cls, sync):
@hookimpl(trylast=True)
def init(self, pm: SyncPluginManager, trakt_lists: TraktUserListCollection):
self.trakt_lists = trakt_lists
self.add_to_lists = not trakt_lists.is_empty
# Skip updating lists if it's empty
if trakt_lists.is_empty:
self.logger.warning("Disabling TraktListsPlugin: No lists to process")
pm.unregister(self)

@hookimpl
def fini(self, dry_run: bool):
if dry_run or self.trakt_lists.is_empty:
if dry_run:
return

with measure_time("Updated liked list"):
self.trakt_lists.sync()

@hookimpl
def walk_movie(self, movie: Media):
if not self.add_to_lists:
return
self.trakt_lists.add_to_lists(movie)

@hookimpl
def walk_episode(self, episode: Media):
if not self.add_to_lists:
return
self.trakt_lists.add_to_lists(episode)

0 comments on commit b9fa05a

Please sign in to comment.