def _parse_series(result): new_episode_numbers = [] new_season_numbers = [] new_absolute_numbers = [] season = scene_exceptions.get_season_from_name(result.series, result.series_name) or result.season_number for episode_number in result.episode_numbers: episode = episode_number if result.series.is_scene: (season, episode) = scene_numbering.get_indexer_numbering( result.series, season, episode_number ) log.debug( 'Scene numbering enabled series {name} using indexer numbering: {ep}', {'name': result.series.name, 'ep': episode_num(season, episode)} ) new_episode_numbers.append(episode) new_season_numbers.append(season) return new_episode_numbers, new_season_numbers, new_absolute_numbers
def _parse_series(result): new_episode_numbers = [] new_season_numbers = [] new_absolute_numbers = [] ex_season = scene_exceptions.get_season_from_name(result.series, result.series_name) or result.season_number for episode_number in result.episode_numbers: season = ex_season episode = episode_number (idx_season, idx_episode) = scene_numbering.get_indexer_numbering( result.series, episode_number, ex_season ) if idx_season is not None: season = idx_season if idx_episode is not None: episode = idx_episode new_season_numbers.append(season) new_episode_numbers.append(episode) return new_episode_numbers, new_season_numbers, new_absolute_numbers
def _parse_series(result): new_episode_numbers = [] new_season_numbers = [] new_absolute_numbers = [] ex_season = scene_exceptions.get_season_from_name( result.series, result.series_name) or result.season_number if ex_season is None: ex_season = 1 log.info( "For the show {name} we could not parse a season number. We did match the title, so we'll asume season 1", {'name': result.series.name}) if result.episode_numbers: for episode_number in result.episode_numbers: season = ex_season episode = episode_number (idx_season, idx_episode) = scene_numbering.get_indexer_numbering( result.series, episode_number, ex_season) if idx_season is not None: season = idx_season if idx_episode is not None: episode = idx_episode new_season_numbers.append(season) new_episode_numbers.append(episode) else: # No episode numbers. Treat it like a season pack. new_season_numbers.append(ex_season) return new_episode_numbers, new_season_numbers, new_absolute_numbers
def is_season_exception(series_name): """Try to detect by series name, if this is a season exception.""" if not show: return return get_season_from_name(show, series_name)
def _parse_anime(result): """ Parse anime season episode results. Translate scene episode and season numbering to indexer numbering, using anime scen episode/season translation tables to indexer episode/season. :param result: Guessit parse result object. :return: tuple of found indexer episode numbers and indexer season numbers """ log.debug('Series {name} is anime', {'name': result.series.name}) new_episode_numbers = [] new_season_numbers = [] new_absolute_numbers = [] # Try to translate the scene series name to a scene number. # For example Jojo's bizarre Adventure - Diamond is unbreakable, will use xem, to translate the # "diamond is unbreakable" exception back to season 4 of it's "master" table. This will be used later # to translate it to an absolute number, which in turn can be translated to an indexer SxEx. # For example Diamond is unbreakable - 26 -> Season 4 -> Absolute number 100 -> tvdb S03E26 season_exception = None if result.season_number is None: season_exception = scene_exceptions.get_season_from_name(result.series, result.series_name) if result.ab_episode_numbers: for absolute_episode in result.ab_episode_numbers: a = absolute_episode # Don't assume that scene_exceptions season is the same as indexer season. # E.g.: [HorribleSubs] Cardcaptor Sakura Clear Card - 08 [720p].mkv thetvdb s04, thexem s02 if season_exception is not None or result.series.is_scene: # Get absolute number from custom numbering (1), XEM (2) or indexer (3) a = scene_numbering.get_indexer_absolute_numbering( result.series, a, fallback_to_xem=True, scene_season=season_exception ) new_absolute_numbers.append(a) # Translate the absolute episode number, back to the indexers season and episode. (season, episodes) = helpers.get_all_episodes_from_absolute_number(result.series, [a]) if season and episodes: new_episode_numbers.extend(episodes) new_season_numbers.append(season) if season_exception is not None: log.debug( 'Detected a season scene exception [{series_name} -> {scene_season}] without a ' 'season number in the title, ' 'translating the episode #{abs} to indexer #{indexer_absolute}: {ep}', {'series_name': result.series_name, 'scene_season': season_exception, 'abs': absolute_episode, 'indexer_absolute': a, 'ep': episode_num(season, episodes[0])} ) elif result.series.is_scene: log.debug( 'Scene numbering enabled anime series {name} using indexer numbering #{absolute}: {ep}', {'name': result.series.name, 'season': season, 'absolute': a, 'ep': episode_num(season, episodes[0])} ) else: log.debug( 'Anime series {name} using indexer numbering #{absolute}: {ep}', {'name': result.series.name, 'season': season, 'absolute': a, 'ep': episode_num(season, episodes[0])} ) # It's possible that we map a parsed result to an anime series, # but the result is not detected/parsed as an anime. In that case, we're using the result.episode_numbers. else: for episode_number in result.episode_numbers: season = result.season_number episode = episode_number if result.series.is_scene: (season, episode) = scene_numbering.get_indexer_numbering( result.series, result.season_number, episode_number ) log.debug( 'Scene numbering enabled anime {name} using indexer numbering: {ep}', {'name': result.series.name, 'ep': episode_num(season, episode)} ) a = helpers.get_absolute_number_from_season_and_episode(result.series, season, episode) if a: new_absolute_numbers.append(a) log.debug( 'Anime series {name} using using indexer numbering #{absolute}: {ep}', {'name': result.series.name, 'absolute': a, 'ep': episode_num(season, episode)} ) new_episode_numbers.append(episode) new_season_numbers.append(season) return new_episode_numbers, new_season_numbers, new_absolute_numbers