mirror of
https://github.com/moparisthebest/SickRage
synced 2025-03-04 18:39:39 -05:00
Fixes season pack and episode only searches
This commit is contained in:
parent
e309aa2cbf
commit
816a3d9572
@ -87,14 +87,16 @@ class DailySearcher():
|
|||||||
|
|
||||||
def searchForNeededEpisodes(self):
|
def searchForNeededEpisodes(self):
|
||||||
|
|
||||||
logger.log(u"Searching ESS Cache for any needed new episodes")
|
logger.log(u"Searching RSS Cache for any new releases we may want to snatch ...")
|
||||||
|
|
||||||
foundResults = {}
|
foundResults = {}
|
||||||
|
|
||||||
didSearch = False
|
didSearch = False
|
||||||
|
|
||||||
# ask all providers for any episodes it finds
|
# ask all providers for any episodes it finds
|
||||||
|
threadName = threading.currentThread().name
|
||||||
for curProvider in [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]:
|
for curProvider in [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]:
|
||||||
|
threading.currentThread().name = threadName + ":[" + curProvider.name + "]"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
curFoundResults = curProvider.searchRSS()
|
curFoundResults = curProvider.searchRSS()
|
||||||
|
@ -53,6 +53,8 @@ class GenericProvider:
|
|||||||
|
|
||||||
self.show = None
|
self.show = None
|
||||||
self.supportsBacklog = False
|
self.supportsBacklog = False
|
||||||
|
self.search_mode = None
|
||||||
|
self.search_fallback = False
|
||||||
|
|
||||||
self.cache = tvcache.TVCache(self)
|
self.cache = tvcache.TVCache(self)
|
||||||
|
|
||||||
@ -234,11 +236,13 @@ class GenericProvider:
|
|||||||
|
|
||||||
searched_scene_season = None
|
searched_scene_season = None
|
||||||
for epObj in episodes:
|
for epObj in episodes:
|
||||||
scene_season = epObj.scene_season
|
|
||||||
if seasonSearch and searched_scene_season:
|
if seasonSearch and searched_scene_season:
|
||||||
if scene_season == searched_scene_season:
|
if searched_scene_season == epObj.scene_season:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# mark season searched for season pack searches so we can skip later on
|
||||||
|
searched_scene_season = epObj.scene_season
|
||||||
|
|
||||||
if not epObj.show.air_by_date:
|
if not epObj.show.air_by_date:
|
||||||
if epObj.scene_season == 0 or epObj.scene_episode == 0:
|
if epObj.scene_season == 0 or epObj.scene_episode == 0:
|
||||||
logger.log(
|
logger.log(
|
||||||
@ -265,9 +269,6 @@ class GenericProvider:
|
|||||||
itemList = [i for n, i in enumerate(itemList) if i not in itemList[n + 1:]]
|
itemList = [i for n, i in enumerate(itemList) if i not in itemList[n + 1:]]
|
||||||
searchItems[epObj] = itemList
|
searchItems[epObj] = itemList
|
||||||
|
|
||||||
# mark season searched so we can skip anymore searches of this season if this is a season pack search
|
|
||||||
searched_scene_season = scene_season
|
|
||||||
|
|
||||||
# if we have cached results return them.
|
# if we have cached results return them.
|
||||||
if len(results):
|
if len(results):
|
||||||
return results
|
return results
|
||||||
@ -288,6 +289,12 @@ class GenericProvider:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if not (self.show.air_by_date or self.show.sports):
|
if not (self.show.air_by_date or self.show.sports):
|
||||||
|
if seasonSearch and len(parse_result.episode_numbers):
|
||||||
|
logger.log(
|
||||||
|
u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it",
|
||||||
|
logger.DEBUG)
|
||||||
|
continue
|
||||||
|
|
||||||
if not len(parse_result.episode_numbers) and (
|
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 parse_result.season_number != ep_obj.season) or (
|
||||||
parse_result.season_number == None and ep_obj.season != 1):
|
parse_result.season_number == None and ep_obj.season != 1):
|
||||||
|
@ -32,6 +32,7 @@ class RSSUpdater():
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.amActive = True
|
self.amActive = True
|
||||||
|
threadName = threading.currentThread().name
|
||||||
|
|
||||||
# remove names from cache that link back to active shows that we watch
|
# remove names from cache that link back to active shows that we watch
|
||||||
sickbeard.name_cache.syncNameCache()
|
sickbeard.name_cache.syncNameCache()
|
||||||
@ -39,7 +40,8 @@ class RSSUpdater():
|
|||||||
# update RSS cache
|
# update RSS cache
|
||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
|
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
|
||||||
for provider in providers:
|
for provider in providers:
|
||||||
logger.log(u"Updating RSS cache for provider [" + provider.name + "]")
|
threading.currentThread().name = threadName + ":[" + provider.name + "]"
|
||||||
|
logger.log(u"Updating RSS cache ...")
|
||||||
provider.cache.updateCache()
|
provider.cache.updateCache()
|
||||||
|
|
||||||
self.amActive = False
|
self.amActive = False
|
@ -317,10 +317,12 @@ def filterSearchResults(show, results):
|
|||||||
|
|
||||||
|
|
||||||
def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manualSearch=False):
|
def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manualSearch=False):
|
||||||
|
threadName = threading.currentThread().name
|
||||||
|
|
||||||
if seasonSearch:
|
if seasonSearch:
|
||||||
logger.log(u"Searching for " + show.name + " season " + str(season) + " pack")
|
logger.log(u"Searching for " + show.name + " Season " + str(season) + " pack")
|
||||||
else:
|
else:
|
||||||
logger.log(u"Searching for episodes we need from " + show.name + " season " + str(season))
|
logger.log(u"Searching for episodes we need from " + show.name + " Season " + str(season))
|
||||||
|
|
||||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
|
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
|
||||||
|
|
||||||
@ -329,9 +331,11 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
|
|||||||
logger.ERROR)
|
logger.ERROR)
|
||||||
return queueItem
|
return queueItem
|
||||||
|
|
||||||
|
def doSearch():
|
||||||
foundResults = {}
|
foundResults = {}
|
||||||
for providerNum, provider in enumerate(providers):
|
for providerNum, provider in enumerate(providers):
|
||||||
foundResults.setdefault(provider.name, {})
|
foundResults.setdefault(provider.name, {})
|
||||||
|
threading.currentThread().name = threadName + ":[" + provider.name + "]"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
curResults = provider.findSearchResults(show, season, episodes, seasonSearch, manualSearch)
|
curResults = provider.findSearchResults(show, season, episodes, seasonSearch, manualSearch)
|
||||||
@ -557,3 +561,6 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
return queueItem
|
return queueItem
|
||||||
|
|
||||||
|
results = doSearch()
|
||||||
|
return results
|
@ -138,7 +138,7 @@ class BacklogQueueItem(generic_queue.QueueItem):
|
|||||||
seasonSearch = True
|
seasonSearch = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logger.log("Beginning backlog search for episodes from [" + self.show.name + "] - Season[" + str(season) + "]")
|
logger.log("Beginning backlog search for [" + self.show.name + "]")
|
||||||
searchResult = search.searchProviders(self, self.show, season, wantedEps, seasonSearch, False)
|
searchResult = search.searchProviders(self, self.show, season, wantedEps, seasonSearch, False)
|
||||||
|
|
||||||
if searchResult:
|
if searchResult:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user