本文整理汇总了Python中sickbeard.scene_exceptions.get_scene_exceptions函数的典型用法代码示例。如果您正苦于以下问题:Python get_scene_exceptions函数的具体用法?Python get_scene_exceptions怎么用?Python get_scene_exceptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_scene_exceptions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_season_search_strings
def _get_season_search_strings(self, show, season, wantedEp, searchSeason=False):
if not show:
return [{}]
to_return = []
# add new query strings for exceptions
name_exceptions = scene_exceptions.get_scene_exceptions(show.indexerid) + [show.name]
for cur_exception in name_exceptions:
cur_params = {}
# search
cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
# air-by-date means &season=2010&q=2010.03, no other way to do it atm
if show.air_by_date:
cur_params['season'] = season.split('-')[0]
if 'q' in cur_params:
cur_params['q'] += '.' + season.replace('-', '.')
else:
cur_params['q'] = season.replace('-', '.')
else:
cur_params['season'] = str(season)
to_return.append(cur_params)
return to_return
示例2: allPossibleShowNames
def allPossibleShowNames(show):
"""
Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
country codes on the end, eg. "Show Name (AU)", and any scene exception names.
show: a TVShow object that we should get the names of
Returns: a list of all the possible show names
"""
showNames = [show.name]
showNames += [name for name in get_scene_exceptions(show.indexerid)]
newShowNames = []
country_list = countryList
country_list.update(dict(zip(countryList.values(), countryList.keys())))
# if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
# any countries defined in common.countryList
# (and vice versa)
for curName in set(showNames):
if not curName:
continue
for curCountry in country_list:
if curName.endswith(' ' + curCountry):
newShowNames.append(curName.replace(' ' + curCountry, ' (' + country_list[curCountry] + ')'))
elif curName.endswith(' (' + curCountry + ')'):
newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))
showNames += newShowNames
return showNames
示例3: buildNameCache
def buildNameCache(show=None):
"""Build internal name cache
:param show: Specify show to build name cache for, if None, just do all shows
"""
with nameCacheLock:
scene_exceptions.retrieve_exceptions()
if not show:
logging.info("Building internal name cache for all shows")
for show in sickbeard.showList:
buildNameCache(show)
else:
logging.debug("Building internal name cache for [{}]".format(show.name))
clearCache(show.indexerid)
for curSeason in [-1] + scene_exceptions.get_scene_seasons(show.indexerid):
for name in list(set(scene_exceptions.get_scene_exceptions(show.indexerid, season=curSeason) + [
show.name])):
name = sickbeard.helpers.full_sanitizeSceneName(name)
if name in nameCache:
continue
nameCache[name] = int(show.indexerid)
logging.debug("Internal name cache for {} set to: [{}]".format(show.name,
[key for key, value in nameCache.items() if
value == show.indexerid]))
示例4: _get_season_search_strings
def _get_season_search_strings(self, ep_obj):
to_return = []
params = {}
if not ep_obj:
return to_return
params['maxage'] = (datetime.datetime.now() - datetime.datetime.combine(ep_obj.airdate, datetime.datetime.min.time())).days + 1
params['tvdbid'] = ep_obj.show.indexerid
# season
if ep_obj.show.air_by_date or ep_obj.show.sports:
date_str = str(ep_obj.airdate).split('-')[0]
params['season'] = date_str
params['q'] = date_str.replace('-', '.')
else:
params['season'] = str(ep_obj.scene_season)
save_q = ' ' + params['q'] if 'q' in params else ''
# add new query strings for exceptions
name_exceptions = list(
set([ep_obj.show.name] + scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid)))
for cur_exception in name_exceptions:
params['q'] = helpers.sanitizeSceneName(cur_exception) + save_q
to_return.append(dict(params))
return to_return
示例5: _get_season_search_strings
def _get_season_search_strings(self, ep_obj):
to_return = []
cur_params = {}
# season
if ep_obj.show.air_by_date or ep_obj.show.sports:
date_str = str(ep_obj.airdate).split("-")[0]
cur_params["season"] = date_str
cur_params["q"] = date_str.replace("-", ".")
elif ep_obj.show.is_anime:
cur_params["season"] = "%d" % ep_obj.scene_absolute_number
else:
cur_params["season"] = str(ep_obj.scene_season)
# search
rid = helpers.mapIndexersToShow(ep_obj.show)[2]
if rid:
cur_params["rid"] = rid
to_return.append(cur_params)
else:
# add new query strings for exceptions
name_exceptions = list(
set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name])
)
for cur_exception in name_exceptions:
if "q" in cur_params:
cur_params["q"] = helpers.sanitizeSceneName(cur_exception) + "." + cur_params["q"]
to_return.append(cur_params)
return to_return
示例6: _get_season_search_strings
def _get_season_search_strings(self, ep_obj):
search_params = []
name_exceptions = scene_exceptions.get_scene_exceptions(self.show.indexerid) + [self.show.name]
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
for name in name_exceptions:
current_params = {}
if self.show.indexer == 1:
current_params["tvdb"] = self.show.indexerid
elif self.show.indexer == 2:
current_params["tvrage"] = self.show.indexerid
else:
# Search by name if we don't have tvdb or tvrage id
current_params["series"] = sanitizeSceneName(name)
# Search for entire seasons: no need to do special things for air by date shows
whole_season_params = current_params.copy()
whole_season_params["category"] = "Season"
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
whole_season_params["name"] = "Season " + str(ep_obj.scene_season)
elif ep_obj.show.air_by_date or ep_obj.show.sports:
whole_season_params["name"] = self._get_episode_search_strings(ep_obj)[0]["name"]
search_params.append(whole_season_params)
return search_params
示例7: _get_episode_search_strings
def _get_episode_search_strings(self, ep_obj, add_string=''):
to_return = []
params = {}
if not ep_obj:
return [params]
if ep_obj.show.air_by_date or ep_obj.show.sports:
date_str = str(ep_obj.airdate)
params['season'] = date_str.partition('-')[0]
params['ep'] = date_str.partition('-')[2].replace('-', '/')
elif ep_obj.show.anime:
params['ep'] = "%i" % int(ep_obj.scene_absolute_number)
else:
params['season'] = ep_obj.scene_season
params['ep'] = ep_obj.scene_episode
# search
rid = helpers.mapIndexersToShow(ep_obj.show)[2]
if rid:
cur_return = params.copy()
cur_return['rid'] = rid
to_return.append(cur_return)
# add new query strings for exceptions
name_exceptions = list(
set(scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]))
for cur_exception in name_exceptions:
params['q'] = helpers.sanitizeSceneName(cur_exception)
to_return.append(params)
return to_return
示例8: _get_season_search_strings
def _get_season_search_strings(self, show, season, episode):
if not show:
return []
search_params = []
name_exceptions = scene_exceptions.get_scene_exceptions(show.indexerid) + [show.name]
for name in name_exceptions:
current_params = {}
if show.indexer == 1:
current_params["tvdb"] = show.indexerid
elif show.indexer == 2:
current_params["tvrage"] = show.indexerid
else:
# Search by name if we don't have tvdb or tvrage id
current_params["series"] = sanitizeSceneName(name)
whole_season_params = current_params.copy()
partial_season_params = current_params.copy()
# Search for entire seasons: no need to do special things for air by date shows
whole_season_params["category"] = "Season"
whole_season_params["name"] = "Season " + str(season)
search_params.append(whole_season_params)
# Search for episodes in the season
search_params.append(self._get_episode_search_strings(show, season, episode)[0])
return search_params
示例9: _get_episode_search_strings
def _get_episode_search_strings(self, ep_obj,french=None):
params = {}
global lang
if not ep_obj:
return [params]
params['show_name'] = helpers.sanitizeSceneName(ep_obj.show.name).replace('.',' ').encode('utf-8')
if ep_obj.show.air_by_date:
params['date'] = str(ep_obj.airdate)
else:
params['season'] = ep_obj.season
params['episode'] = ep_obj.episode
to_return = [params]
# add new query strings for exceptions
name_exceptions = scene_exceptions.get_scene_exceptions(ep_obj.show.tvdbid)
for name_exception in name_exceptions:
# don't add duplicates
if name_exception != ep_obj.show.name:
# only change show name
cur_return = params.copy()
cur_return['show_name'] = helpers.sanitizeSceneName(name_exception)
to_return.append(cur_return)
logger.log(u"KAT _get_episode_search_strings for %s is returning %s" % (repr(ep_obj), repr(params)), logger.DEBUG)
if french:
lang='fr'
else:
lang = ep_obj.show.audio_lang
return to_return
示例10: _get_season_search_strings
def _get_season_search_strings(self, ep_obj):
search_params = []
name_exceptions = scene_exceptions.get_scene_exceptions(self.show.indexerid) + [self.show.name]
for name in name_exceptions:
current_params = {}
if self.show.indexer == 1:
current_params['tvdb'] = self.show.indexerid
elif self.show.indexer == 2:
current_params['tvrage'] = self.show.indexerid
else:
# Search by name if we don't have tvdb or tvrage id
current_params['series'] = sanitizeSceneName(name)
# Search for entire seasons: no need to do special things for air by date shows
whole_season_params = current_params.copy()
partial_season_params = current_params.copy()
# Search for entire seasons: no need to do special things for air by date shows
whole_season_params['category'] = 'Season'
if ep_obj.show.air_by_date or ep_obj.show.sports:
# Search for the year of the air by date show
whole_season_params['name'] = str(ep_obj.airdate)[:7]
else:
whole_season_params['name'] = 'Season ' + str(ep_obj.scene_season)
search_params.append(whole_season_params)
return search_params
示例11: _get_season_search_strings
def _get_season_search_strings(self, ep_obj):
"""
Makes objects to pass to _doSearch for manual and backlog season pack searching
Returns a list containing dicts of search parameters
"""
to_return = []
params = {}
if not ep_obj:
return to_return
params['maxage'] = (datetime.datetime.now() - datetime.datetime.combine(ep_obj.airdate, datetime.datetime.min.time())).days + 1
params['tvdbid'] = ep_obj.show.indexerid
if ep_obj.show.air_by_date or ep_obj.show.sports:
date_str = str(ep_obj.airdate).split('-')[0]
params['season'] = date_str
params['q'] = date_str.replace('-', '.')
else:
params['season'] = str(ep_obj.scene_season)
save_q = ' ' + params['q'] if 'q' in params else ''
name_exceptions = list(set([ep_obj.show.name] + scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid)))
for cur_exception in name_exceptions:
params['q'] = helpers.sanitizeSceneName(cur_exception) + save_q
to_return.append(dict(params))
return to_return
示例12: _get_episode_search_strings
def _get_episode_search_strings(self, ep_obj, add_string=''):
"""
Makes objects to pass to search for manual and backlog season pack searching
Returns a list containing dicts of search parameters
"""
to_return = []
params = {}
if not ep_obj:
return to_return
params['maxage'] = (datetime.datetime.now() - datetime.datetime.combine(ep_obj.airdate, datetime.datetime.min.time())).days + 1
params['tvdbid'] = ep_obj.show.indexerid
if ep_obj.show.air_by_date or ep_obj.show.sports:
date_str = str(ep_obj.airdate)
params['season'] = date_str.partition('-')[0]
params['ep'] = date_str.partition('-')[2].replace('-', '/')
else:
params['season'] = ep_obj.scene_season
params['ep'] = ep_obj.scene_episode
name_exceptions = list(set([ep_obj.show.name] + scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid)))
for cur_exception in name_exceptions:
params['q'] = helpers.sanitizeSceneName(cur_exception)
if add_string:
params['q'] += ' ' + add_string
to_return.append(dict(params))
return to_return
示例13: _get_season_search_strings
def _get_season_search_strings(self, ep_obj):
to_return = []
# add new query strings for exceptions
name_exceptions = scene_exceptions.get_scene_exceptions(self.show.indexerid) + [self.show.name]
for cur_exception in name_exceptions:
cur_params = {}
# search
if ep_obj.show.indexer == 2:
cur_params['rid'] = ep_obj.show.indexerid
else:
cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
# season
if ep_obj.show.air_by_date or ep_obj.show.sports:
date_str = str(ep_obj.airdate).split('-')[0]
cur_params['season'] = date_str
if 'q' in cur_params:
cur_params['q'] += '.' + date_str.replace('-', '.')
else:
cur_params['q'] = date_str.replace('-', '.')
else:
cur_params['season'] = str(ep_obj.scene_season)
if not ('rid' in cur_params and to_return):
to_return.append(cur_params)
return to_return
示例14: _get_episode_search_strings
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("-", ".")
elif ep_obj.show.anime:
search_params["name"] = "%i" % int(ep_obj.scene_absolute_number)
else:
# Do a general name search for the episode, formatted like SXXEYY
search_params["name"] = "S%02dE%02d" % (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
示例15: _get_season_search_strings
def _get_season_search_strings(self, show, season, episode, abd=False):
if not show:
return [{}]
to_return = []
# add new query strings for exceptions
name_exceptions = scene_exceptions.get_scene_exceptions(show.indexerid) + [show.name]
for cur_exception in name_exceptions:
cur_params = {}
# search
cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
# season
cur_params['season'] = str(season)
# episode
cur_params['episode'] = self._get_episode_search_strings(show, season, episode, abd)[0]['ep']
to_return.append(cur_params)
return to_return