deluge options update

This commit is contained in:
doucheymcdoucherson 2019-06-16 02:00:09 -07:00 committed by evilhero
parent 38ee0e959b
commit 6550611e02
4 changed files with 39 additions and 3 deletions

View File

@ -673,6 +673,22 @@
<input type="text" name="deluge_label" value="${config['deluge_label']}" size="30"><br/>
<small>Label to be used on the torrents</small>
</div>
<div class="row">
<label>Deluge Download Path</label>
<input type="text" name="deluge_download_directory" value="${config['deluge_download_directory']}" size="30"><br/>
<small>Where the torrent will be downloaded to</small>
</div>
<div class="row">
<label>Deluge Move Path</label>
<input type="text" name="deluge_done_directory" value="${config['deluge_done_directory']}" size="30"><br/>
<small>Path that files will be moved to after download is complete</small>
</div>
<div class="config">
<div class="row checkbox left clearfix">
<input id="deluge_pause" type="checkbox" name="deluge_pause" value="1" ${config['deluge_pause']} /><label>Deluge Paused</label>
<small>Add the torrent in a paused state</small>
</div>
</div>
<div class="row">
<img name="deluge_status_icon" id="deluge_status_icon" src="interfaces/default/images/successs.png" style="float:right;visibility:hidden;" height="20" width="20" />
<input type="button" value="Test Connection" id="deluge_test" /><br/>

View File

@ -352,6 +352,9 @@ _CONFIG_DEFINITIONS = OrderedDict({
'DELUGE_USERNAME': (str, 'Deluge', None),
'DELUGE_PASSWORD': (str, 'Deluge', None),
'DELUGE_LABEL': (str, 'Deluge', None),
'DELUGE_PAUSE': (bool, 'Deluge', False),
'DELUGE_DOWNLOAD_DIRECTORY': (str, 'Deluge', ""),
'DELUGE_DONE_DIRECTORY': (str, 'Deluge', ""),
'QBITTORRENT_HOST': (str, 'qBittorrent', None),
'QBITTORRENT_USERNAME': (str, 'qBittorrent', None),

View File

@ -99,6 +99,18 @@ class TorrentClient(object):
def load_torrent(self, filepath):
options = {}
if mylar.CONFIG.DELUGE_DOWNLOAD_DIRECTORY:
options['download_location'] = mylar.CONFIG.DELUGE_DOWNLOAD_DIRECTORY
if mylar.CONFIG.DELUGE_DONE_DIRECTORY:
options['move_completed'] = 1
options['move_completed_path'] = mylar.CONFIG.DELUGE_DONE_DIRECTORY
if mylar.CONFIG.DELUGE_PAUSE:
options['add_paused'] = int(mylar.CONFIG.DELUGE_PAUSE)
logger.info('filepath to torrent file set to : ' + filepath)
torrent_id = False
@ -121,13 +133,13 @@ class TorrentClient(object):
else:
logger.info('Torrent not added yet, trying to add it now!')
try:
torrent_id = self.client.call('core.add_torrent_file', str(os.path.basename(filepath)), base64.encodestring(torrentcontent), '')
torrent_id = self.client.call('core.add_torrent_file', str(os.path.basename(filepath)), base64.encodestring(torrentcontent), options)
except Exception as e:
logger.debug('Torrent not added')
return False
else:
try:
torrent_id = self.client.call('core.add_torrent_magnet', str(filepath), {})
torrent_id = self.client.call('core.add_torrent_magnet', str(filepath), options)
except Exception as e:
logger.debug('Torrent not added')
return False
@ -158,10 +170,12 @@ class TorrentClient(object):
return {'hash': torrent_info['hash'],
'label': mylar.CONFIG.DELUGE_LABEL,
'folder': torrent_info['save_path'],
'move path': torrent_info['move_completed_path'],
'total_filesize': torrent_info['total_size'],
'name': torrent_info['name'],
'files': torrent_info['files'],
'time_started': torrent_info['active_time'],
'pause': torrent_info['paused'],
'completed': torrent_info['is_finished']}

View File

@ -4986,6 +4986,9 @@ class WebInterface(object):
"deluge_username": mylar.CONFIG.DELUGE_USERNAME,
"deluge_password": mylar.CONFIG.DELUGE_PASSWORD,
"deluge_label": mylar.CONFIG.DELUGE_LABEL,
"deluge_pause": helpers.checked(mylar.CONFIG.DELUGE_PAUSE),
"deluge_download_directory": mylar.CONFIG.DELUGE_DOWNLOAD_DIRECTORY,
"deluge_done_directory": mylar.CONFIG.DELUGE_DONE_DIRECTORY,
"qbittorrent_host": mylar.CONFIG.QBITTORRENT_HOST,
"qbittorrent_username": mylar.CONFIG.QBITTORRENT_USERNAME,
"qbittorrent_password": mylar.CONFIG.QBITTORRENT_PASSWORD,
@ -5372,7 +5375,7 @@ class WebInterface(object):
'lowercase_filenames', 'autowant_upcoming', 'autowant_all', 'comic_cover_local', 'alternate_latest_series_covers', 'cvinfo', 'snatchedtorrent_notify',
'prowl_enabled', 'prowl_onsnatch', 'pushover_enabled', 'pushover_onsnatch', 'boxcar_enabled',
'boxcar_onsnatch', 'pushbullet_enabled', 'pushbullet_onsnatch', 'telegram_enabled', 'telegram_onsnatch', 'slack_enabled', 'slack_onsnatch',
'email_enabled', 'email_enc', 'email_ongrab', 'email_onpost', 'opds_enable', 'opds_authentication', 'opds_metainfo', 'enable_ddl']
'email_enabled', 'email_enc', 'email_ongrab', 'email_onpost', 'opds_enable', 'opds_authentication', 'opds_metainfo', 'enable_ddl', 'deluge_pause']
for checked_config in checked_configs:
if checked_config not in kwargs: