diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index aacad9f5..08c64a70 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -373,7 +373,8 @@ class ParseResult(object): return to_return.encode('utf-8') 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 len(self.episode_numbers) == 0: return self # need at least one episode diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index d226d657..e1befe05 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -210,21 +210,13 @@ class BTNProvider(generic.TorrentProvider): # 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(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: # 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: - # Search for any result which has Sxx in the name - partial_season_params['name'] = 'S%02d' % int(ep_obj.scene_season) + whole_season_params['name'] = 'Season ' + str(ep_obj.scene_season) - search_params.append(partial_season_params) + search_params.append(whole_season_params) return search_params diff --git a/sickbeard/providers/dtt.py b/sickbeard/providers/dtt.py index 9fe91e55..b416ebb6 100644 --- a/sickbeard/providers/dtt.py +++ b/sickbeard/providers/dtt.py @@ -47,7 +47,7 @@ class DTTProvider(generic.TorrentProvider): return quality 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): return sanitizeSceneName(show_name).replace('.', '-').lower() diff --git a/sickbeard/providers/ezrss.py b/sickbeard/providers/ezrss.py index ccfcacb8..280e2abf 100644 --- a/sickbeard/providers/ezrss.py +++ b/sickbeard/providers/ezrss.py @@ -68,7 +68,7 @@ class EZRSSProvider(generic.TorrentProvider): logger.WARNING) return results - results = generic.TorrentProvider.getSearchResults(self, show, season, episodes, seasonSearch, manualSearch) + results = generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch) return results @@ -78,12 +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 + if ep_obj.show.air_by_date or ep_obj.show.sports: + params['season'] = str(ep_obj.airdate)[:7] else: - params['season'] = self._get_episode_search_strings(ep_obj)[0]['season'] - - #params['episode'] = self._get_episode_search_strings(ep_obj)[0]['episode'] + params['season'] = ep_obj.scene_season return [params] diff --git a/sickbeard/providers/hdbits.py b/sickbeard/providers/hdbits.py index e20f5317..7b51da8c 100644 --- a/sickbeard/providers/hdbits.py +++ b/sickbeard/providers/hdbits.py @@ -153,12 +153,18 @@ class HDBitsProvider(generic.TorrentProvider): 'episode': episode.scene_episode } - if season: - post_data['tvdb'] = { - 'id': show.indexerid, - 'season': season, - } - + if season: + if show.air_by_date or show.sports: + post_data['tvdb'] = { + 'id': show.indexerid, + 'season': str(episode.airdate)[:7], + } + else: + post_data['tvdb'] = { + 'id': show.indexerid, + 'season': season, + } + if search_term: post_data['search'] = search_term diff --git a/sickbeard/providers/hdtorrents.py b/sickbeard/providers/hdtorrents.py index 875604de..48a1cb6c 100644 --- a/sickbeard/providers/hdtorrents.py +++ b/sickbeard/providers/hdtorrents.py @@ -114,15 +114,14 @@ class HDTorrentsProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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['Season'].append(ep_string) - #search_string['Episode'] = self._get_episode_search_strings(ep_obj)[0]['Episode'] return [search_string] diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index 5721f466..253f0334 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -94,15 +94,13 @@ class IPTorrentsProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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] diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index 65346f49..10a13b85 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -170,17 +170,18 @@ class KATProvider(generic.TorrentProvider): 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 + 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) - 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) - 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] def _get_episode_search_strings(self, ep_obj, add_string=''): diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index f6e58333..c04c0709 100644 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -94,19 +94,13 @@ 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): + 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) 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 def _get_episode_search_strings(self, ep_obj, add_string=''): diff --git a/sickbeard/providers/nextgen.py b/sickbeard/providers/nextgen.py index 80a3cc7c..1f7230a0 100644 --- a/sickbeard/providers/nextgen.py +++ b/sickbeard/providers/nextgen.py @@ -134,15 +134,13 @@ class NextGenProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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] diff --git a/sickbeard/providers/nyaatorrents.py b/sickbeard/providers/nyaatorrents.py index 9828f151..3e0eccf0 100644 --- a/sickbeard/providers/nyaatorrents.py +++ b/sickbeard/providers/nyaatorrents.py @@ -50,18 +50,17 @@ class NyaaProvider(generic.TorrentProvider): return 'nyaatorrents.png' def getQuality(self, item, anime=False): - self.debug() title = item.title quality = Quality.sceneQuality(title) return quality 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 def _get_season_search_strings(self, ep_obj): names = [] - names.extend(show_name_helpers.makeSceneshowSearchStrings(self.show)) + names.extend(show_name_helpers.makeSceneShowSearchStrings(self.show)) return names def _get_episode_search_strings(self, ep_obj, add_string=''): diff --git a/sickbeard/providers/publichd.py b/sickbeard/providers/publichd.py index 98211685..1d4ab897 100644 --- a/sickbeard/providers/publichd.py +++ b/sickbeard/providers/publichd.py @@ -76,17 +76,18 @@ class PublicHDProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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 - 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['Season'].append(ep_string) return [search_string] diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index 5f907489..542294bd 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -103,14 +103,13 @@ class SCCProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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] diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py index 14a7eb4c..db3a790e 100644 --- a/sickbeard/providers/speedcd.py +++ b/sickbeard/providers/speedcd.py @@ -94,14 +94,13 @@ class SpeedCDProvider(generic.TorrentProvider): #If Every episode in Season is a wanted Episode then search for Season first 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 - 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] diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index 9bb0f6fb..98748bad 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -173,17 +173,19 @@ class ThePirateBayProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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 - 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] diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 35541458..f7ae83c1 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -121,14 +121,13 @@ class TorrentDayProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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] diff --git a/sickbeard/providers/torrentleech.py b/sickbeard/providers/torrentleech.py index 4ceaac39..f0af5ccf 100644 --- a/sickbeard/providers/torrentleech.py +++ b/sickbeard/providers/torrentleech.py @@ -98,14 +98,13 @@ class TorrentLeechProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): 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 - 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] diff --git a/sickbeard/show_name_helpers.py b/sickbeard/show_name_helpers.py index c7d2be51..18ea3337 100644 --- a/sickbeard/show_name_helpers.py +++ b/sickbeard/show_name_helpers.py @@ -119,7 +119,10 @@ def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None): [show.indexerid]) 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))