diff --git a/sickbeard/providers/bitsoup.py b/sickbeard/providers/bitsoup.py index eb27452d..d66facd0 100644 --- a/sickbeard/providers/bitsoup.py +++ b/sickbeard/providers/bitsoup.py @@ -147,7 +147,7 @@ class BitSoupProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} @@ -281,7 +281,7 @@ class BitSoupProvider(generic.TorrentProvider): for item in self._doSearch(searchString[0]): title, url = self._get_title_and_url(item) - results.append(classes.Proper(title, url, datetime.datetime.today())) + results.append(classes.Proper(title, url, datetime.datetime.today(), self.show)) return results @@ -322,7 +322,7 @@ class BitSoupCache(tvcache.TVCache): if ci is not None: cl.append(ci) - if cl: + if len(cl) > 0: myDB = self._getDB() myDB.mass_action(cl) diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index 085ec603..22af0f01 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -74,7 +74,7 @@ class BTNProvider(generic.TorrentProvider): return True - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): self._checkAuth() diff --git a/sickbeard/providers/dtt.py b/sickbeard/providers/dtt.py index 4188ca76..5224f78a 100644 --- a/sickbeard/providers/dtt.py +++ b/sickbeard/providers/dtt.py @@ -69,7 +69,7 @@ class DTTProvider(generic.TorrentProvider): def _get_episode_search_strings(self, ep_obj, add_string=''): return self._get_season_search_strings(ep_obj) - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): # show_id = self._dtt_show_id(self.show.name) diff --git a/sickbeard/providers/ezrss.py b/sickbeard/providers/ezrss.py index 316f83e0..76f7c362 100644 --- a/sickbeard/providers/ezrss.py +++ b/sickbeard/providers/ezrss.py @@ -113,7 +113,7 @@ class EZRSSProvider(generic.TorrentProvider): return [params] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): params = {"mode": "rss"} diff --git a/sickbeard/providers/fanzub.py b/sickbeard/providers/fanzub.py index 36251d3a..e3c4a365 100644 --- a/sickbeard/providers/fanzub.py +++ b/sickbeard/providers/fanzub.py @@ -60,7 +60,7 @@ class Fanzub(generic.NZBProvider): def _get_episode_search_strings(self, ep_obj, add_string=''): return [x for x in show_name_helpers.makeSceneSearchString(self.show, ep_obj)] - def _doSearch(self, search_string, epcount=0, age=0): + def _doSearch(self, search_string, search_mode='eponly', epcount=0, age=0): if self.show and not self.show.is_anime: logger.log(u"" + str(self.show.name) + " is not an anime skiping ...") return [] diff --git a/sickbeard/providers/freshontv.py b/sickbeard/providers/freshontv.py index de740e2b..b52b8f92 100755 --- a/sickbeard/providers/freshontv.py +++ b/sickbeard/providers/freshontv.py @@ -167,7 +167,7 @@ class FreshOnTVProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} @@ -312,7 +312,7 @@ class FreshOnTVProvider(generic.TorrentProvider): for item in self._doSearch(searchString[0]): title, url = self._get_title_and_url(item) - results.append(classes.Proper(title, url, datetime.datetime.today())) + results.append(classes.Proper(title, url, datetime.datetime.today(), self.show)) return results @@ -353,9 +353,7 @@ class FreshOnTVCache(tvcache.TVCache): if ci is not None: cl.append(ci) - - - if cl: + if len(cl) > 0: myDB = self._getDB() myDB.mass_action(cl) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 66f9c952..f93e2bea 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -201,7 +201,7 @@ class GenericProvider: quality = Quality.sceneQuality(title, anime) return quality - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): return [] def _get_season_search_strings(self, episode): @@ -240,8 +240,6 @@ class GenericProvider: searched_scene_season = None for epObj in episodes: - items = [] - # check cache for results cacheResult = self.cache.searchCache([epObj], manualSearch) if len(cacheResult): @@ -258,15 +256,11 @@ class GenericProvider: if len(episodes) > 1: # get season search results for curString in self._get_season_search_strings(epObj): - items += self._doSearch(curString, len(episodes)) + itemList += self._doSearch(curString, search_mode, len(episodes)) else: # get single episode search results for curString in self._get_episode_search_strings(epObj): - items += self._doSearch(curString, len(episodes)) - - # add items to list - if len(items): - itemList += items + itemList += self._doSearch(curString, 'eponly', len(episodes)) # if we found what we needed already from cache then return results and exit if len(results) == len(episodes): @@ -278,7 +272,7 @@ class GenericProvider: # parse the file name try: - myParser = NameParser(False, showObj=self.show, convert=True) + myParser = NameParser(False, showObj=show, convert=True) parse_result = myParser.parse(title) except InvalidNameException: logger.log(u"Unable to parse the filename " + title + " into a valid episode", logger.DEBUG) @@ -290,7 +284,6 @@ class GenericProvider: showObj = parse_result.show quality = parse_result.quality release_group = parse_result.release_group - ep_obj = showObj.getEpisode(season, parse_result.episode_numbers[0]) if not (showObj.air_by_date or showObj.sports): if search_mode == 'sponly' and len(parse_result.episode_numbers): @@ -300,19 +293,17 @@ class GenericProvider: continue if not len(parse_result.episode_numbers) and ( - parse_result.season_number != None and parse_result.season_number != ep_obj.season) or ( - parse_result.season_number == None and ep_obj.season != 1): - logger.log(u"The result " + title + " doesn't seem to be a valid season for season " + str( - ep_obj.season) + ", ignoring", logger.DEBUG) + parse_result.season_number != None and parse_result.season_number != season) or ( + parse_result.season_number == None and season != 1): + logger.log(u"The result " + title + " doesn't seem to be a valid season for season " + str(season) + ", ignoring", logger.DEBUG) continue elif len(parse_result.episode_numbers) and ( - parse_result.season_number != ep_obj.season or ep_obj.episode not in parse_result.episode_numbers): - logger.log(u"Episode " + title + " isn't " + str(ep_obj.season) + "x" + str( - ep_obj.episode) + ", skipping it", logger.DEBUG) + parse_result.season_number != season or parse_result.episode_numbers[0] not in episodes): + logger.log(u"Episode " + title + " isn't " + str(season) + "x" + str(parse_result.episode_numbers[0]) + ", skipping it", logger.DEBUG) continue # we just use the existing info for normal searches - actual_season = ep_obj.season + actual_season = season actual_episodes = parse_result.episode_numbers else: if not (parse_result.is_air_by_date or parse_result.is_sports): @@ -321,12 +312,6 @@ class GenericProvider: logger.DEBUG) continue - if (parse_result.is_air_by_date and parse_result.air_date != ep_obj.airdate) or ( - parse_result.is_sports and parse_result.is_sports_air_date != ep_obj.airdate): - logger.log("Episode " + title + " didn't air on " + str(ep_obj.airdate) + ", skipping it", - logger.DEBUG) - continue - airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.is_sports_air_date.toordinal() myDB = db.DBConnection() sql_results = myDB.select( diff --git a/sickbeard/providers/hdbits.py b/sickbeard/providers/hdbits.py index 24883767..f715e698 100644 --- a/sickbeard/providers/hdbits.py +++ b/sickbeard/providers/hdbits.py @@ -98,7 +98,7 @@ class HDBitsProvider(generic.TorrentProvider): return (title, url) - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] self._checkAuth() diff --git a/sickbeard/providers/hdtorrents.py b/sickbeard/providers/hdtorrents.py index 7e33a152..f176e542 100644 --- a/sickbeard/providers/hdtorrents.py +++ b/sickbeard/providers/hdtorrents.py @@ -168,7 +168,7 @@ class HDTorrentsProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index e8e8bb25..3e2caf15 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -145,7 +145,7 @@ class IPTorrentsProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index 1ba99bc4..2ecf7c34 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -223,7 +223,7 @@ class KATProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} @@ -285,7 +285,7 @@ class KATProvider(generic.TorrentProvider): continue #Check number video files = episode in season and find the real Quality for full season torrent analyzing files in torrent - if mode == 'Season': + if mode == 'Season' and search_mode == 'sponly': ep_number = int(epcount / len(set(allPossibleShowNames(self.show)))) title = self._find_season_quality(title, link, ep_number) diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index dc826b0f..8ae76600 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -179,7 +179,7 @@ class NewznabProvider(generic.NZBProvider): return True - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): self._checkAuth() diff --git a/sickbeard/providers/nextgen.py b/sickbeard/providers/nextgen.py index 12ed28a8..2eeaca89 100644 --- a/sickbeard/providers/nextgen.py +++ b/sickbeard/providers/nextgen.py @@ -184,7 +184,7 @@ class NextGenProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/publichd.py b/sickbeard/providers/publichd.py index 79760443..ff365d6c 100644 --- a/sickbeard/providers/publichd.py +++ b/sickbeard/providers/publichd.py @@ -125,7 +125,7 @@ class PublicHDProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index c0a3ed74..2f908245 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -162,7 +162,7 @@ class SCCProvider(generic.TorrentProvider): else: return False - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py index d609be49..92670127 100644 --- a/sickbeard/providers/speedcd.py +++ b/sickbeard/providers/speedcd.py @@ -145,7 +145,7 @@ class SpeedCDProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index ed1a6b70..965fc292 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -217,7 +217,7 @@ class ThePirateBayProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} @@ -260,7 +260,7 @@ class ThePirateBayProvider(generic.TorrentProvider): continue #Check number video files = episode in season and find the real Quality for full season torrent analyzing files in torrent - if mode == 'Season': + if mode == 'Season' and search_mode == 'sponly': ep_number = int(epcount / len(set(allPossibleShowNames(self.show)))) title = self._find_season_quality(title, id, ep_number) diff --git a/sickbeard/providers/torrentbytes.py b/sickbeard/providers/torrentbytes.py index 11093897..979d6e96 100644 --- a/sickbeard/providers/torrentbytes.py +++ b/sickbeard/providers/torrentbytes.py @@ -147,7 +147,7 @@ class TorrentBytesProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 7e88ea02..b4988195 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -177,7 +177,7 @@ class TorrentDayProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []} diff --git a/sickbeard/providers/torrentleech.py b/sickbeard/providers/torrentleech.py index 873c8a25..f323b81a 100644 --- a/sickbeard/providers/torrentleech.py +++ b/sickbeard/providers/torrentleech.py @@ -150,7 +150,7 @@ class TorrentLeechProvider(generic.TorrentProvider): return [search_string] - def _doSearch(self, search_params, epcount=0, age=0): + def _doSearch(self, search_params, search_mode='eponly', epcount=0, age=0): results = [] items = {'Season': [], 'Episode': [], 'RSS': []}