parent
a7c2e596d9
commit
182845ce3e
|
@ -102,7 +102,6 @@ class Core(CorePluginBase):
|
|||
core = component.get("Core")
|
||||
self.config = ConfigManager("label.conf", defaults=CONFIG_DEFAULTS)
|
||||
self.core_cfg = ConfigManager("core.conf")
|
||||
#self.set_config_defaults()
|
||||
|
||||
#reduce typing, assigning some values to self...
|
||||
self.torrents = core.torrentmanager.torrents
|
||||
|
@ -130,8 +129,6 @@ class Core(CorePluginBase):
|
|||
return dict( [(label, 0) for label in self.labels.keys()])
|
||||
|
||||
## Plugin hooks ##
|
||||
|
||||
|
||||
def post_torrent_add(self, torrent_id):
|
||||
log.debug("post_torrent_add")
|
||||
torrent = self.torrents[torrent_id]
|
||||
|
@ -139,7 +136,7 @@ class Core(CorePluginBase):
|
|||
for label_id, options in self.labels.iteritems():
|
||||
if options["auto_add"]:
|
||||
if self._has_auto_match(torrent, options):
|
||||
self.export_set_torrent(torrent_id, label_id)
|
||||
self.set_torrent(torrent_id, label_id)
|
||||
return
|
||||
|
||||
def post_torrent_remove(self, torrent_id):
|
||||
|
@ -147,7 +144,6 @@ class Core(CorePluginBase):
|
|||
if torrent_id in self.torrent_labels:
|
||||
del self.torrent_labels[torrent_id]
|
||||
|
||||
|
||||
## Utils ##
|
||||
def clean_config(self):
|
||||
"remove invalid data from config-file"
|
||||
|
@ -176,16 +172,6 @@ class Core(CorePluginBase):
|
|||
self.clean_config()
|
||||
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()
|
||||
def get_labels(self):
|
||||
return sorted(self.labels.keys())
|
||||
|
|
Loading…
Reference in New Issue