diff --git a/modules/Manager.py b/modules/Manager.py index fc4151e41..1d46eb14e 100755 --- a/modules/Manager.py +++ b/modules/Manager.py @@ -182,8 +182,8 @@ def create_shows(self) -> None: def assign_interfaces(self) -> None: """Assign all interfaces to each Show known to this Manager""" - for show in tqdm(self.shows + self.archives, - desc='Assigning interfaces', + # Assign interfaces for each show + for show in tqdm(self.shows + self.archives,desc='Assigning interfaces', **TQDM_KWARGS): show.assign_interfaces( self.emby_interface, @@ -198,8 +198,10 @@ def assign_interfaces(self) -> None: def set_show_ids(self) -> None: """Set the series ID's of each Show known to this Manager""" + # For each show in the Manager, set series IDs for show in tqdm(self.shows + self.archives, desc='Setting series IDs', **TQDM_KWARGS): + # Select interfaces based on what's enabled show.set_series_ids() @@ -211,6 +213,7 @@ def read_show_source(self) -> None: multipart episodes. """ + # Read source files for Show objects for show in (pbar := tqdm(self.shows + self.archives, **TQDM_KWARGS)): pbar.set_description(f'Reading source files for {show}') show.read_source() @@ -221,6 +224,8 @@ def read_show_source(self) -> None: def add_new_episodes(self) -> None: """Add any new episodes to this Manager's shows.""" + # For each show in the Manager, look for new episodes using any of the + # possible interfaces for show in (pbar := tqdm(self.shows + self.archives, **TQDM_KWARGS)): pbar.set_description(f'Adding new episodes for {show}') show.add_new_episodes() @@ -230,6 +235,7 @@ def add_new_episodes(self) -> None: def set_episode_ids(self) -> None: """Set all episode ID's for all shows.""" + # For each show in the Manager, set IDs for every episode for show in (pbar := tqdm(self.shows + self.archives, **TQDM_KWARGS)): pbar.set_description(f'Setting episode IDs for {show}') show.set_episode_ids() @@ -243,6 +249,7 @@ def add_translations(self) -> None: if not self.preferences.use_tmdb: return None + # For each show in the Manager, add translation for show in (pbar := tqdm(self.shows + self.archives, **TQDM_KWARGS)): pbar.set_description(f'Adding translations for {show}') show.add_translations() @@ -256,6 +263,7 @@ def download_logos(self) -> None: if not self.preferences.use_tmdb: return None + # For each show in the Manager, download a logo for show in (pbar := tqdm(self.shows + self.archives, **TQDM_KWARGS)): pbar.set_description(f'Downloading logo for {show}') show.download_logo() @@ -265,6 +273,7 @@ def download_logos(self) -> None: def select_source_images(self) -> None: """Select and download the source images for all shows.""" + # Go through each show and download source images for show in (pbar := tqdm(self.shows + self.archives, **TQDM_KWARGS)): pbar.set_description(f'Selecting sources for {show}') show.select_source_images() @@ -274,6 +283,7 @@ def select_source_images(self) -> None: def create_missing_title_cards(self) -> None: """Creates all missing title cards for all shows.""" + # Go through every show in the Manager, create cards for show in (pbar := tqdm(self.shows, **TQDM_KWARGS)): pbar.set_description(f'Creating cards for {show}') show.create_missing_title_cards() @@ -283,6 +293,7 @@ def create_missing_title_cards(self) -> None: def create_season_posters(self) -> None: """Create season posters for all shows.""" + # For each show in the Manager, create its posters for show in tqdm(self.shows + self.archives, desc='Creating season posters',**TQDM_KWARGS): show.create_season_posters() @@ -295,13 +306,13 @@ def update_media_server(self) -> None: if Emby/Jellyfin/Plex are globally enabled. """ - # If no media servers aren't enabled, skip + # If no media servers are enabled, skip if (not self.preferences.use_emby and not self.preferences.use_jellyfin and not self.preferences.use_plex): return None - # Go through each show in the Manager, update the server + # Go through each show in the Manager, update Plex for show in (pbar := tqdm(self.shows, **TQDM_KWARGS)): pbar.set_description(f'Updating Server for {show}') show.update_media_server() diff --git a/modules/PlexInterface.py b/modules/PlexInterface.py index d1131ec17..47b84530a 100755 --- a/modules/PlexInterface.py +++ b/modules/PlexInterface.py @@ -143,9 +143,9 @@ def __get_library(self, library_name: str) -> 'Library': def __get_series(self, library: 'Library', series_info: SeriesInfo) -> 'Show': """ - Get the Series object from within the given Library associated with the - given SeriesInfo. This tries to match by TVDb ID, TMDb ID, name, and - finally full name. + Get the Series object from within the given Library associated + with the given SeriesInfo. This tries to match by TVDb ID, + TMDb ID, name, and finally name. Args: library: The Library object to search for within Plex. @@ -176,33 +176,27 @@ def __get_series(self, library: 'Library', except NotFound: pass - # Try by full name + # Try by name try: - series = library.get(series_info.full_name) - if series.year == series_info.year: - return series - raise NotFound + for series in library.search(title=series_info.name, + year=series_info.year, libtype='show'): + if series.title in (series_info.name, series_info.full_name): + return series except NotFound: pass - # Try by name and match the year - try: - if (ser := library.get(series_info.name)).year == series_info.year: - return ser - raise NotFound - except NotFound: - key = f'{library.title}-{series_info.full_name}' - if key not in self.__warned: - log.warning(f'Series "{series_info}" was not found under ' - f'library "{library.title}" in Plex') - self.__warned.add(key) - - return None + # Not found, return None + key = f'{library.title}-{series_info.full_name}' + if key not in self.__warned: + log.warning(f'Series "{series_info}" was not found under ' + f'library "{library.title}" in Plex') + self.__warned.add(key) + return None @catch_and_log('Error getting library paths', default={}) - def get_library_paths(self,filter_libraries: list[str]=[] - ) -> dict[str, list[str]]: + def get_library_paths(self, + filter_libraries: list[str] = []) -> dict[str, list[str]]: """ Get all libraries and their associated base directories. @@ -382,8 +376,8 @@ def has_series(self, library_name: str, series_info: 'SeriesInfo') -> bool: Determine whether the given series is present within Plex. Args: - library_name: The name of the library potentially containing the - series. + library_name: The name of the library potentially containing + the series. series_info: The series to being evaluated. Returns: @@ -496,8 +490,10 @@ def set_series_ids(self, library_name: str, @catch_and_log("Error setting episode ID's") - def set_episode_ids(self, library_name: str, series_info: SeriesInfo, - infos: list[EpisodeInfo]) -> None: + def set_episode_ids(self, + library_name: str, + series_info: SeriesInfo, + infos: list[EpisodeInfo]) -> None: """ Set all the episode ID's for the given list of EpisodeInfo objects. This sets the Sonarr and TVDb ID's for each episode. As a byproduct, this diff --git a/modules/cards/AnimeTitleCard.py b/modules/cards/AnimeTitleCard.py index b102eb49f..7a1e3f7d3 100755 --- a/modules/cards/AnimeTitleCard.py +++ b/modules/cards/AnimeTitleCard.py @@ -10,8 +10,7 @@ class AnimeTitleCard(BaseCardType): """ This class describes a type of CardType that produces title cards in the anime-styled cards designed by reddit user /u/Recker_Man. These - cards don't support custom fonts, but does support optional kanji - text. + cards support custom fonts, and optional kanji text. """ """API Parameters"""