1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Fixes more issues that were still present for season pack searches and air-by-date shows.

This commit is contained in:
echel0n 2014-05-03 22:36:54 -07:00
parent 3ba3a74fd0
commit b349bab569
17 changed files with 44 additions and 35 deletions

View File

@ -194,30 +194,28 @@ class BTNProvider(generic.TorrentProvider):
search_params = []
name_exceptions = scene_exceptions.get_scene_exceptions(self.show.indexerid) + [self.show.name]
for name in name_exceptions:
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
for name in name_exceptions:
current_params = {}
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)
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
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
# 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'
whole_season_params['name'] = 'Season ' + str(ep_obj.scene_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)
# Search for episodes in the season
current_params = {}
current_params['name'] = self._get_episode_search_strings(ep_obj)[0]['name']
search_params.append(current_params)
return search_params
def _get_episode_search_strings(self, ep_obj, add_string=''):

View File

@ -83,7 +83,7 @@ class EZRSSProvider(generic.TorrentProvider):
else:
params['season'] = self._get_episode_search_strings(ep_obj)[0]['season']
params['episode'] = self._get_episode_search_strings(ep_obj)[0]['episode']
#params['episode'] = self._get_episode_search_strings(ep_obj)[0]['episode']
return [params]

View File

@ -247,7 +247,7 @@ class GenericProvider:
return (title, url)
def findSearchResults(self, show, season, episodes, manualSearch=False):
def findSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False):
self._checkAuth()
self.show = show
@ -268,6 +268,12 @@ class GenericProvider:
else:
logger.log(u'Searching "%s" for "%s" as "%s"' % (self.name, epObj.prettyName(), epObj.prettySceneName()))
# get our season pack search results
if seasonSearch:
for curString in self._get_episode_search_strings(epObj):
itemList += self._doSearch(curString)
# get our season/episode search results
for curString in self._get_episode_search_strings(epObj):
itemList += self._doSearch(curString)

View File

@ -121,7 +121,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -103,7 +103,7 @@ class IPTorrentsProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -178,7 +178,7 @@ class KATProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -103,7 +103,7 @@ class NewznabProvider(generic.NZBProvider):
if ep_obj.show.air_by_date or ep_obj.show.sports:
cur_params['season'] = self._get_episode_search_strings(ep_obj)[0]['season']
cur_params['episode'] = self._get_episode_search_strings(ep_obj)[0]['ep']
#cur_params['episode'] = self._get_episode_search_strings(ep_obj)[0]['ep']
to_return.append(cur_params)

View File

@ -142,7 +142,7 @@ class NextGenProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -85,7 +85,7 @@ class PublicHDProvider(generic.TorrentProvider):
else:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -109,7 +109,7 @@ class SCCProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -101,8 +101,7 @@ class SpeedCDProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
#Building the search string with the episodes we need
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -182,7 +182,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -122,7 +122,7 @@ class TorrentDayProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -104,7 +104,7 @@ class TorrentLeechProvider(generic.TorrentProvider):
elif ep_obj.show.air_by_date or ep_obj.show.sports:
search_string['Season'] = self._get_episode_search_strings(ep_obj)[0]['Season']
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
#search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
return [search_string]

View File

@ -363,7 +363,7 @@ def filterSearchResults(show, results):
return foundResults
def searchProviders(show, season, episodes, manualSearch=False):
def searchProviders(show, season, episodes, seasonSearch=False, manualSearch=False):
logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season))
foundResults = {}
@ -374,7 +374,7 @@ def searchProviders(show, season, episodes, manualSearch=False):
continue
try:
curResults = curProvider.findSearchResults(show, season, episodes, manualSearch)
curResults = curProvider.findSearchResults(show, season, episodes, seasonSearch, manualSearch)
except exceptions.AuthException, e:
logger.log(u"Authentication error: " + ex(e), logger.ERROR)
continue

View File

@ -186,6 +186,7 @@ class BacklogQueueItem(generic_queue.QueueItem):
self.show = show
self.segment = segment
self.wantedEpisodes = []
self.seasonSearch = False
logger.log(u"Seeing if we need any episodes from " + self.show.name + " season " + str(self.segment))
@ -212,11 +213,16 @@ class BacklogQueueItem(generic_queue.QueueItem):
anyQualities, bestQualities = common.Quality.splitQuality(self.show.quality) #@UnusedVariable
self.wantedEpisodes = self._need_any_episodes(statusResults, bestQualities)
# check if we want to search for season packs instead of just season/episode
seasonEps = show.getAllEpisodes(self.segment)
if len(seasonEps) == len(self.wantedEpisodes):
self.seasonSearch = True
def execute(self):
generic_queue.QueueItem.execute(self)
results = search.searchProviders(self.show, self.segment, self.wantedEpisodes)
results = search.searchProviders(self.show, self.segment, self.wantedEpisodes, seasonSearch=self.seasonSearch)
# download whatever we find
for curResult in results:

View File

@ -926,7 +926,7 @@ class ConfigGeneral:
sickbeard.ROOT_DIRS = rootDirString
@cherrypy.expose
def saveAddShowDefaults(self, defaultFlattenFolders, defaultStatus, anyQualities, bestQualities, subtitles=False):
def saveAddShowDefaults(self, defaultStatus, anyQualities, bestQualities, defaultFlattenFolders, subtitles=False):
if anyQualities:
anyQualities = anyQualities.split(',')