mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 11:32:20 -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
|
_cache_size = 100
|
||||||
|
|
||||||
def add(self, name, parse_result):
|
def add(self, name, parse_result):
|
||||||
with nameparser_lock:
|
self._previous_parsed[name] = parse_result
|
||||||
self._previous_parsed[name] = parse_result
|
_current_cache_size = len(self._previous_parsed)
|
||||||
_current_cache_size = len(self._previous_parsed)
|
if _current_cache_size > self._cache_size:
|
||||||
if _current_cache_size > self._cache_size:
|
for i in range(_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]]
|
||||||
del self._previous_parsed[self._previous_parsed.keys()[0]]
|
|
||||||
|
|
||||||
def get(self, name):
|
def get(self, name):
|
||||||
with nameparser_lock:
|
if name in self._previous_parsed:
|
||||||
if name in self._previous_parsed:
|
logger.log("Using cached parse result for: " + name, logger.DEBUG)
|
||||||
logger.log("Using cached parse result for: " + name, logger.DEBUG)
|
return self._previous_parsed[name]
|
||||||
return self._previous_parsed[name]
|
|
||||||
|
|
||||||
|
|
||||||
name_parser_cache = NameParserCache()
|
name_parser_cache = NameParserCache()
|
||||||
|
@ -236,17 +236,14 @@ class GenericProvider:
|
|||||||
searchItems = {}
|
searchItems = {}
|
||||||
itemList = []
|
itemList = []
|
||||||
|
|
||||||
if not manualSearch:
|
#if not manualSearch:
|
||||||
self.cache.updateCache()
|
# self.cache.updateCache()
|
||||||
|
|
||||||
for epObj in episodes:
|
for epObj in episodes:
|
||||||
cacheResult = self.cache.searchCache(epObj, manualSearch)
|
#cacheResult = self.cache.searchCache(epObj, manualSearch)
|
||||||
if len(cacheResult):
|
#if len(cacheResult):
|
||||||
results.update(cacheResult)
|
# results.update(cacheResult)
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
logger.log(
|
|
||||||
u'Searching "%s" for "%s" as "%s"' % (self.name, epObj.prettyName(), epObj.prettySceneName()))
|
|
||||||
|
|
||||||
if seasonSearch:
|
if seasonSearch:
|
||||||
for curString in self._get_season_search_strings(epObj):
|
for curString in self._get_season_search_strings(epObj):
|
||||||
|
@ -135,8 +135,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
|
|||||||
if self.show.air_by_date:
|
if self.show.air_by_date:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
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:
|
if self.show.air_by_date:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
|
@ -189,8 +189,7 @@ class KATProvider(generic.TorrentProvider):
|
|||||||
if self.show.air_by_date:
|
if self.show.air_by_date:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-','|') + '|' + \
|
str(ep_obj.airdate).replace('-','|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
|
@ -156,8 +156,7 @@ class NextGenProvider(generic.TorrentProvider):
|
|||||||
if self.show.air_by_date:
|
if self.show.air_by_date:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
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:
|
if self.show.air_by_date:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
|
@ -124,8 +124,7 @@ class SCCProvider(generic.TorrentProvider):
|
|||||||
if self.show.air_by_date:
|
if self.show.air_by_date:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
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:
|
if self.show.air_by_date:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
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:
|
if self.show.air_by_date:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(allPossibleShowNames(self.show)):
|
for show_name in set(allPossibleShowNames(self.show)):
|
||||||
|
@ -142,8 +142,7 @@ class TorrentDayProvider(generic.TorrentProvider):
|
|||||||
if self.show.air_by_date:
|
if self.show.air_by_date:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
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:
|
if self.show.air_by_date:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
||||||
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
ep_string = sanitizeSceneName(show_name) + ' ' + \
|
||||||
str(ep_obj.airdate).replace('-', '|') + '|' + \
|
str(ep_obj.airdate).replace('-', '|')
|
||||||
ep_obj.airdate.strftime('%b')
|
|
||||||
search_string['Episode'].append(ep_string)
|
search_string['Episode'].append(ep_string)
|
||||||
elif self.show.sports:
|
elif self.show.sports:
|
||||||
for show_name in set(show_name_helpers.allPossibleShowNames(self.show)):
|
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
|
Returns: A string representing the episode's name and season/ep numbers
|
||||||
"""
|
"""
|
||||||
if self.show.air_by_date:
|
return self._format_pattern('%SN - %Sx%0E - %EN')
|
||||||
return self._format_pattern('%SN - %AD - %EN')
|
|
||||||
else:
|
|
||||||
return self._format_pattern('%SN - %Sx%0E - %EN')
|
|
||||||
|
|
||||||
def prettySceneName(self):
|
def prettySceneName(self):
|
||||||
"""
|
"""
|
||||||
@ -1743,10 +1740,7 @@ class TVEpisode(object):
|
|||||||
|
|
||||||
Returns: A string representing the episode's name and season/ep numbers
|
Returns: A string representing the episode's name and season/ep numbers
|
||||||
"""
|
"""
|
||||||
if self.show.air_by_date:
|
return self._format_pattern('%SN - %XSx%0XE - %EN')
|
||||||
return self._format_pattern('%SN - %AD - %EN')
|
|
||||||
else:
|
|
||||||
return self._format_pattern('%SN - %XSx%0XE - %EN')
|
|
||||||
|
|
||||||
def _ep_name(self):
|
def _ep_name(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user