Private GIT

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

Fix torrage and zoink.ch, because torcache has a timer and returns html instead of a torrent

parent ae56749c
No related branches found
No related tags found
No related merge requests found
...@@ -146,6 +146,7 @@ class GenericProvider: ...@@ -146,6 +146,7 @@ class GenericProvider:
if self.providerType == GenericProvider.TORRENT: if self.providerType == GenericProvider.TORRENT:
try: try:
torrent_hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0].upper() torrent_hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0].upper()
torrent_name = re.findall('dn=([^&]+)', result.url)[0]
if len(torrent_hash) == 32: if len(torrent_hash) == 32:
torrent_hash = b16encode(b32decode(torrent_hash)).upper() torrent_hash = b16encode(b32decode(torrent_hash)).upper()
...@@ -156,9 +157,8 @@ class GenericProvider: ...@@ -156,9 +157,8 @@ class GenericProvider:
urls = [ urls = [
'http://torcache.net/torrent/' + torrent_hash + '.torrent', 'http://torcache.net/torrent/' + torrent_hash + '.torrent',
#zoink.ch misconfigured, torrage.com domain expired. 'http://zoink.ch/torrent/' + torrent_name + '.torrent',
#'http://zoink.ch/torrent/' + torrent_hash + '.torrent', 'http://torrage.com/torrent/' + torrent_hash + '.torrent',
#'http://torrage.com/torrent/' + torrent_hash.lower() + '.torrent',
] ]
except: except:
urls = [result.url] urls = [result.url]
...@@ -184,6 +184,8 @@ class GenericProvider: ...@@ -184,6 +184,8 @@ class GenericProvider:
if self._verify_download(filename): if self._verify_download(filename):
return True return True
else:
helpers._remove_file_failed(filename)
logger.log(u"Failed to download result", logger.WARNING) logger.log(u"Failed to download result", logger.WARNING)
return False return False
...@@ -208,7 +210,7 @@ class GenericProvider: ...@@ -208,7 +210,7 @@ class GenericProvider:
except Exception as e: except Exception as e:
logger.log(u"Failed to validate torrent file: " + ex(e), logger.DEBUG) logger.log(u"Failed to validate torrent file: " + ex(e), logger.DEBUG)
logger.log(u"Result is not a valid torrent file", logger.WARNING) logger.log(u"Result is not a valid torrent file", logger.DEBUG)
return False return False
return True return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment