Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plextraktsync/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ def __init__(
self.trakt = trakt
self._show = None

@property
def title(self):
if self.plex:
return self.plex.title

return f"{self.trakt.title} ({self.trakt.year})"

@cached_property
def media_type(self):
return self.trakt.media_type
Expand Down
22 changes: 11 additions & 11 deletions plextraktsync/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def sync_collection(self, m: Media, dry_run=False):
if m.is_collected:
return

logger.info(f"Adding to collection: {m}")
logger.info(f"Adding to collection: '{m.title}'")
if not dry_run:
m.add_to_collection()

Expand All @@ -195,13 +195,13 @@ def sync_ratings(self, m: Media, dry_run=False):
if m.plex_rating is not None:
if not self.config.plex_to_trakt["ratings"]:
return
logger.info(f"Rating {m} with {m.plex_rating} on Trakt")
logger.info(f"Rating '{m.title}' with {m.plex_rating} on Trakt")
if not dry_run:
m.trakt_rate()
elif m.trakt_rating is not None:
if not self.config.trakt_to_plex["ratings"]:
return
logger.info(f"Rating {m} with {m.trakt_rating} on Plex")
logger.info(f"Rating '{m.title}' with {m.trakt_rating} on Plex")
if not dry_run:
m.plex_rate()

Expand All @@ -223,34 +223,34 @@ def sync_watched(self, m: Media, dry_run=False):
if not dry_run:
m.reset_show()
else:
logger.info(f"Marking as watched in Trakt: {m}")
logger.info(f"Marking as watched in Trakt: '{m.title}'")
if not dry_run:
m.mark_watched_trakt()
elif m.watched_on_trakt:
if not self.config.trakt_to_plex["watched_status"]:
return
logger.info(f"Marking as watched in Plex: {m}")
logger.info(f"Marking as watched in Plex: '{m.title}'")
if not dry_run:
m.mark_watched_plex()

def watchlist_sync_item(self, m: Media, dry_run=False):
if m.plex is None:
if self.config.update_plex_wl:
logger.info(f"Skipping '{m.trakt.title}' from Trakt watchlist because not found in Plex Discover")
logger.info(f"Skipping '{m.title}' from Trakt watchlist because not found in Plex Discover")
elif self.config.update_trakt_wl:
logger.info(f"Removing '{m.trakt.title}' from Trakt watchlist")
logger.info(f"Removing '{m.title}' from Trakt watchlist")
if not dry_run:
m.remove_from_trakt_watchlist()
return

if m in self.plex_wl:
if m not in self.trakt_wl:
if self.config.update_trakt_wl:
logger.info(f"Adding '{m.plex.item.title}' ({m.plex.item.year}) to Trakt watchlist")
logger.info(f"Adding '{m.title}' to Trakt watchlist")
if not dry_run:
m.add_to_trakt_watchlist()
else:
logger.info(f"Removing '{m.trakt.title}' ({m.plex.item.year}) from Plex watchlist")
logger.info(f"Removing '{m.title}' from Plex watchlist")
if not dry_run:
m.remove_from_plex_watchlist()
else:
Expand All @@ -262,11 +262,11 @@ def watchlist_sync_item(self, m: Media, dry_run=False):
del self.trakt_wl[m]
elif m in self.trakt_wl:
if self.config.update_plex_wl:
logger.info(f"Adding '{m.trakt.title}' to Plex watchlist")
logger.info(f"Adding '{m.title}' to Plex watchlist")
if not dry_run:
m.add_to_plex_watchlist()
else:
logger.info(f"Removing '{m.trakt.title}' from Trakt watchlist")
logger.info(f"Removing '{m.title}' from Trakt watchlist")
if not dry_run:
m.remove_from_trakt_watchlist()

Expand Down