def get_season_search_strings(self, ep_obj): search_params = [] current_params = {"category": "Season"} # Search for entire seasons: no need to do special things for air by date or sports shows if ep_obj.show.air_by_date or ep_obj.show.sports: # Search for the year of the air by date show current_params["name"] = str(ep_obj.airdate).split("-")[0] else: # BTN uses the same format for both Anime and TV current_params["name"] = "Season " + str(ep_obj.scene_season) # search if ep_obj.show.indexer == 1: current_params["tvdb"] = ep_obj.show.indexerid search_params.append(current_params) else: name_exceptions = list( set( scene_exceptions.get_scene_exceptions( ep_obj.show.indexerid) + [ep_obj.show.name])) for name in name_exceptions: # Search by name if we don't have tvdb id current_params["series"] = sanitizeSceneName(name) search_params.append(current_params) return search_params
def get_episode_search_strings(self, ep_obj, add_string=""): if not ep_obj: return [{}] to_return = [] search_params = {"category": "Episode"} # episode if ep_obj.show.air_by_date or ep_obj.show.sports: date_str = str(ep_obj.airdate) # BTN uses dots in dates, we just search for the date since that # combined with the series identifier should result in just one episode search_params["name"] = date_str.replace("-", ".") else: # BTN uses the same format for both Anime and TV # Do a general name search for the episode, formatted like SXXEYY search_params["name"] = "{ep}".format( ep=episode_num(ep_obj.scene_season, ep_obj.scene_episode)) # search if ep_obj.show.indexer == 1: search_params["tvdb"] = ep_obj.show.indexerid to_return.append(search_params) else: # add new query string for every exception name_exceptions = list( set( scene_exceptions.get_scene_exceptions( ep_obj.show.indexerid) + [ep_obj.show.name])) for cur_exception in name_exceptions: search_params["series"] = sanitizeSceneName(cur_exception) to_return.append(search_params) return to_return