Пример #1
0
    def _create_anime_search_string(self,
                                    show_scene_name,
                                    episode,
                                    search_string,
                                    add_string=None):
        """Create a search string used for as anime 'marked' shows."""
        episode_string = show_scene_name + self.search_separator

        # If the show name is a season scene exception, we want to use the indexer episode number.
        if (episode.scene_season > 1 and show_scene_name
                in scene_exceptions.get_season_scene_exceptions(
                    episode.series, episode.scene_season)):
            # This is apparently a season exception, let's use the scene_episode instead of absolute
            ep = episode.scene_episode
        else:
            ep = episode.scene_absolute_number

        episode_string += '{episode:0>2}'.format(episode=ep)
        episode_string_fallback = episode_string + '{episode:0>3}'.format(
            episode=ep)

        if add_string:
            episode_string += self.search_separator + add_string
            episode_string_fallback += self.search_separator + add_string

        search_string['Episode'].append(episode_string.strip())
Пример #2
0
    def _create_anime_search_string(self,
                                    show_scene_name,
                                    episode,
                                    search_string,
                                    add_string=None):
        """Create a search string used for as anime 'marked' shows."""
        episode_string = show_scene_name + self.search_separator

        # If the show name is a season scene exception, we want to use the episode number
        if episode.scene_season is not None and show_scene_name in [
                exception.title
                for exception in scene_exceptions.get_season_scene_exceptions(
                    episode.series, episode.scene_season)
        ]:
            # This is apparently a season exception, let's use the episode instead of absolute
            ep = episode.scene_episode
        else:
            if episode.series.is_scene and episode.scene_absolute_number:
                ep = episode.scene_absolute_number
            else:
                ep = episode.absolute_number

        episode_string += '{episode:0>2}'.format(episode=ep)

        if add_string:
            episode_string += self.search_separator + add_string

        search_string['Episode'].append(episode_string.strip())
Пример #3
0
    def _get_episode_search_strings(self, episode, add_string=''):
        """Get episode search strings."""
        if not episode:
            return []

        search_string = {'Episode': []}

        all_possible_show_names = episode.series.get_all_possible_names()
        if episode.scene_season:
            all_possible_show_names = all_possible_show_names.union(
                episode.series.get_all_possible_names(
                    season=episode.scene_season))

        for show_name in all_possible_show_names:
            episode_string = show_name + self.search_separator
            episode_string_fallback = None

            if episode.series.air_by_date:
                episode_string += str(episode.airdate).replace('-', ' ')
            elif episode.series.sports:
                episode_string += str(episode.airdate).replace('-', ' ')
                episode_string += ('|', ' ')[len(self.proper_strings) > 1]
                episode_string += episode.airdate.strftime('%b')
            elif episode.series.anime:
                # If the showname is a season scene exception, we want to use the indexer episode number.
                if (episode.scene_season > 1
                        and show_name in get_season_scene_exceptions(
                            episode.series, episode.scene_season)):
                    # This is apparently a season exception, let's use the scene_episode instead of absolute
                    ep = episode.scene_episode
                else:
                    ep = episode.scene_absolute_number
                episode_string_fallback = episode_string + '{episode:0>3}'.format(
                    episode=ep)
                episode_string += '{episode:0>2}'.format(episode=ep)
            else:
                episode_string += config.naming_ep_type[2] % {
                    'seasonnumber': episode.scene_season,
                    'episodenumber': episode.scene_episode,
                }

            if add_string:
                episode_string += self.search_separator + add_string
                if episode_string_fallback:
                    episode_string_fallback += self.search_separator + add_string

            search_string['Episode'].append(episode_string.strip())
            if episode_string_fallback:
                search_string['Episode'].append(
                    episode_string_fallback.strip())

        return [search_string]
Пример #4
0
    def _create_anime_search_string(self, title, season):
        """Create a search string used for as anime 'marked' shows."""
        episode_string = '%SN' + self.search_separator

        # If the show name is a season scene exception, we want to use the episode number
        if title in [
                scene_exception.title
                for scene_exception in get_season_scene_exceptions(
                    self.show_obj, season)
        ]:
            # This is apparently a season exception, let's use the episode instead of absolute
            ep = '%0XE'
        else:
            ep = '%XAB' if self.show_obj.is_scene else '%AB'

        episode_string += ep

        return episode_string.strip()
Пример #5
0
    def _create_anime_search_string(self, show_scene_name, episode, search_string, add_string=None):
        """Create a search string used for as anime 'marked' shows."""
        episode_string = show_scene_name + self.search_separator

        # If the show name is a season scene exception, we want to use the indexer episode number.
        if (episode.scene_season > 1 and
                show_scene_name in scene_exceptions.get_season_scene_exceptions(episode.series, episode.scene_season)):
            # This is apparently a season exception, let's use the scene_episode instead of absolute
            ep = episode.scene_episode
        else:
            ep = episode.scene_absolute_number

        episode_string += '{episode:0>2}'.format(episode=ep)
        episode_string_fallback = episode_string + '{episode:0>3}'.format(episode=ep)

        if add_string:
            episode_string += self.search_separator + add_string
            episode_string_fallback += self.search_separator + add_string

        search_string['Episode'].append(episode_string.strip())