diff --git a/headphones/searcher.py b/headphones/searcher.py index 8e9c2869..7b2d263e 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -1427,6 +1427,11 @@ def searchTorrent(albumid=None, new=False, losslessOnly=False): file_or_url = bestqual[2] torrentid = transmission.addTorrent(file_or_url) + + if not torrentid: + logger.error("Error sending torrent to Transmission. Are you sure it's running?") + return + torrent_folder_name = transmission.getTorrentFolder(torrentid) logger.info('Torrent folder name: %s' % torrent_folder_name) diff --git a/headphones/transmission.py b/headphones/transmission.py index 033a63d2..9b31bd96 100644 --- a/headphones/transmission.py +++ b/headphones/transmission.py @@ -32,8 +32,10 @@ def addTorrent(link): arguments = {'filename': link, 'download-dir':headphones.DOWNLOAD_TORRENT_DIR} response = torrentAction(method,arguments) - + if not response: + return False + if response['result'] == 'success': name = response['arguments']['torrent-added']['name'] logger.info(u"Torrent sent to Transmission successfully")