Fix for air-by-date and sports shows when searching for full seasons.

Fix for rssupdater errors
This commit is contained in:
echel0n 2014-05-14 01:01:36 -07:00
parent 51ff041389
commit 415e0df536
18 changed files with 92 additions and 104 deletions

View file

@ -373,7 +373,8 @@ class ParseResult(object):
return to_return.encode('utf-8') return to_return.encode('utf-8')
def convert(self): def convert(self):
if self.air_by_date: return self # scene numbering does not apply to air-by-date if not self.series_name: return self # can't work without a series name
if self.air_by_date or self.sports: return self # scene numbering does not apply to air-by-date
if self.season_number == None: return self # can't work without a season if self.season_number == None: return self # can't work without a season
if len(self.episode_numbers) == 0: return self # need at least one episode if len(self.episode_numbers) == 0: return self # need at least one episode

View file

@ -210,21 +210,13 @@ class BTNProvider(generic.TorrentProvider):
# 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' 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
partial_season_params['category'] = 'Episode'
if ep_obj.show.air_by_date or ep_obj.show.sports: if ep_obj.show.air_by_date or ep_obj.show.sports:
# Search for the year of the air by date show # Search for the year of the air by date show
partial_season_params['name'] = str(ep_obj.airdate).split('-')[0] whole_season_params['name'] = str(ep_obj.airdate)[:7]
else: else:
# Search for any result which has Sxx in the name whole_season_params['name'] = 'Season ' + str(ep_obj.scene_season)
partial_season_params['name'] = 'S%02d' % int(ep_obj.scene_season)
search_params.append(partial_season_params) search_params.append(whole_season_params)
return search_params return search_params

View file

@ -47,7 +47,7 @@ class DTTProvider(generic.TorrentProvider):
return quality return quality
def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False): def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False):
return generic.TorrentProvider.getSearchResults(self, show, season, episodes, seasonSearch, manualSearch) return generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch)
def _dtt_show_id(self, show_name): def _dtt_show_id(self, show_name):
return sanitizeSceneName(show_name).replace('.', '-').lower() return sanitizeSceneName(show_name).replace('.', '-').lower()

View file

@ -68,7 +68,7 @@ class EZRSSProvider(generic.TorrentProvider):
logger.WARNING) logger.WARNING)
return results return results
results = generic.TorrentProvider.getSearchResults(self, show, season, episodes, seasonSearch, manualSearch) results = generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch)
return results return results
@ -78,12 +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')
if not (ep_obj.show.air_by_date or ep_obj.show.sports): if ep_obj.show.air_by_date or ep_obj.show.sports:
params['season'] = ep_obj.scene_season params['season'] = str(ep_obj.airdate)[:7]
else: else:
params['season'] = self._get_episode_search_strings(ep_obj)[0]['season'] params['season'] = ep_obj.scene_season
#params['episode'] = self._get_episode_search_strings(ep_obj)[0]['episode']
return [params] return [params]

View file

@ -153,12 +153,18 @@ class HDBitsProvider(generic.TorrentProvider):
'episode': episode.scene_episode 'episode': episode.scene_episode
} }
if season: if season:
post_data['tvdb'] = { if show.air_by_date or show.sports:
'id': show.indexerid, post_data['tvdb'] = {
'season': season, 'id': show.indexerid,
} 'season': str(episode.airdate)[:7],
}
else:
post_data['tvdb'] = {
'id': show.indexerid,
'season': season,
}
if search_term: if search_term:
post_data['search'] = search_term post_data['search'] = search_term

View file

@ -114,15 +114,14 @@ class HDTorrentsProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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'].append(ep_string)
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] return [search_string]

View file

@ -94,15 +94,13 @@ class IPTorrentsProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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'].append(ep_string)
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] return [search_string]

View file

@ -170,17 +170,18 @@ class KATProvider(generic.TorrentProvider):
if not (ep_obj.show.air_by_date or ep_obj.show.sports): if not (ep_obj.show.air_by_date or ep_obj.show.sports):
for show_name in set(allPossibleShowNames(self.show)): 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 if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7] + ' category:tv' #2) showName Season X
else:
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) search_string['Season'].append(ep_string)
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' + ' category:tv' #2) showName Season X if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + ' Season ' + str(ep_obj.airdate)[:7] + ' category:tv' #2) showName Season X
else:
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']
return [search_string] return [search_string]
def _get_episode_search_strings(self, ep_obj, add_string=''): def _get_episode_search_strings(self, ep_obj, add_string=''):

