'Add torrents to deluge at exit.'

@plugin.priority(135)
def on_task_output(self, task, config):

    config = self.prepare_config(config)
    if task.options.learn:
        return
    if ((not config[u'enabled']) or (not (task.accepted or task.options.test))):
        return
    self.connect(task, config)
    if (u'download' not in task.config):
        for entry in (task.accepted + task.failed):
            if os.path.exists(entry.get(u'file', u'')):
                os.remove(entry[u'file'])
                del entry[u'file']
