mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixes for a few provider issues plus passing of search_mode variable.
This commit is contained in:
parent
ff5107cfe2
commit
af0ccd65cf
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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"}
|
||||
|
||||
|
@ -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 []
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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()
|
||||
|
@ -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': []}
|
||||
|
@ -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': []}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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': []}
|
||||
|
@ -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': []}
|
||||
|
@ -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': []}
|
||||
|
@ -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': []}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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': []}
|
||||
|
@ -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': []}
|
||||
|
@ -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': []}
|
||||
|
Loading…
Reference in New Issue
Block a user