Skip to content

Commit

Permalink
update trakt watched_shows during scan
Browse files Browse the repository at this point in the history
  • Loading branch information
simonc56 committed Sep 11, 2021
1 parent b14ca36 commit 0ddefee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions plex_trakt_sync/pytrakt_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ def get_completed(self, trakt_id, season, episode):
return False
return self.shows[trakt_id].seasons[season].get_completed(episode)

def add(self, trakt_id, season, episode):
episode_prog = {"number":episode, "completed":True}
season_prog = {"number":season, "episodes":[episode_prog]}
if trakt_id in self.shows:
if season in self.shows[trakt_id].seasons:
self.shows[trakt_id].seasons[season].episodes[episode] = EpisodeProgress(episode_prog)
else:
self.shows[trakt_id].seasons[season] = SeasonProgress(season_prog)
else:
self.shows[trakt_id] = ShowProgress(seasons=[season_prog])


if __name__ == "__main__":
print(get_liked_lists())
5 changes: 4 additions & 1 deletion plex_trakt_sync/trakt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ def scrobbler(media: Union[Movie, TVEpisode]) -> ScrobblerProxy:
@time_limit()
def mark_watched(self, m, time):
m.mark_as_seen(time)
self.watched_movies.add(m.trakt)
if m.media_type == "movies":
self.watched_movies.add(m.trakt)
if m.media_type == "episodes":
self.watched_shows.add(m.trakt, m.season, m.number)

def add_to_collection(self, m, pm: PlexLibraryItem):
if m.media_type == "movies":
Expand Down

0 comments on commit 0ddefee

Please sign in to comment.