1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-16 22:35:03 -05:00

Merge pull request #689 from adam111316/tidy

Tidying provider code
This commit is contained in:
echel0n 2014-08-07 22:10:40 -07:00
commit aa09e88d5f
26 changed files with 55 additions and 627 deletions

View File

@ -136,7 +136,7 @@ class AnimezbCache(tvcache.TVCache):
# only poll Animezb every 20 minutes max # only poll Animezb every 20 minutes max
self.minTime = 20 self.minTime = 20
def _getRSSData(self): def _getDailyData(self):
params = { params = {
"cat": "anime".encode('utf-8'), "cat": "anime".encode('utf-8'),
@ -147,7 +147,7 @@ class AnimezbCache(tvcache.TVCache):
logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG)
return self.getRSSFeed(rss_url) return self.getRSSFeed(rss_url).entries
provider = Animezb() provider = Animezb()

View File

@ -268,46 +268,9 @@ class BitSoupCache(tvcache.TVCache):
# only poll TorrentBytes every 20 minutes max # only poll TorrentBytes every 20 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
logger.log(u"Clearing " + self.provider.name + " cache")
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title + "]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = BitSoupProvider() provider = BitSoupProvider()

View File

@ -297,44 +297,7 @@ class BTNCache(tvcache.TVCache):
# At least 15 minutes between queries # At least 15 minutes between queries
self.minTime = 15 self.minTime = 15
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
if self._checkAuth(None):
data = self._getRSSData()
# As long as we got something from the provider we count it as an update
if data:
self.setLastUpdate()
else:
return []
if self._checkAuth(data):
# By now we know we've got data and no auth errors, all we need to do is put it in the database
cl = []
for item in data:
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
else:
raise AuthException(
"Your authentication info for " + self.provider.name + " is incorrect, check your config")
else:
return []
def _getRSSData(self):
# Get the torrents uploaded since last check. # Get the torrents uploaded since last check.
seconds_since_last_update = math.ceil(time.time() - time.mktime(self._getLastUpdate().timetuple())) seconds_since_last_update = math.ceil(time.time() - time.mktime(self._getLastUpdate().timetuple()))
@ -352,17 +315,6 @@ class BTNCache(tvcache.TVCache):
return self.provider._doSearch(search_params=None, age=seconds_since_last_update) return self.provider._doSearch(search_params=None, age=seconds_since_last_update)
def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item)
if title and url:
logger.log(u"Adding item to results: " + title, logger.DEBUG)
return self._addCacheEntry(title, url)
else:
logger.log(u"The data returned from the " + self.provider.name + " is incomplete, this result is unusable",
logger.ERROR)
return None
def _checkAuth(self, data): def _checkAuth(self, data):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)

View File

@ -123,7 +123,7 @@ class DTTCache(tvcache.TVCache):
# only poll DTT every 30 minutes max # only poll DTT every 30 minutes max
self.minTime = 30 self.minTime = 30
def _getRSSData(self): def _getDailyData(self):
params = {"items": "all"} params = {"items": "all"}
@ -135,12 +135,7 @@ class DTTCache(tvcache.TVCache):
url = self.provider.url + 'rss/allshows?' + urllib.urlencode(params) url = self.provider.url + 'rss/allshows?' + urllib.urlencode(params)
logger.log(u"DTT cache update URL: " + url, logger.DEBUG) logger.log(u"DTT cache update URL: " + url, logger.DEBUG)
return self.getRSSFeed(url) return self.getRSSFeed(url).entries
def _parseItem(self, item):
title, url = self.provider._get_title_and_url(item)
logger.log(u"RSS Feed provider: [" + self.provider.name + "] Attempting to add item to cache: " + title, logger.DEBUG)
return self._addCacheEntry(title, url)
provider = DTTProvider() provider = DTTProvider()

View File

