A little bit of error checking for Transmission

This commit is contained in:
rembo10
2013-08-14 11:40:34 +05:30
parent 95bafed76a
commit 411383c856
2 changed files with 8 additions and 1 deletions

View File

@@ -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)

View File

@@ -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")