Private GIT

Skip to content
Snippets Groups Projects
Commit cd16dddf authored by Ruud's avatar Ruud
Browse files

Make sure to use the correct hash for utorrent

parent 25605c45
Branches
No related tags found
No related merge requests found
from base64 import b16encode, b32decode
from bencode import bencode, bdecode
from couchpotato.core.downloaders.base import Downloader
from couchpotato.core.helpers.encoding import isInt, ss
......@@ -41,9 +42,14 @@ class uTorrent(Downloader):
if data.get('type') == 'torrent_magnet':
torrent_hash = re.findall('urn:btih:([\w]{32,40})', data.get('url'))[0].upper()
torrent_params['trackers'] = '%0D%0A%0D%0A'.join(self.torrent_trackers)
else:
# Convert base 32 to hex
if len(torrent_hash) == 32:
torrent_hash = b16encode(b32decode(torrent_hash))
else:
info = bdecode(filedata)["info"]
torrent_hash = sha1(bencode(info)).hexdigest().upper()
torrent_filename = self.createFileName(data, filedata, movie)
# Send request to uTorrent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment