diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index a03dcb7f..c376486f 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -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 - whole_season_params['category'] = 'Season' - whole_season_params['name'] = 'Season ' + str(ep_obj.scene_season) - search_params.append(whole_season_params) + 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]) + # 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 diff --git a/sickbeard/providers/ezrss.py b/sickbeard/providers/ezrss.py index ae7991c3..f8d3cd62 100644 --- a/sickbeard/providers/ezrss.py +++ b/sickbeard/providers/ezrss.py @@ -78,7 +78,10 @@ class EZRSSProvider(generic.TorrentProvider): 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'] diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index dd521cc5..8056e0dd 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -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) diff --git a/sickbeard/providers/hdtorrents.py b/sickbeard/providers/hdtorrents.py index cd4ee5b0..06955e3f 100644 --- a/sickbeard/providers/hdtorrents.py +++ b/sickbeard/providers/hdtorrents.py @@ -113,9 +113,13 @@ class HDTorrentsProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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'] diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index 35b682d5..5f8f7f6d 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -95,9 +95,13 @@ class IPTorrentsProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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'] diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index edb04a0c..23227a0e 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -167,12 +167,16 @@ class KATProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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) - ep_string = show_name + ' Season ' + str(ep_obj.scene_season) + ' -Ep*' + ' category:tv' #2) showName Season X - search_string['Season'].append(ep_string) + 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'] diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 90c76276..239e9c9b 100644 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -94,13 +94,19 @@ class NewznabProvider(generic.NZBProvider): cur_params['q'] = helpers.sanitizeSceneName(cur_exception) # season - cur_params['season'] = str(ep_obj.scene_season) - - # episode - cur_params['episode'] = self._get_episode_search_strings(ep_obj)[0]['ep'] + if not (ep_obj.show.air_by_date or ep_obj.show.sports): + 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 805830f8..82c161be 100644 --- a/sickbeard/providers/nextgen.py +++ b/sickbeard/providers/nextgen.py @@ -134,9 +134,13 @@ class NextGenProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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'] diff --git a/sickbeard/providers/publichd.py b/sickbeard/providers/publichd.py index e877f5ff..81d69980 100644 --- a/sickbeard/providers/publichd.py +++ b/sickbeard/providers/publichd.py @@ -73,14 +73,17 @@ class PublicHDProvider(generic.TorrentProvider): return quality def _get_season_search_strings(self, ep_obj): - 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 - search_string['Season'].append(ep_string) + 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'] diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index e429ee13..44bbfe06 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -102,9 +102,12 @@ class SCCProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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'] diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py index 46c28bf6..5e6b00b5 100644 --- a/sickbeard/providers/speedcd.py +++ b/sickbeard/providers/speedcd.py @@ -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': []} - 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) + 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'] diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index fc8e145e..0660fea0 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -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)): - ep_string = show_name + ' S%02d' % int(ep_obj.scene_season) #1) showName SXX - search_string['Season'].append(ep_string) + 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) + 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'] diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 59c142a0..46c4cbec 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -115,9 +115,12 @@ class TorrentDayProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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'] diff --git a/sickbeard/providers/torrentleech.py b/sickbeard/providers/torrentleech.py index 41277cab..8948942a 100644 --- a/sickbeard/providers/torrentleech.py +++ b/sickbeard/providers/torrentleech.py @@ -97,9 +97,12 @@ class TorrentLeechProvider(generic.TorrentProvider): def _get_season_search_strings(self, ep_obj): search_string = {'Season': [], 'Episode': []} - 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) + 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'] diff --git a/sickbeard/show_name_helpers.py b/sickbeard/show_name_helpers.py index c16db05c..ccb20073 100644 --- a/sickbeard/show_name_helpers.py +++ b/sickbeard/show_name_helpers.py @@ -108,16 +108,11 @@ def makeSceneShowSearchStrings(show): def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None): myDB = db.DBConnection() - if show.air_by_date: - numseasons = 0 - - # the search string for air by date shows is just - seasonStrings = [ep_obj.scene_season] - elif show.sports: + 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] + 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))] diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 90c6f760..c8a08637 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -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.