mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 01:43: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
|
# Search by name if we don't have tvdb or tvrage id
|
||||||
current_params['series'] = sanitizeSceneName(name)
|
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
|
# Search for entire seasons: no need to do special things for air by date shows
|
||||||
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)
|
whole_season_params = current_params.copy()
|
||||||
search_params.append(whole_season_params)
|
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 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
|
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')
|
params['show_name'] = helpers.sanitizeSceneName(self.show.name, ezrss=True).replace('.', ' ').encode('utf-8')
|
||||||
|
|
||||||
params['season'] = ep_obj.scene_season
|
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']
|
params['episode'] = self._get_episode_search_strings(ep_obj)[0]['episode']
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,11 @@ class GenericProvider:
|
||||||
if len(cacheResult):
|
if len(cacheResult):
|
||||||
return 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):
|
for curString in self._get_episode_search_strings(epObj):
|
||||||
itemList += self._doSearch(curString)
|
itemList += self._doSearch(curString)
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,13 @@ class HDTorrentsProvider(generic.TorrentProvider):
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,13 @@ class IPTorrentsProvider(generic.TorrentProvider):
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
|
||||||
|
|
||||||
|
|
|
@ -167,12 +167,16 @@ class KATProvider(generic.TorrentProvider):
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
search_string = {'Season': [], 'Episode': []}
|
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):
|
||||||
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
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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)
|
||||||
|
|
||||||
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' + ' category:tv' #2) showName Season X
|
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' + ' category:tv' #2) showName Season X
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
|
||||||
|
|
||||||
|
|
|
@ -94,13 +94,19 @@ class NewznabProvider(generic.NZBProvider):
|
||||||
cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
|
cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
|
||||||
|
|
||||||
# season
|
# season
|
||||||
cur_params['season'] = str(ep_obj.scene_season)
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
|
cur_params['season'] = str(ep_obj.scene_season)
|
||||||
# episode
|
|
||||||
cur_params['episode'] = self._get_episode_search_strings(ep_obj)[0]['ep']
|
|
||||||
|
|
||||||
to_return.append(cur_params)
|
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)
|
||||||
|
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
def _get_episode_search_strings(self, ep_obj, add_string=''):
|
def _get_episode_search_strings(self, ep_obj, add_string=''):
|
||||||
|
|
|
@ -134,9 +134,13 @@ class NextGenProvider(generic.TorrentProvider):
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode']
|
||||||
|
|
||||||
|
|
|
@ -73,14 +73,17 @@ class PublicHDProvider(generic.TorrentProvider):
|
||||||
return quality
|
return quality
|
||||||
|
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
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
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
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):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
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
|
#If Every episode in Season is a wanted Episode then search for Season first
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name +' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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
|
#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']
|
||||||
|
|
|
@ -172,12 +172,15 @@ class ThePirateBayProvider(generic.TorrentProvider):
|
||||||
def _get_season_search_strings(self, ep_obj):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
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):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(allPossibleShowNames(self.show)) if not (ep_obj.show.air_by_date or ep_obj.show.sports) else []:
|
||||||
search_string['Season'].append(ep_string)
|
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
|
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' #2) showName Season X
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
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):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
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):
|
def _get_season_search_strings(self, ep_obj):
|
||||||
|
|
||||||
search_string = {'Season': [], 'Episode': []}
|
search_string = {'Season': [], 'Episode': []}
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
if not (ep_obj.show.air_by_date or ep_obj.show.sports):
|
||||||
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
search_string['Season'].append(ep_string)
|
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']
|
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):
|
def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None):
|
||||||
myDB = db.DBConnection()
|
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
|
numseasons = 0
|
||||||
|
|
||||||
# the search string for air by date shows is just
|
# the search string for air by date shows is just
|
||||||
seasonStrings = [ep_obj.scene_season]
|
seasonStrings = []
|
||||||
else:
|
else:
|
||||||
numseasonsSQlResult = myDB.select(
|
numseasonsSQlResult = myDB.select(
|
||||||
"SELECT COUNT(DISTINCT season) as numseasons FROM tv_episodes WHERE showid = ? and season != 0",
|
"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
|
# see if we should use dates instead of episodes
|
||||||
if show.air_by_date and ep_obj.airdate != datetime.date.fromordinal(1):
|
if show.air_by_date and ep_obj.airdate != datetime.date.fromordinal(1):
|
||||||
epStrings = [str(ep_obj.airdate)]
|
epStrings = [str(ep_obj.airdate)]
|
||||||
elif show.sports and ep_obj.airdate != datetime.date.fromordinal(1):
|
elif show.sports:
|
||||||
epStrings = [str(ep_obj.scene_episode)]
|
epStrings = [str(ep_obj.airdate)]
|
||||||
else:
|
else:
|
||||||
epStrings = ["S%02iE%02i" % (int(ep_obj.scene_season), int(ep_obj.scene_episode)),
|
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))]
|
"%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
|
# 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):
|
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")
|
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')
|
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
|
Returns the name of this episode in a "pretty" human-readable format. Used for logging
|
||||||
and notifications and such.
|
and notifications and such.
|
||||||
|
|
Loading…
Reference in a new issue