mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-16 17:47:43 +00:00
Fixes season pack and episode only searches
This commit is contained in:
parent
e309aa2cbf
commit
816a3d9572
5 changed files with 230 additions and 212 deletions
|
@ -87,14 +87,16 @@ class DailySearcher():
|
|||
|
||||
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 = {}
|
||||
|
||||
didSearch = False
|
||||
|
||||
# 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()]:
|
||||
threading.currentThread().name = threadName + ":[" + curProvider.name + "]"
|
||||
|
||||
try:
|
||||
curFoundResults = curProvider.searchRSS()
|
||||
|
|
|
@ -53,6 +53,8 @@ class GenericProvider:
|
|||
|
||||
self.show = None
|
||||
self.supportsBacklog = False
|
||||
self.search_mode = None
|
||||
self.search_fallback = False
|
||||
|
||||
self.cache = tvcache.TVCache(self)
|
||||
|
||||
|
@ -234,11 +236,13 @@ class GenericProvider:
|
|||
|
||||
searched_scene_season = None
|
||||
for epObj in episodes:
|
||||
scene_season = epObj.scene_season
|
||||
if seasonSearch and searched_scene_season:
|
||||
if scene_season == searched_scene_season:
|
||||
if searched_scene_season == epObj.scene_season:
|
||||
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 epObj.scene_season == 0 or epObj.scene_episode == 0:
|
||||
logger.log(
|
||||
|
@ -265,9 +269,6 @@ class GenericProvider:
|
|||
itemList = [i for n, i in enumerate(itemList) if i not in itemList[n + 1:]]
|
||||
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 len(results):
|
||||
return results
|
||||
|
@ -288,6 +289,12 @@ class GenericProvider:
|
|||
continue
|
||||
|
||||
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 (
|
||||
parse_result.season_number != None and parse_result.season_number != ep_obj.season) or (
|
||||
parse_result.season_number == None and ep_obj.season != 1):
|
||||
|
|
|
@ -32,6 +32,7 @@ class RSSUpdater():
|
|||
|
||||
def run(self):
|
||||
self.amActive = True
|
||||
threadName = threading.currentThread().name
|
||||
|
||||
# remove names from cache that link back to active shows that we watch
|
||||
sickbeard.name_cache.syncNameCache()
|
||||
|
@ -39,7 +40,8 @@ class RSSUpdater():
|
|||
# update RSS cache
|
||||
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
|
||||
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()
|
||||
|
||||
self.amActive = False
|
|
@ -317,10 +317,12 @@ def filterSearchResults(show, results):
|
|||
|
||||
|
||||
def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manualSearch=False):
|
||||
threadName = threading.currentThread().name
|
||||
|
||||
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:
|
||||
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()]
|
||||
|
||||
|
@ -329,9 +331,11 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
|
|||
logger.ERROR)
|
||||
return queueItem
|
||||
|
||||
def doSearch():
|
||||
foundResults = {}
|
||||
for providerNum, provider in enumerate(providers):
|
||||
foundResults.setdefault(provider.name, {})
|
||||
threading.currentThread().name = threadName + ":[" + provider.name + "]"
|
||||
|
||||
try:
|
||||
curResults = provider.findSearchResults(show, season, episodes, seasonSearch, manualSearch)
|
||||
|
@ -557,3 +561,6 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
|
|||
continue
|
||||
|
||||
return queueItem
|
||||
|
||||
results = doSearch()
|
||||
return results
|
|
@ -138,7 +138,7 @@ class BacklogQueueItem(generic_queue.QueueItem):
|
|||
seasonSearch = True
|
||||
|
||||
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)
|
||||
|
||||
if searchResult:
|
||||
|
|
Loading…
Reference in a new issue