Skip to content

Commit

Permalink
fixup! fixup! fixup! Implement sync_progress method
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Apr 7, 2024
1 parent 8e48388 commit d8b8e30
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plextraktsync/sync/Sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,17 @@ def sync_progress(self, m: Media, dry_run=False):
if not self.config.sync_playback_status:
return

for p in self.trakt.watch_progress:
print(p)
m = self.plex.find_by_guid(p)
p = self.trakt.watch_progress.match(m)
if not p:
return
progress = m.plex.progress_millis(p.progress)
if progress == 0.0:
self.logger.warning("Skip progress, setting to 0 will not work")
return

self.logger.info(f"{m}: Set watch progress to {p.progress:02F}%: {m.plex.item.viewOffset}ms -> {progress}ms")
if not dry_run:
m.plex.item.updateProgress(progress)

def clear_collected(self, existing_items: Iterable[TraktMedia], keep_ids: set[int], dry_run=False):
from plextraktsync.trakt.trakt_set import trakt_set
Expand Down

0 comments on commit d8b8e30

Please sign in to comment.