From c088962dff60ff343273b64e8a2db7c2ebf63c55 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 03:19:07 +0200 Subject: [Crypter] Set folder --- module/plugins/Crypter.py | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'module') diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index 44a47b35b..6c73edc60 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -1,24 +1,8 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: mkaay -""" - from module.plugins.Plugin import Plugin + class Crypter(Plugin): __name__ = "Crypter" __version__ = "0.1" @@ -28,6 +12,7 @@ class Crypter(Plugin): __author_name__ = "mkaay" __author_mail__ = "mkaay@mkaay.de" + def __init__(self, pyfile): Plugin.__init__(self, pyfile) @@ -58,11 +43,17 @@ class Crypter(Plugin): """ create new packages from self.packages """ for pack in self.packages: - self.logDebug("Parsed package %(name)s with %(len)d links" % { "name" : pack[0], "len" : len(pack[1]) } ) + name, links, folder = pack + + self.logDebug("Parsed package %(name)s with %(len)d links" % {"name": name, "len": len(links)}) + + links = [x.decode("utf-8") for x in links] - links = [x.decode("utf-8") for x in pack[1]] + pid = self.core.api.addPackage(name, links, self.pyfile.package().queue) - pid = self.core.api.addPackage(pack[0], links, self.pyfile.package().queue) + if name != folder is not None: + self.core.api.setPackageData(pid, {"folder": folder}) #: Due to not break API addPackage method right now + self.logDebug("Set package %(name)s folder to %(folder)s" % {"name": name, "folder": folder}) if self.pyfile.package().password: self.core.api.setPackageData(pid, {"password": self.pyfile.package().password}) -- cgit v1.2.3