diff --git a/couchpotato/core/downloaders/utorrent/main.py b/couchpotato/core/downloaders/utorrent/main.py index 6f290242aebeb3a94b7787e22c086297af2556a4..5953b11790ac9a99534979c582fc18232a7d1d3b 100644 --- a/couchpotato/core/downloaders/utorrent/main.py +++ b/couchpotato/core/downloaders/utorrent/main.py @@ -39,19 +39,19 @@ class uTorrent(Downloader): if not filedata and data.get('type') == 'torrent': log.error('Failed sending torrent, no data') return False + 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() - + info = bdecode(filedata)["info"] + torrent_hash = sha1(bencode(info)).hexdigest().upper() torrent_filename = self.createFileName(data, filedata, movie) + # Convert base 32 to hex + if len(torrent_hash) == 32: + torrent_hash = b16encode(b32decode(torrent_hash)) + # Send request to uTorrent try: if not self.utorrent_api: