Make sure to use the correct hash for utorrent
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from base64 import b16encode, b32decode
|
||||||
from bencode import bencode, bdecode
|
from bencode import bencode, bdecode
|
||||||
from couchpotato.core.downloaders.base import Downloader
|
from couchpotato.core.downloaders.base import Downloader
|
||||||
from couchpotato.core.helpers.encoding import isInt, ss
|
from couchpotato.core.helpers.encoding import isInt, ss
|
||||||
@@ -42,8 +43,13 @@ class uTorrent(Downloader):
|
|||||||
torrent_hash = re.findall('urn:btih:([\w]{32,40})', data.get('url'))[0].upper()
|
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)
|
torrent_params['trackers'] = '%0D%0A%0D%0A'.join(self.torrent_trackers)
|
||||||
else:
|
else:
|
||||||
info = bdecode(filedata)["info"]
|
# Convert base 32 to hex
|
||||||
torrent_hash = sha1(bencode(info)).hexdigest().upper()
|
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)
|
torrent_filename = self.createFileName(data, filedata, movie)
|
||||||
|
|
||||||
# Send request to uTorrent
|
# Send request to uTorrent
|
||||||
|
|||||||
Reference in New Issue
Block a user