mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 04:54:23 +00:00
parent
a7c2e596d9
commit
182845ce3e
@ -102,7 +102,6 @@ class Core(CorePluginBase):
|
|||||||
core = component.get("Core")
|
core = component.get("Core")
|
||||||
self.config = ConfigManager("label.conf", defaults=CONFIG_DEFAULTS)
|
self.config = ConfigManager("label.conf", defaults=CONFIG_DEFAULTS)
|
||||||
self.core_cfg = ConfigManager("core.conf")
|
self.core_cfg = ConfigManager("core.conf")
|
||||||
#self.set_config_defaults()
|
|
||||||
|
|
||||||
#reduce typing, assigning some values to self...
|
#reduce typing, assigning some values to self...
|
||||||
self.torrents = core.torrentmanager.torrents
|
self.torrents = core.torrentmanager.torrents
|
||||||
@ -130,8 +129,6 @@ class Core(CorePluginBase):
|
|||||||
return dict( [(label, 0) for label in self.labels.keys()])
|
return dict( [(label, 0) for label in self.labels.keys()])
|
||||||
|
|
||||||
## Plugin hooks ##
|
## Plugin hooks ##
|
||||||
|
|
||||||
|
|
||||||
def post_torrent_add(self, torrent_id):
|
def post_torrent_add(self, torrent_id):
|
||||||
log.debug("post_torrent_add")
|
log.debug("post_torrent_add")
|
||||||
torrent = self.torrents[torrent_id]
|
torrent = self.torrents[torrent_id]
|
||||||
@ -139,7 +136,7 @@ class Core(CorePluginBase):
|
|||||||
for label_id, options in self.labels.iteritems():
|
for label_id, options in self.labels.iteritems():
|
||||||
if options["auto_add"]:
|
if options["auto_add"]:
|
||||||
if self._has_auto_match(torrent, options):
|
if self._has_auto_match(torrent, options):
|
||||||
self.export_set_torrent(torrent_id, label_id)
|
self.set_torrent(torrent_id, label_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
def post_torrent_remove(self, torrent_id):
|
def post_torrent_remove(self, torrent_id):
|
||||||
@ -147,7 +144,6 @@ class Core(CorePluginBase):
|
|||||||
if torrent_id in self.torrent_labels:
|
if torrent_id in self.torrent_labels:
|
||||||
del self.torrent_labels[torrent_id]
|
del self.torrent_labels[torrent_id]
|
||||||
|
|
||||||
|
|
||||||
## Utils ##
|
## Utils ##
|
||||||
def clean_config(self):
|
def clean_config(self):
|
||||||
"remove invalid data from config-file"
|
"remove invalid data from config-file"
|
||||||
@ -176,16 +172,6 @@ class Core(CorePluginBase):
|
|||||||
self.clean_config()
|
self.clean_config()
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
def set_config_defaults(self):
|
|
||||||
#TODO : there is a deluge builtin for this, use it!
|
|
||||||
changed = False
|
|
||||||
for key, value in CONFIG_DEFAULTS.iteritems():
|
|
||||||
if not key in self.config.config:
|
|
||||||
self.config[key] = value
|
|
||||||
changed = True
|
|
||||||
if changed:
|
|
||||||
self.config.save()
|
|
||||||
|
|
||||||
@export()
|
@export()
|
||||||
def get_labels(self):
|
def get_labels(self):
|
||||||
return sorted(self.labels.keys())
|
return sorted(self.labels.keys())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user