View file

@ -94,19 +94,13 @@ class NewznabProvider(generic.NZBProvider):
cur_params['q'] = helpers.sanitizeSceneName(cur_exception) cur_params['q'] = helpers.sanitizeSceneName(cur_exception)
# season # season
if not (ep_obj.show.air_by_date or ep_obj.show.sports): if ep_obj.show.air_by_date or ep_obj.show.sports:
cur_params['season'] = str(ep_obj.airdate)[:7]
else:
cur_params['season'] = str(ep_obj.scene_season) cur_params['season'] = str(ep_obj.scene_season)
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=''):

View file

@ -134,15 +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': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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'].append(ep_string)
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] return [search_string]

View file

@ -50,18 +50,17 @@ class NyaaProvider(generic.TorrentProvider):
return 'nyaatorrents.png' return 'nyaatorrents.png'
def getQuality(self, item, anime=False): def getQuality(self, item, anime=False):
self.debug()
title = item.title title = item.title
quality = Quality.sceneQuality(title) quality = Quality.sceneQuality(title)
return quality return quality
def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False): def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False):
results = generic.TorrentProvider.getSearchResults(self, show, season, episodes, seasonSearch, manualSearch) results = generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch)
return results return results
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
names = [] names = []
names.extend(show_name_helpers.makeSceneshowSearchStrings(self.show)) names.extend(show_name_helpers.makeSceneShowSearchStrings(self.show))
return names return names
def _get_episode_search_strings(self, ep_obj, add_string=''): def _get_episode_search_strings(self, ep_obj, add_string=''):

View file

@ -76,17 +76,18 @@ class PublicHDProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(allPossibleShowNames(self.show)):
for show_name in set(allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX -SXXE ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX -SXXE
search_string['Season'].append(ep_string) search_string['Season'].append(ep_string)
if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + ' Season ' + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' Season ' + str(ep_obj.scene_season) #2) showName Season X ep_string = show_name + ' Season ' + str(ep_obj.scene_season) #2) showName Season X
search_string['Season'].append(ep_string) 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']
return [search_string] return [search_string]

View file

@ -103,14 +103,13 @@ class SCCProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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['Season'].append(ep_string)
return [search_string] return [search_string]

View file

@ -94,14 +94,13 @@ 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': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name +' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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['Season'].append(ep_string)
return [search_string] return [search_string]

View file

@ -173,17 +173,19 @@ class ThePirateBayProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
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 []:
for show_name in set(allPossibleShowNames(self.show)) if not (ep_obj.show.air_by_date or ep_obj.show.sports) else []: if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX
search_string['Season'].append(ep_string) search_string['Season'].append(ep_string)
if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + ' Season ' + str(ep_obj.airdate)[:7]
else:
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)
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['Season'].append(ep_string)
return [search_string] return [search_string]

View file

@ -121,14 +121,13 @@ class TorrentDayProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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['Season'].append(ep_string)
return [search_string] return [search_string]

View file

@ -98,14 +98,13 @@ class TorrentLeechProvider(generic.TorrentProvider):
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
search_string = {'Season': []} search_string = {'Season': []}
if not (ep_obj.show.air_by_date or ep_obj.show.sports): for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)): if ep_obj.show.air_by_date or ep_obj.show.sports:
ep_string = show_name + str(ep_obj.airdate)[:7]
else:
ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX 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['Season'].append(ep_string)
return [search_string] return [search_string]

View file

@ -119,7 +119,10 @@ def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None):
[show.indexerid]) [show.indexerid])
numseasons = int(numseasonsSQlResult[0][0]) numseasons = int(numseasonsSQlResult[0][0])
seasonStrings = ["S%02d" % int(ep_obj.scene_season)] if show.air_by_date or show.sports:
seasonStrings = [str(ep_obj.airdate)[:7]]
else:
seasonStrings = ["S%02d" % int(ep_obj.scene_season)]
showNames = set(makeSceneShowSearchStrings(show)) showNames = set(makeSceneShowSearchStrings(show))