Move try-run logic back to sync script
MODIFY
plextraktsync/media.py
plextraktsync/media.py
@@ -151,22 +151,11 @@ def reset_show(self):
"""
self.plex_api.reset_show(show=self.plex.item.show(), reset_date=self.show_reset_at)
- def mark_watched_trakt(self, dry_run):
+ def mark_watched_trakt(self):
if self.is_movie:
- if not dry_run:
- logger.info(f"Marking as watched in Trakt: {self}")
self.trakt_api.mark_watched(self.trakt, self.plex.seen_date)
elif self.is_episode:
- if self.watched_before_reset:
- if not dry_run:
- logger.info(f"Show {self.plex.item.show().title} has been reset in trakt at {self.show_reset_at}.")
- logger.info(f"Marking {self.plex.item.show().title} as unwatched in Plex.")
- self.reset_show()
- elif not dry_run:
- logger.info(f"Marking as watched in Trakt: {self}")
- self.trakt_api.mark_watched(
- self.trakt, self.plex.seen_date, self.show_trakt_id
- )
+ self.trakt_api.mark_watched(self.trakt, self.plex.seen_date, self.show_trakt_id)
else:
raise RuntimeError(
f"mark_watched_trakt: Unsupported media type: {self.media_type}"

MODIFY
plextraktsync/sync.py
plextraktsync/sync.py
@@ -157,7 +157,17 @@ def sync_watched(self, m: Media, dry_run=False):
if m.watched_on_plex:
if not self.config.plex_to_trakt["watched_status"]:
return
- m.mark_watched_trakt(dry_run)
+
+ if m.is_episode and m.watched_before_reset:
+ show = m.plex.item.show()
+ logger.info(f"Show {show.title} has been reset in trakt at {m.show_reset_at}.")
+ logger.info(f"Marking {show.title} as unwatched in Plex.")
+ if not dry_run:
+ m.reset_show()
+ else:
+ logger.info(f"Marking as watched in Trakt: {m}")
+ if not dry_run:
+ m.mark_watched_trakt()
elif m.watched_on_trakt:
if not self.config.trakt_to_plex["watched_status"]:
return

Move try-run logic back to sync script