@ -174,27 +174,12 @@ class EZRSSCache(tvcache.TVCache):
# only poll EZRSS every 15 minutes max # only poll EZRSS every 15 minutes max
self.minTime = 15 self.minTime = 15
def _getRSSData(self): def _getDailyData(self):
rss_url = self.provider.url + 'feed/' rss_url = self.provider.url + 'feed/'
logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + " cache update URL: " + rss_url, logger.DEBUG)
return self.getRSSFeed(rss_url) return self.getRSSFeed(rss_url).entries
def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item)
if title and url:
logger.log(u"RSS Feed provider: [" + self.provider.name + "] Attempting to add item to cache: " + title, logger.DEBUG)
url = self._translateLinkURL(url)
return self._addCacheEntry(title, url)
else:
logger.log(
u"The XML returned from the " + self.provider.name + " feed is incomplete, this result is unusable",
logger.ERROR)
return None
provider = EZRSSProvider() provider = EZRSSProvider()

View File

@ -128,7 +128,7 @@ class FanzubCache(tvcache.TVCache):
# only poll Fanzub every 20 minutes max # only poll Fanzub every 20 minutes max
self.minTime = 20 self.minTime = 20
def _getRSSData(self): def _getDailyData(self):
params = { params = {
"cat": "anime".encode('utf-8'), "cat": "anime".encode('utf-8'),
@ -139,7 +139,7 @@ class FanzubCache(tvcache.TVCache):
logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG)
return self.getRSSFeed(rss_url) return self.getRSSFeed(rss_url).entries
provider = Fanzub() provider = Fanzub()

View File

@ -299,46 +299,8 @@ class FreshOnTVCache(tvcache.TVCache):
# poll delay in minutes # poll delay in minutes
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
logger.log(u"Clearing " + self.provider.name + " cache")
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params).entries
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = FreshOnTVProvider() provider = FreshOnTVProvider()

View File

@ -251,18 +251,6 @@ class HDBitsCache(tvcache.TVCache):
def _getRSSData(self): def _getRSSData(self):
return self.provider.getURL(self.provider.rss_url, post_data=self.provider._make_post_data_JSON(), json=True) return self.provider.getURL(self.provider.rss_url, post_data=self.provider._make_post_data_JSON(), json=True)
def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item)
if title and url:
logger.log(u"Adding item to results: " + title, logger.DEBUG)
return self._addCacheEntry(title, url)
else:
logger.log(u"The data returned from the " + self.provider.name + " is incomplete, this result is unusable",
logger.ERROR)
return None
def _checkAuth(self, data): def _checkAuth(self, data):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)

View File

@ -329,47 +329,9 @@ class HDTorrentsCache(tvcache.TVCache):
# only poll HDTorrents every 10 minutes max # only poll HDTorrents every 10 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': []} search_params = {'RSS': []}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = HDTorrentsProvider() provider = HDTorrentsProvider()

View File

@ -269,47 +269,9 @@ class IPTorrentsCache(tvcache.TVCache):
# Only poll IPTorrents every 10 minutes max # Only poll IPTorrents every 10 minutes max
self.minTime = 10 self.minTime = 10
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = IPTorrentsProvider() provider = IPTorrentsProvider()

View File

@ -355,43 +355,9 @@ class KATCache(tvcache.TVCache):
# only poll ThePirateBay every 10 minutes max # only poll ThePirateBay every 10 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['rss']} search_params = {'RSS': ['rss']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title + "]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = KATProvider() provider = KATProvider()

View File

@ -314,9 +314,9 @@ class NewzbinCache(tvcache.TVCache):
# only poll Newzbin every 10 mins max # only poll Newzbin every 10 mins max
self.minTime = 1 self.minTime = 1
def _getRSSData(self): def _getDailyData(self):
return self.provider._getRSSData() return self.provider._getRSSData().entries
def _parseItem(self, item): def _parseItem(self, item):

View File

@ -318,47 +318,9 @@ class NextGenCache(tvcache.TVCache):
# Only poll NextGen every 10 minutes max # Only poll NextGen every 10 minutes max
self.minTime = 10 self.minTime = 10
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = NextGenProvider() provider = NextGenProvider()

View File

