From 0c969970058aa5f3573eb59e4ababb7155530393 Mon Sep 17 00:00:00 2001 From: Ade Date: Wed, 25 Apr 2018 11:33:39 +1200 Subject: [PATCH] Remove t411 --- data/interfaces/default/config.html | 16 ------- headphones/config.py | 3 -- headphones/searcher.py | 71 ----------------------------- headphones/webserve.py | 1 - 4 files changed, 91 deletions(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 383db39a..21aab4b3 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -798,22 +798,6 @@ - -
-
- -
-
-
- - -
-
- - -
-
-
diff --git a/headphones/config.py b/headphones/config.py index 30591769..131e8cc2 100644 --- a/headphones/config.py +++ b/headphones/config.py @@ -297,9 +297,6 @@ _CONFIG_DEFINITIONS = { 'TWITTER_PASSWORD': (str, 'Twitter', ''), 'TWITTER_PREFIX': (str, 'Twitter', 'Headphones'), 'TWITTER_USERNAME': (str, 'Twitter', ''), - 'TQUATTRECENTONZE': (int, 'tquattrecentonze', 0), - 'TQUATTRECENTONZE_PASSWORD': (str, 'tquattrecentonze', ''), - 'TQUATTRECENTONZE_USER': (str, 'tquattrecentonze', ''), 'UPDATE_DB_INTERVAL': (int, 'General', 24), 'USENET_RETENTION': (int, 'General', '1500'), 'UTORRENT_HOST': (str, 'uTorrent', ''), diff --git a/headphones/searcher.py b/headphones/searcher.py index 39500b94..5f46335f 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -1997,77 +1997,6 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None, resultlist.append((title, size, url, provider, 'torrent', match)) except Exception as e: logger.exception("Unhandled exception in Mininova Parser") - # t411 - if headphones.CONFIG.TQUATTRECENTONZE: - username = headphones.CONFIG.TQUATTRECENTONZE_USER - password = headphones.CONFIG.TQUATTRECENTONZE_PASSWORD - API_URL = "http://api.t411.ai" - AUTH_URL = API_URL + '/auth' - DL_URL = API_URL + '/torrents/download/' - provider = "t411" - t411_term = term.replace(" ", "%20") - SEARCH_URL = API_URL + '/torrents/search/' + t411_term + "?limit=15&cid=395&subcat=623" - headers_login = {'username': username, 'password': password} - - # Requesting content - logger.info('Parsing results from t411 using search term: %s' % term) - req = request.request_content(AUTH_URL, method='post', data=headers_login) - - if len(req.split('"')) == 9: - token = req.split('"')[7] - headers_auth = {'Authorization': token} - logger.info('t411 - User %s logged in' % username) - else: - logger.info('t411 - Login error : %s' % req.split('"')[3]) - - # Quality - if headphones.CONFIG.PREFERRED_QUALITY == 3 or losslessOnly: - providerurl = fix_url(SEARCH_URL + "&term[16][]=529&term[16][]=1184") - elif headphones.CONFIG.PREFERRED_QUALITY == 1 or allow_lossless: - providerurl = fix_url(SEARCH_URL + "&term[16][]=685&term[16][]=527&term[16][]=1070&term[16][]=528&term[16][]=1167&term[16][]=1166&term[16][]=530&term[16][]=529&term[16][]=1184&term[16][]=532&term[16][]=533&term[16][]=1085&term[16][]=534&term[16][]=535&term[16][]=1069&term[16][]=537&term[16][]=538") - elif headphones.CONFIG.PREFERRED_QUALITY == 0: - providerurl = fix_url(SEARCH_URL + "&term[16][]=685&term[16][]=527&term[16][]=1070&term[16][]=528&term[16][]=1167&term[16][]=1166&term[16][]=530&term[16][]=532&term[16][]=533&term[16][]=1085&term[16][]=534&term[16][]=535&term[16][]=1069&term[16][]=537&term[16][]=538") - else: - providerurl = fix_url(SEARCH_URL) - - # Tracker search - req = request.request_content(providerurl, headers=headers_auth) - req = loads(req) - total = req['total'] - - # Process feed - if total == '0': - logger.info("No results found from t411 for %s" % term) - else: - logger.info('Found %s results from t411' % total) - torrents = req['torrents'] - for torrent in torrents: - try: - title = torrent['name'] - if torrent['seeders'] < minimumseeders: - logger.info('Skipping torrent %s : seeders below minimum set' % title) - continue - id = torrent['id'] - size = int(torrent['size']) - data = request.request_content(DL_URL + id, headers=headers_auth) - - # Blackhole - if headphones.CONFIG.TORRENT_DOWNLOADER == 0 and headphones.CONFIG.MAGNET_LINKS == 2: - url = DL_URL + id + 'TOKEN' + token - resultlist.append((title, size, url, provider, 'torrent', True)) - - # Build magnet - else: - metadata = bdecode(data) - hashcontents = bencode(metadata['info']) - digest = sha1(hashcontents).hexdigest() - trackers = [metadata["announce"]][0] - url = 'magnet:?xt=urn:btih:%s&tr=%s' % (digest, trackers) - resultlist.append((title, size, url, provider, 'torrent', True)) - - except Exception as e: - logger.error("Error converting magnet link: %s" % str(e)) - return # attempt to verify that this isn't a substring result # when looking for "Foo - Foo" we don't want "Foobar" diff --git a/headphones/webserve.py b/headphones/webserve.py index 30ed209e..324988fe 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -14,7 +14,6 @@ # along with Headphones. If not, see . # NZBGet support added by CurlyMo as a part of XBian - XBMC on the Raspberry Pi -# t411 support added by a1ex, @likeitneverwentaway on github for maintenance from operator import itemgetter import threading