mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 19:12:26 -05:00
Fix for air-by-date downloads.
Fix for backlog and manual searches.
This commit is contained in:
parent
51830e49d9
commit
f8035e800e
@ -429,18 +429,16 @@ class NameParserCache(object):
|
||||
_cache_size = 100
|
||||
|
||||
def add(self, name, parse_result):
|
||||
with nameparser_lock:
|
||||
self._previous_parsed[name] = parse_result
|
||||
_current_cache_size = len(self._previous_parsed)
|
||||
if _current_cache_size > self._cache_size:
|
||||
for i in range(_current_cache_size - self._cache_size):
|
||||
del self._previous_parsed[self._previous_parsed.keys()[0]]
|
||||
self._previous_parsed[name] = parse_result
|
||||
_current_cache_size = len(self._previous_parsed)
|
||||
if _current_cache_size > self._cache_size:
|
||||
for i in range(_current_cache_size - self._cache_size):
|
||||
del self._previous_parsed[self._previous_parsed.keys()[0]]
|
||||
|
||||
def get(self, name):
|
||||
with nameparser_lock:
|
||||
if name in self._previous_parsed:
|
||||
logger.log("Using cached parse result for: " + name, logger.DEBUG)
|
||||
return self._previous_parsed[name]
|
||||
if name in self._previous_parsed:
|
||||
logger.log("Using cached parse result for: " + name, logger.DEBUG)
|
||||
return self._previous_parsed[name]
|
||||
|
||||
|
||||
name_parser_cache = NameParserCache()
|
||||
|
@ -236,17 +236,14 @@ class GenericProvider:
|
||||
searchItems = {}
|
||||
itemList = []
|
||||
|
||||
if not manualSearch:
|
||||
self.cache.updateCache()
|
||||
#if not manualSearch:
|
||||
# self.cache.updateCache()
|
||||
|
||||
for epObj in episodes:
|
||||
cacheResult = self.cache.searchCache(epObj, manualSearch)
|
||||
if len(cacheResult):
|
||||
results.update(cacheResult)
|
||||
continue
|
||||
|
||||
logger.log(
|
||||
u'Searching "%s" for "%s" as "%s"' % (self.name, epObj.prettyName(), epObj.prettySceneName()))
|
||||
#cacheResult = self.cache.searchCache(epObj, manualSearch)
|
||||
#if len(cacheResult):
|
||||
# results.update(cacheResult)
|
||||
# continue
|
||||
|
||||
if seasonSearch:
|
||||
for curString in self._get_season_search_strings(epObj):
|
||||
|
@ -135,8 +135,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
|
@ -116,8 +116,7 @@ class IPTorrentsProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
|
@ -189,8 +189,7 @@ class KATProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-','|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-','|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
|
@ -156,8 +156,7 @@ class NextGenProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
|
@ -100,8 +100,7 @@ class PublicHDProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
|
@ -124,8 +124,7 @@ class SCCProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
|
@ -115,8 +115,7 @@ class SpeedCDProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
|
@ -194,8 +194,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(allPossibleShowNames(self.show)):
|
||||
|
@ -142,8 +142,7 @@ class TorrentDayProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
|
@ -119,8 +119,7 @@ class TorrentLeechProvider(generic.TorrentProvider):
|
||||
if self.show.air_by_date:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
||||
ep_obj.airdate.strftime('%b')
|
||||
str(ep_obj.airdate).replace('-', '|')
|
||||
search_string['Episode'].append(ep_string)
|
||||
elif self.show.sports:
|
||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||
|
@ -1731,10 +1731,7 @@ class TVEpisode(object):
|
||||
|
||||
Returns: A string representing the episode's name and season/ep numbers
|
||||
"""
|
||||
if self.show.air_by_date:
|
||||
return self._format_pattern('%SN - %AD - %EN')
|
||||
else:
|
||||
return self._format_pattern('%SN - %Sx%0E - %EN')
|
||||
return self._format_pattern('%SN - %Sx%0E - %EN')
|
||||
|
||||
def prettySceneName(self):
|
||||
"""
|
||||
@ -1743,10 +1740,7 @@ class TVEpisode(object):
|
||||
|
||||
Returns: A string representing the episode's name and season/ep numbers
|
||||
"""
|
||||
if self.show.air_by_date:
|
||||
return self._format_pattern('%SN - %AD - %EN')
|
||||
else:
|
||||
return self._format_pattern('%SN - %XSx%0XE - %EN')
|
||||
return self._format_pattern('%SN - %XSx%0XE - %EN')
|
||||
|
||||
def _ep_name(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user