Skip to content

Commit

Permalink
Preload matches for shows
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Apr 30, 2024
1 parent 3126ce1 commit f52021d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plextraktsync/plan/Walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,19 @@ def find_episodes(self):

# Preload plex shows
plex_shows: dict[int, PlexLibraryItem] = {}

self.logger.info("Preload shows data")
for show in self.get_plex_shows():
plex_shows[show.key] = show
self.logger.info(f"Preloaded shows data ({len(plex_shows)} shows)")

# Preload matches for shows
show_cache: dict[int, Media] = {}
self.logger.info("Preload shows matches")
it = self.progressbar(plex_shows.items(), desc="Processing show matches")
for show_id, ps in it:
show_cache[show_id] = self.mf.resolve_any(ps)
self.logger.info(f"Preloaded shows matches ({len(show_cache)} shows)")

for ep in self.episodes_from_sections(self.plan.show_sections):
show_id = ep.show_id
ep.show = plex_shows[show_id]
Expand Down

0 comments on commit f52021d

Please sign in to comment.