def get_episode_search_strings(self, episode, add_string=""): if not episode: return [] search_string = {"Episode": []} for show_name in allPossibleShowNames(episode.show, season=episode.scene_season): episode_string = show_name + " " episode_string_fallback = None if episode.show.air_by_date: episode_string += str(episode.airdate).replace("-", " ") elif episode.show.sports: episode_string += str(episode.airdate).replace("-", " ") episode_string += ("|", " ")[len(self.proper_strings) > 1] episode_string += episode.airdate.strftime("%b") elif episode.show.anime: episode_string_fallback = episode_string + "{0:02d}".format(int(episode.scene_absolute_number)) episode_string += "{0:03d}".format(int(episode.scene_absolute_number)) else: episode_string += sickchill.oldbeard.config.naming_ep_type[2] % { "seasonnumber": episode.scene_season, "episodenumber": episode.scene_episode, } if add_string: episode_string += " " + add_string if episode_string_fallback: episode_string_fallback += " " + add_string search_string["Episode"].append(episode_string.strip()) if episode_string_fallback: search_string["Episode"].append(episode_string_fallback.strip()) return [search_string]
def _test_all_possible_show_names(self, name, indexerid=0, expected=None): """ Test all possible show names :param name: :param indexerid: :param expected: :return: """ expected = expected or [] show = Show(1, indexerid) show.name = name result = show_name_helpers.allPossibleShowNames(show) assert len(set(expected).intersection(set(result))) == len(expected)
def get_season_search_strings(self, episode): search_string = {"Season": []} for show_name in allPossibleShowNames(episode.show, season=episode.scene_season): season_string = show_name + " " if episode.show.air_by_date or episode.show.sports: season_string += str(episode.airdate).split("-")[0] elif episode.show.anime: # use string below if you really want to search on season with number # season_string += 'Season ' + '{0:d}'.format(int(episode.scene_season)) season_string += "Season" # ignore season number to get all seasons in all formats else: season_string += "S{0:02d}".format(int(episode.scene_season)) search_string["Season"].append(season_string.strip()) return [search_string]
def get_episode_search_strings(self, episode, add_string=''): if not episode: return [] search_string = {'Episode': []} for show_name in allPossibleShowNames(episode.show, season=episode.scene_season): episode_string = show_name + ' ' episode_string_fallback = None if episode.show.air_by_date: episode_string += str(episode.airdate).replace('-', ' ') elif episode.show.sports: episode_string += str(episode.airdate).replace('-', ' ') episode_string += ('|', ' ')[len(self.proper_strings) > 1] episode_string += episode.airdate.strftime('%b') elif episode.show.anime: episode_string_fallback = episode_string + '{0:02d}'.format( int(episode.scene_absolute_number)) episode_string += '{0:03d}'.format( int(episode.scene_absolute_number)) else: episode_string += sickchill.oldbeard.config.naming_ep_type[ 2] % { 'seasonnumber': episode.scene_season, 'episodenumber': episode.scene_episode, } if add_string: episode_string += ' ' + add_string if episode_string_fallback: episode_string_fallback += ' ' + add_string search_string['Episode'].append(episode_string.strip()) if episode_string_fallback: search_string['Episode'].append( episode_string_fallback.strip()) return [search_string]
def get_season_search_strings(self, episode): search_string = {'Season': []} for show_name in allPossibleShowNames(episode.show, season=episode.scene_season): season_string = show_name + ' ' if episode.show.air_by_date or episode.show.sports: season_string += str(episode.airdate).split('-')[0] elif episode.show.anime: # use string below if you really want to search on season with number # season_string += 'Season ' + '{0:d}'.format(int(episode.scene_season)) season_string += 'Season' # ignore season number to get all seasons in all formats else: season_string += 'S{0:02d}'.format(int(episode.scene_season)) # MTV renames most season packs to just "Season ##" mtv_season_string = '{0} Season {1}'.format( show_name, int(episode.scene_season)) search_string['Season'].append(mtv_season_string.strip()) search_string['Season'].append(season_string) return [search_string]