@ -126,7 +126,7 @@ class NyaaCache(tvcache.TVCache):
# only poll NyaaTorrents every 15 minutes max # only poll NyaaTorrents every 15 minutes max
self.minTime = 15 self.minTime = 15
def _getRSSData(self): def _getDailyData(self):
params = { params = {
"page": 'rss', # Use RSS page "page": 'rss', # Use RSS page
"order": '1', # Sort Descending By Date "order": '1', # Sort Descending By Date
@ -137,7 +137,7 @@ class NyaaCache(tvcache.TVCache):
logger.log(u"NyaaTorrents cache update URL: " + url, logger.DEBUG) logger.log(u"NyaaTorrents cache update URL: " + url, logger.DEBUG)
return self.getRSSFeed(url) return self.getRSSFeed(url).entries
provider = NyaaProvider() provider = NyaaProvider()

View File

@ -98,7 +98,7 @@ class NZBsRUSCache(tvcache.TVCache):
# only poll NZBs'R'US every 15 minutes max # only poll NZBs'R'US every 15 minutes max
self.minTime = 15 self.minTime = 15
def _getRSSData(self): def _getDailyData(self):
url = self.provider.url + 'rssfeed.php?' url = self.provider.url + 'rssfeed.php?'
urlArgs = {'cat': '91,75,104', # HD,XviD,SD-x264 urlArgs = {'cat': '91,75,104', # HD,XviD,SD-x264
'i': sickbeard.NZBSRUS_UID, 'i': sickbeard.NZBSRUS_UID,
@ -107,7 +107,7 @@ class NZBsRUSCache(tvcache.TVCache):
url += urllib.urlencode(urlArgs) url += urllib.urlencode(urlArgs)
logger.log(u"NZBs'R'US cache update URL: " + url, logger.DEBUG) logger.log(u"NZBs'R'US cache update URL: " + url, logger.DEBUG)
return self.getRSSFeed(url) return self.getRSSFeed(url).entries
def _checkAuth(self, data): def _checkAuth(self, data):
return data != 'Invalid Link' return data != 'Invalid Link'

View File

@ -154,7 +154,7 @@ class OmgwtfnzbsCache(tvcache.TVCache):
tvcache.TVCache.__init__(self, provider) tvcache.TVCache.__init__(self, provider)
self.minTime = 20 self.minTime = 20
def _getRSSData(self): def _getDailyData(self):
params = {'user': provider.username, params = {'user': provider.username,
'api': provider.api_key, 'api': provider.api_key,
'eng': 1, 'eng': 1,
@ -164,7 +164,7 @@ class OmgwtfnzbsCache(tvcache.TVCache):
logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG)
return self.getRSSFeed(rss_url) return self.getRSSFeed(rss_url).entries
def _checkAuth(self, data): def _checkAuth(self, data):
return self.provider._checkAuthFromData(data) return self.provider._checkAuthFromData(data)

View File

@ -245,47 +245,9 @@ class PublicHDCache(tvcache.TVCache):
# only poll ThePirateBay every 10 minutes max # only poll ThePirateBay every 10 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['rss']} search_params = {'RSS': ['rss']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = PublicHDProvider() provider = PublicHDProvider()

View File

@ -152,21 +152,11 @@ class TorrentRssCache(tvcache.TVCache):
tvcache.TVCache.__init__(self, provider) tvcache.TVCache.__init__(self, provider)
self.minTime = 15 self.minTime = 15
def _getRSSData(self): def _getDailyData(self):
logger.log(u"TorrentRssCache cache update URL: " + self.provider.url, logger.DEBUG) logger.log(u"TorrentRssCache cache update URL: " + self.provider.url, logger.DEBUG)
request_headers = None request_headers = None
if self.provider.cookies: if self.provider.cookies:
request_headers = { 'Cookie': self.provider.cookies } request_headers = { 'Cookie': self.provider.cookies }
return self.getRSSFeed(self.provider.url, request_headers=request_headers) return self.getRSSFeed(self.provider.url, request_headers=request_headers).entries
def _parseItem(self, item):
(title, url) = self.provider._get_title_and_url(item)
if not title or not url:
logger.log(u"The XML returned from the RSS feed is incomplete, this result is unusable", logger.ERROR)
return None
logger.log(u"Attempting to add item to cache: " + title, logger.DEBUG)
return self._addCacheEntry(title, url)

View File

@ -312,47 +312,10 @@ class SCCCache(tvcache.TVCache):
# only poll SCC every 10 minutes max # only poll SCC every 10 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = SCCProvider() provider = SCCProvider()

View File

@ -252,47 +252,10 @@ class SpeedCDCache(tvcache.TVCache):
# only poll Speedcd every 20 minutes max # only poll Speedcd every 20 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title + "]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = SpeedCDProvider() provider = SpeedCDProvider()

View File

@ -338,47 +338,9 @@ class ThePirateBayCache(tvcache.TVCache):
# only poll ThePirateBay every 10 minutes max # only poll ThePirateBay every 10 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['rss']} search_params = {'RSS': ['rss']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
class ThePirateBayWebproxy: class ThePirateBayWebproxy:

View File

@ -274,45 +274,9 @@ class TorrentBytesCache(tvcache.TVCache):
# only poll TorrentBytes every 20 minutes max # only poll TorrentBytes every 20 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title + "]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = TorrentBytesProvider() provider = TorrentBytesProvider()

View File

@ -277,47 +277,10 @@ class TorrentDayCache(tvcache.TVCache):
# Only poll IPTorrents every 10 minutes max # Only poll IPTorrents every 10 minutes max
self.minTime = 10 self.minTime = 10
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = TorrentDayProvider() provider = TorrentDayProvider()

View File

@ -271,47 +271,9 @@ class TorrentLeechCache(tvcache.TVCache):
# only poll TorrentLeech every 20 minutes max # only poll TorrentLeech every 20 minutes max
self.minTime = 20 self.minTime = 20
def updateCache(self): def _getDailyData(self):
# delete anything older then 7 days
self._clearCache()
if not self.shouldUpdate():
return
search_params = {'RSS': ['']} search_params = {'RSS': ['']}
rss_results = self.provider._doSearch(search_params) return self.provider._doSearch(search_params)
if rss_results:
self.setLastUpdate()
else:
return []
cl = []
for result in rss_results:
item = (result[0], result[1])
ci = self._parseItem(item)
if ci is not None:
cl.append(ci)
if len(cl) > 0:
myDB = self._getDB()
myDB.mass_action(cl)
def _parseItem(self, item):
(title, url) = item
if not title or not url:
return None
logger.log(u"Attempting to cache item:[" + title +"]", logger.DEBUG)
return self._addCacheEntry(title, url)
provider = TorrentLeechProvider() provider = TorrentLeechProvider()

View File

@ -86,7 +86,7 @@ class TvTorrentsCache(tvcache.TVCache):
# only poll TvTorrents every 15 minutes max # only poll TvTorrents every 15 minutes max
self.minTime = 15 self.minTime = 15
def _getRSSData(self): def _getDailyData(self):
# These will be ignored on the serverside. # These will be ignored on the serverside.
ignore_regex = "all.month|month.of|season[\s\d]*complete" ignore_regex = "all.month|month.of|season[\s\d]*complete"

View File

@ -102,6 +102,9 @@ class TVCache():
return data return data
def _getDailyData(self):
return None
def _checkAuth(self, data): def _checkAuth(self, data):
return True return True
@ -112,7 +115,7 @@ class TVCache():
if self.shouldUpdate() and self._checkAuth(None): if self.shouldUpdate() and self._checkAuth(None):
# as long as the http request worked we count this as an update # as long as the http request worked we count this as an update
data = self._getRSSData() data = self._getDailyData()
if not data: if not data:
return [] return []
@ -125,8 +128,9 @@ class TVCache():
# parse data # parse data
if self._checkAuth(data): if self._checkAuth(data):
cl = [] cl = []
for item in data.entries: for item in data:
ci = self._parseItem(item) title, url = self.provider._get_title_and_url(item)
ci = self._parseItem(title, url)
if ci is not None: if ci is not None:
cl.append(ci) cl.append(ci)
@ -148,9 +152,7 @@ class TVCache():
def _translateLinkURL(self, url): def _translateLinkURL(self, url):
return url.replace('&', '&') return url.replace('&', '&')
def _parseItem(self, item): def _parseItem(self, title, url):
title = item.title
url = item.link
self._checkItemAuth(title, url) self._checkItemAuth(title, url)
@ -158,7 +160,7 @@ class TVCache():
title = self._translateTitle(title) title = self._translateTitle(title)
url = self._translateLinkURL(url) url = self._translateLinkURL(url)
logger.log(u"Checking if item from RSS feed is in the cache: " + title, logger.DEBUG) logger.log(u"Attempting to add item to cache: " + title, logger.DEBUG)
return self._addCacheEntry(title, url) return self._addCacheEntry(title, url)
else: else: