Private GIT

Skip to content
Snippets Groups Projects
Commit fee1a0c3 authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Fix RSS for T11

Fixes https://github.com/SiCKRAGETV/sickrage-issues/issues/3226

Add seeder/leecher/verified parsing for minseed/minleech/confirmed settings for T411
Added getting size from results in T411
parent c0a1e433
Branches
Tags 2.57b
No related merge requests found
...@@ -52,6 +52,7 @@ class T411Provider(generic.TorrentProvider): ...@@ -52,6 +52,7 @@ class T411Provider(generic.TorrentProvider):
self.urls = {'base_url': 'http://www.t411.in/', self.urls = {'base_url': 'http://www.t411.in/',
'search': 'https://api.t411.in/torrents/search/%s?cid=%s&limit=100', 'search': 'https://api.t411.in/torrents/search/%s?cid=%s&limit=100',
'rss': 'https://api.t411.in/torrents/top/today',
'login_page': 'https://api.t411.in/auth', 'login_page': 'https://api.t411.in/auth',
'download': 'https://api.t411.in/torrents/download/%s', 'download': 'https://api.t411.in/torrents/download/%s',
} }
...@@ -60,6 +61,10 @@ class T411Provider(generic.TorrentProvider): ...@@ -60,6 +61,10 @@ class T411Provider(generic.TorrentProvider):
self.subcategories = [433, 637, 455, 639] self.subcategories = [433, 637, 455, 639]
self.minseed = 0
self.minleech = 0
self.confirmed = False
def isEnabled(self): def isEnabled(self):
return self.enabled return self.enabled
...@@ -102,42 +107,49 @@ class T411Provider(generic.TorrentProvider): ...@@ -102,42 +107,49 @@ class T411Provider(generic.TorrentProvider):
if mode != 'RSS': if mode != 'RSS':
logger.log(u"Search string: %s " % search_string, logger.DEBUG) logger.log(u"Search string: %s " % search_string, logger.DEBUG)
for sc in self.subcategories: searchURLS = ([self.urls['search'] % (search_string, u) for u in self.subcategories], [self.urls['rss']])[mode == 'RSS']
searchURL = self.urls['search'] % (search_string, sc) for searchURL in searchURLS:
logger.log(u"Search URL: %s" % searchURL, logger.DEBUG) logger.log(u"Search URL: %s" % searchURL, logger.DEBUG)
data = self.getURL(searchURL, json=True) data = self.getURL(searchURL, json=True)
if not data: if not data:
continue continue
try:
if 'torrents' not in data: try:
if 'torrents' not in data and mode != 'RSS':
logger.log(u"Data returned from provider does not contain any torrents", logger.DEBUG) logger.log(u"Data returned from provider does not contain any torrents", logger.DEBUG)
continue continue
torrents = data['torrents'] torrents = data['torrents'] if mode != 'RSS' else data
if not torrents: if not torrents:
logger.log(u"Data returned from provider does not contain any torrents", logger.DEBUG) logger.log(u"Data returned from provider does not contain any torrents", logger.DEBUG)
continue continue
for torrent in torrents: for torrent in torrents:
if mode == 'RSS' and int(torrent['category']) not in self.subcategories:
continue
try: try:
title = torrent['name'] title = torrent['name']
torrent_id = torrent['id'] torrent_id = torrent['id']
download_url = (self.urls['download'] % torrent_id).encode('utf8') download_url = (self.urls['download'] % torrent_id).encode('utf8')
#FIXME
size = -1
seeders = 1
leechers = 0
if not all([title, download_url]): if not all([title, download_url]):
continue continue
size = int(torrent['size'])
seeders = int(torrent['seeders'])
leechers = int(torrent['leechers'])
verified = bool(torrent['isVerified'])
#Filter unseeded torrent #Filter unseeded torrent
#if seeders < self.minseed or leechers < self.minleech: if seeders < self.minseed or leechers < self.minleech:
# if mode != 'RSS': if mode != 'RSS':
# logger.log(u"Discarding torrent because it doesn't meet the minimum seeders or leechers: {0} (S:{1} L:{2})".format(title, seeders, leechers), logger.DEBUG) logger.log(u"Discarding torrent because it doesn't meet the minimum seeders or leechers: {0} (S:{1} L:{2})".format(title, seeders, leechers), logger.DEBUG)
# continue continue
if self.confirmed and not verified and mode != 'RSS':
logger.log(u"Found result " + title + " but that doesn't seem like a verified result so I'm ignoring it", logger.DEBUG)
continue
item = title, download_url, size, seeders, leechers item = title, download_url, size, seeders, leechers
if mode != 'RSS': if mode != 'RSS':
...@@ -147,6 +159,7 @@ class T411Provider(generic.TorrentProvider): ...@@ -147,6 +159,7 @@ class T411Provider(generic.TorrentProvider):
except Exception as e: except Exception as e:
logger.log(u"Invalid torrent data, skipping result: %s" % torrent, logger.DEBUG) logger.log(u"Invalid torrent data, skipping result: %s" % torrent, logger.DEBUG)
logger.log(u"Failed parsing provider. Traceback: %s" % traceback.format_exc(), logger.DEBUG)
continue continue
except Exception, e: except Exception, e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment