mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Fixed alot of issues pertaining to season pack searches and backlog searches in regards to returning accurate results or no results at all.
Fixed issue #335
This commit is contained in:
parent
b4627af3d2
commit
dea826c3ba
16 changed files with 115 additions and 61 deletions
|
@ -206,15 +206,17 @@ class BTNProvider(generic.TorrentProvider):
|
|||
# Search by name if we don't have tvdb or tvrage id
|
||||
current_params['series'] = sanitizeSceneName(name)
|
||||
|
||||
whole_season_params = current_params.copy()
|
||||
|
||||
# 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):
|
||||
whole_season_params = current_params.copy()
|
||||
whole_season_params['category'] = 'Season'
|
||||
whole_season_params['name'] = 'Season ' + str(ep_obj.scene_season)
|
||||
search_params.append(whole_season_params)
|
||||
|
||||
# Search for episodes in the season
|
||||
search_params.append(self._get_episode_search_strings(ep_obj)[0])
|
||||
current_params = {}
|
||||
current_params['name'] = self._get_episode_search_strings(ep_obj)[0]['name']
|
||||
search_params.append(current_params)
|
||||
|
||||
return search_params
|
||||
|
||||
|
|
|
@ -78,7 +78,10 @@ class EZRSSProvider(generic.TorrentProvider):
|
|||
|
||||
params['show_name'] = helpers.sanitizeSceneName(self.show.name, ezrss=True).replace('.', ' ').encode('utf-8')
|
||||
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
params['season'] = ep_obj.scene_season
|
||||
else:
|
||||
params['season'] = self._get_episode_search_strings(ep_obj)[0]['season']
|
||||
|
||||
params['episode'] = self._get_episode_search_strings(ep_obj)[0]['episode']
|
||||
|
||||
|
|
|
@ -263,7 +263,11 @@ class GenericProvider:
|
|||
if len(cacheResult):
|
||||
return cacheResult
|
||||
|
||||
logger.log(u'Searching "%s" for "%s" as "%s"' % (self.name, epObj.prettyName(), epObj.scene_prettyName()))
|
||||
if epObj.show.air_by_date:
|
||||
logger.log(u'Searching "%s" for "%s"' % (self.name, epObj.prettyABDName()))
|
||||
else:
|
||||
logger.log(u'Searching "%s" for "%s" as "%s"' % (self.name, epObj.prettyName(), epObj.prettySceneName()))
|
||||
|
||||
for curString in self._get_episode_search_strings(epObj):
|
||||
itemList += self._doSearch(curString)
|
||||
|
||||
|
|
|
@ -113,10 +113,14 @@ class HDTorrentsProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
|
||||
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']
|
||||
|
||||
return [search_string]
|
||||
|
|
|
@ -95,10 +95,14 @@ class IPTorrentsProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
|
||||
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']
|
||||
|
||||
return [search_string]
|
||||
|
|
|
@ -167,6 +167,7 @@ class KATProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) + ' -S%02d' % int(ep_obj.scene_season) + 'E' + ' category:tv' #1) showName SXX -SXXE
|
||||
search_string['Season'].append(ep_string)
|
||||
|
@ -174,6 +175,9 @@ class KATProvider(generic.TorrentProvider):
|
|||
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' + ' category:tv' #2) showName Season X
|
||||
search_string['Season'].append(ep_string)
|
||||
|
||||
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']
|
||||
|
||||
return [search_string]
|
||||
|
|
|
@ -94,9 +94,15 @@ class NewznabProvider(generic.NZBProvider):
|
|||
cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
|
||||
|
||||
# season
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
cur_params['season'] = str(ep_obj.scene_season)
|
||||
|
||||
# episode
|
||||
to_return.append(cur_params)
|
||||
|
||||
cur_params = {}
|
||||
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']
|
||||
|
||||
to_return.append(cur_params)
|
||||
|
|
|
@ -134,10 +134,14 @@ class NextGenProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
|
||||
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']
|
||||
|
||||
return [search_string]
|
||||
|
|
|
@ -73,14 +73,17 @@ class PublicHDProvider(generic.TorrentProvider):
|
|||
return quality
|
||||
|
||||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX -SXXE
|
||||
search_string['Season'].append(ep_string)
|
||||
|
||||
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) #2) showName Season X
|
||||
search_string['Season'].append(ep_string)
|
||||
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']
|
||||
|
||||
|
|
|
@ -102,9 +102,12 @@ class SCCProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
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']
|
||||
|
||||
|
|
|
@ -94,9 +94,12 @@ class SpeedCDProvider(generic.TorrentProvider):
|
|||
|
||||
#If Every episode in Season is a wanted Episode then search for Season first
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name +' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
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']
|
||||
|
|
|
@ -172,12 +172,15 @@ class ThePirateBayProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(allPossibleShowNames(self.show)) if not (ep_obj.show.air_by_date or ep_obj.show.sports) else []:
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
|
||||
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' #2) showName Season X
|
||||
search_string['Season'].append(ep_string)
|
||||
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']
|
||||
|
||||
|
|
|
@ -115,9 +115,12 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
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']
|
||||
|
||||
|
|
|
@ -97,9 +97,12 @@ class TorrentLeechProvider(generic.TorrentProvider):
|
|||
def _get_season_search_strings(self, ep_obj):
|
||||
|
||||
search_string = {'Season': [], 'Episode': []}
|
||||
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
||||
search_string['Season'].append(ep_string)
|
||||
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']
|
||||
|
||||
|
|
|
@ -108,16 +108,11 @@ def makeSceneShowSearchStrings(show):
|
|||
def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None):
|
||||
myDB = db.DBConnection()
|
||||
|
||||
if show.air_by_date:
|
||||
if show.air_by_date or show.sports:
|
||||
numseasons = 0
|
||||
|
||||
# the search string for air by date shows is just
|
||||
seasonStrings = [ep_obj.scene_season]
|
||||
elif show.sports:
|
||||
numseasons = 0
|
||||
|
||||
# the search string for air by date shows is just
|
||||
seasonStrings = [ep_obj.scene_season]
|
||||
seasonStrings = []
|
||||
else:
|
||||
numseasonsSQlResult = myDB.select(
|
||||
"SELECT COUNT(DISTINCT season) as numseasons FROM tv_episodes WHERE showid = ? and season != 0",
|
||||
|
@ -162,8 +157,8 @@ def makeSceneSearchString(show, ep_obj):
|
|||
# see if we should use dates instead of episodes
|
||||
if show.air_by_date and ep_obj.airdate != datetime.date.fromordinal(1):
|
||||
epStrings = [str(ep_obj.airdate)]
|
||||
elif show.sports and ep_obj.airdate != datetime.date.fromordinal(1):
|
||||
epStrings = [str(ep_obj.scene_episode)]
|
||||
elif show.sports:
|
||||
epStrings = [str(ep_obj.airdate)]
|
||||
else:
|
||||
epStrings = ["S%02iE%02i" % (int(ep_obj.scene_season), int(ep_obj.scene_episode)),
|
||||
"%ix%02i" % (int(ep_obj.scene_season), int(ep_obj.scene_episode))]
|
||||
|
|
|
@ -301,7 +301,7 @@ class TVShow(object):
|
|||
|
||||
|
||||
# find all media files in the show folder and create episodes for as many as possible
|
||||
def loadEpisodesFromDir(self, sceneConvert=False):
|
||||
def loadEpisodesFromDir(self):
|
||||
|
||||
if not ek.ek(os.path.isdir, self._location):
|
||||
logger.log(str(self.indexerid) + u": Show dir doesn't exist, not loading episodes from disk")
|
||||
|
@ -1771,7 +1771,17 @@ class TVEpisode(object):
|
|||
|
||||
return self._format_pattern('%SN - %Sx%0E - %EN')
|
||||
|
||||
def scene_prettyName(self):
|
||||
def prettyABDName(self):
|
||||
"""
|
||||
Returns the name of this episode in a "pretty" human-readable format. Used for logging
|
||||
and notifications and such.
|
||||
|
||||
Returns: A string representing the episode's name and season/ep numbers
|
||||
"""
|
||||
|
||||
return self._format_pattern('%SN - %AD - %EN')
|
||||
|
||||
def prettySceneName(self):
|
||||
"""
|
||||
Returns the name of this episode in a "pretty" human-readable format. Used for logging
|
||||
and notifications and such.
|
||||
|
|
Loading…
Reference in a new issue