1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-02-21 13:36:52 +00:00

Added Deluge label check - will create if does not exist

This commit is contained in:
evilhero 2016-12-19 12:05:18 -05:00
parent 7cb640500b
commit 9340cf8cf5

View file

@ -72,7 +72,17 @@ class TorrentClient(object):
logger.info('Label: ' + mylar.DELUGE_LABEL) logger.info('Label: ' + mylar.DELUGE_LABEL)
if torrent_id and mylar.DELUGE_LABEL: if torrent_id and mylar.DELUGE_LABEL:
logger.info ('Setting label to ' + mylar.DELUGE_LABEL) logger.info ('Setting label to ' + mylar.DELUGE_LABEL)
self.client.call('label.set_torrent', torrent_id, mylar.DELUGE_LABEL) try:
self.client.call('label.set_torrent', torrent_id, mylar.DELUGE_LABEL)
except:
#if label isn't set, let's try and create one.
try:
self.client.call('label.add', mylar.DELUGE_LABEL)
self.client.call('label.set_torrent', torrent_id, mylar.DELUGE_LABEL)
except:
logger.warn('Unable to set label - Either try to create it manually within Deluge, and/or ensure there are no spaces, capitalization or special characters in label')
return False
logger.info('Succesfully set label to ' + mylar.DELUGE_LABEL)
return True return True
@ -80,4 +90,4 @@ class TorrentClient(object):
# To be Added # To be Added
return False return False