1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-01-03 13:34:33 +00:00

FIX:(#2124) qBittorrent download directory option not being honoured for added torrents

This commit is contained in:
evilhero 2018-11-30 14:43:08 -05:00
parent 8913ba6e61
commit aadb1a7d9e

View file

@ -81,8 +81,17 @@ class TorrentClient(object):
#multiple copies of the same issues that's already downloaded
else:
logger.info('Torrent not added yet, trying to add it now!')
if any([mylar.CONFIG.QBITTORRENT_FOLDER is None, mylar.CONFIG.QBITTORRENT_FOLDER == '', mylar.CONFIG.QBITTORRENT_FOLDER == 'None']):
down_dir = None
else:
down_dir = mylar.CONFIG.QBITTORRENT_FOLDER
logger.info('Forcing Download location to: %s' % down_dir)
if filepath.startswith('magnet'):
try:
if down_dir is not None:
tid = self.client.download_from_link(filepath, savepath=str(down_dir), category=str(mylar.CONFIG.QBITTORRENT_LABEL))
else:
tid = self.client.download_from_link(filepath, category=str(mylar.CONFIG.QBITTORRENT_LABEL))
except Exception as e:
logger.debug('Torrent not added')
@ -92,6 +101,9 @@ class TorrentClient(object):
else:
try:
torrent_content = open(filepath, 'rb')
if down_dir is not None:
tid = self.client.download_from_file(torrent_content, savepath=str(down_dir), category=str(mylar.CONFIG.QBITTORRENT_LABEL))
else:
tid = self.client.download_from_file(torrent_content, category=str(mylar.CONFIG.QBITTORRENT_LABEL))
except Exception as e:
logger.debug('Torrent not added')