From b97c7b1d4a6ca288cb945aa823e67685e6da234f Mon Sep 17 00:00:00 2001 From: Jeix Date: Tue, 3 Aug 2010 12:30:52 +0200 Subject: Container updated to new interface --- module/plugins/container/CCF.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'module/plugins/container/CCF.py') diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index 1e25ef623..87aeccebe 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- import re -import tempfile import urllib2 from module.plugins.Container import Container @@ -10,20 +9,16 @@ from module.network.MultipartPostHandler import MultipartPostHandler class CCF(Container): __name__ = "CCF" - __version__ = "0.1" + __version__ = "0.2" __pattern__ = r"(?!http://).*\.ccf" __description__ = """CCF Container Convert Plugin""" __author_name__ = ("Willnix") __author_mail__ = ("Willnix@pyload.org") - def __init__(self, parent): - Container.__init__(self, parent) - self.parent = parent - self.multi_dl = True - self.links = [] - - def proceed(self, url, location): - infile = url.replace("\n", "") + def decrypt(self, pyfile): + self.loadToDisk() + + infile = pyfile.url.replace("\n", "") opener = urllib2.build_opener(MultipartPostHandler) params = {"src": "ccf", @@ -31,11 +26,15 @@ class CCF(Container): "upload": open(infile, "rb")} tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read() - tempdlc = tempfile.NamedTemporaryFile(delete=False, suffix='.dlc') + download_folder = self.config['general']['download_folder'] + location = download_folder #join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding())) + if not exists(location): + makedirs(location) + + tempdlc_name = "tmp_%s.dlc" % join(location, pyfile.name) + tempdlc = open(tempdlc_name, "w") tempdlc.write(re.search(r'(.*)', tempdlc_content, re.DOTALL).group(1)) tempdlc.close() - self.links.append(tempdlc.name) - - return True + self.packages.append((tempdlc_name, [tempdlc_name], tempdlc_name)) -- cgit v1.2.3