mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-13 11:32:20 -05:00
Fix for subtitles datetime issue
Code cleanup.
This commit is contained in:
parent
b9fa92e439
commit
56a0a04a2c
@ -268,10 +268,10 @@ class BTNProvider(generic.TorrentProvider):
|
||||
|
||||
return to_return
|
||||
|
||||
def _doGeneralSearch(self, search_string):
|
||||
def _doGeneralSearch(self, search_string, show=None):
|
||||
# 'search' looks as broad is it can find. Can contain episode overview and title for example,
|
||||
# use with caution!
|
||||
return self._doSearch({'search': search_string})
|
||||
return self._doSearch({'search': search_string}, show=show)
|
||||
|
||||
def findPropers(self, search_date=None):
|
||||
results = []
|
||||
|
@ -261,15 +261,11 @@ class GenericProvider:
|
||||
if results:
|
||||
return results
|
||||
|
||||
abd = False
|
||||
if show.air_by_date:
|
||||
abd = True
|
||||
|
||||
if seasonSearch:
|
||||
for curString in self._get_season_search_strings(show, ep_obj.scene_season, ep_obj.scene_episode if not abd else ep_obj._airdate, abd=abd):
|
||||
itemList += self._doSearch(curString)
|
||||
for curString in self._get_season_search_strings(show, ep_obj.scene_season, ep_obj.scene_episode, show.air_by_date):
|
||||
itemList += self._doSearch(curString, show=show)
|
||||
else:
|
||||
for curString in self._get_episode_search_strings(show, ep_obj.scene_season, ep_obj.scene_episode if not abd else ep_obj._airdate, abd=abd):
|
||||
for curString in self._get_episode_search_strings(show, ep_obj.scene_season, ep_obj.scene_episode, show.air_by_date):
|
||||
itemList += self._doSearch(curString, show=show)
|
||||
|
||||
for item in itemList:
|
||||
|
@ -309,7 +309,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -256,7 +256,7 @@ class IPTorrentsProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -390,7 +390,7 @@ class KATProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -144,8 +144,8 @@ class NewznabProvider(generic.NZBProvider):
|
||||
|
||||
return to_return
|
||||
|
||||
def _doGeneralSearch(self, search_string):
|
||||
return self._doSearch({'q': search_string})
|
||||
def _doGeneralSearch(self, search_string, show=None):
|
||||
return self._doSearch({'q': search_string}, show=show)
|
||||
|
||||
def _checkAuth(self):
|
||||
|
||||
|
@ -303,7 +303,7 @@ class NextGenProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -278,7 +278,7 @@ class PublicHDProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -280,7 +280,7 @@ class SCCProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -239,7 +239,7 @@ class SpeedCDProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -384,7 +384,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -252,7 +252,7 @@ class TorrentDayProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -255,7 +255,7 @@ class TorrentLeechProvider(generic.TorrentProvider):
|
||||
curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
|
||||
searchString = self._get_episode_search_strings(curShow, curEp.scene_season, curEp.scene_episode, curShow.air_by_date, add_string='PROPER|REPACK')
|
||||
|
||||
for item in self._doSearch(searchString[0]):
|
||||
for item in self._doSearch(searchString[0], show=curShow):
|
||||
title, url = self._get_title_and_url(item)
|
||||
results.append(classes.Proper(title, url, datetime.datetime.today()))
|
||||
|
||||
|
@ -119,6 +119,7 @@ class SubtitlesFinder():
|
||||
continue
|
||||
|
||||
# Old shows rule
|
||||
throwaway = datetime.datetime.strptime('20110101', '%Y%m%d')
|
||||
if ((epToSub['airdate_daydiff'] > 7 and epToSub['searchcount'] < 2 and now - datetime.datetime.strptime(epToSub['lastsearch'], '%Y-%m-%d %H:%M:%S') > datetime.timedelta(hours=rules['old'][epToSub['searchcount']])) or
|
||||
# Recent shows rule
|
||||
(epToSub['airdate_daydiff'] <= 7 and epToSub['searchcount'] < 7 and now - datetime.datetime.strptime(epToSub['lastsearch'], '%Y-%m-%d %H:%M:%S') > datetime.timedelta(hours=rules['new'][epToSub['searchcount']]))):
|
||||
|
Loading…
Reference in New Issue
Block a user