Fix for air-by-date downloads.

Fix for backlog and manual searches.
This commit is contained in:
echel0n 2014-05-11 07:17:11 -07:00
parent 51830e49d9
commit f8035e800e
13 changed files with 26 additions and 47 deletions

View file

@ -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()

View file

@ -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):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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)):

View file

@ -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):
"""