diff options
| author | 2010-08-03 12:30:52 +0200 | |
|---|---|---|
| committer | 2010-08-03 12:30:52 +0200 | |
| commit | b97c7b1d4a6ca288cb945aa823e67685e6da234f (patch) | |
| tree | 7ed065805b3fbc1a5669f782fe42cbbcf6ab0b5b /module | |
| parent | new dlc plugins (diff) | |
| download | pyload-b97c7b1d4a6ca288cb945aa823e67685e6da234f.tar.xz | |
Container updated to new interface
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/Container.py | 43 | ||||
| -rw-r--r-- | module/plugins/Crypter.py | 26 | ||||
| -rw-r--r-- | module/plugins/container/CCF.py | 27 | ||||
| -rw-r--r-- | module/plugins/container/RSDF.py | 18 | 
4 files changed, 68 insertions, 46 deletions
| diff --git a/module/plugins/Container.py b/module/plugins/Container.py index 729dc11e1..9f0b28884 100644 --- a/module/plugins/Container.py +++ b/module/plugins/Container.py @@ -29,3 +29,46 @@ class Container(Crypter):      __description__ = """Base container plugin"""      __author_name__ = ("mkaay")      __author_mail__ = ("mkaay@mkaay.de") + +     +         +    #---------------------------------------------------------------------- +    def preprocessing(self, thread): +        """prepare""" +        self.thread = thread + +        self.decrypt(self.pyfile) +        self.deleteTmp() +         +        self.createPackages() +     +     +    #---------------------------------------------------------------------- +    def loadToDisk(self): +        """loads container to disk if its stored remotely and overwrite url,  +        or check existent on several places at disk""" +         +        if self.pyfile.url.startswith("http://"): +            self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] +            content = self.load(self.pyfile.url) +            self.pyfile.url = join(self.config["general"]["download_folder"], self.pyfile.name) +            f = open(self.pyfile.url, "wb" ) +            f.write(content) +            f.close() +             +        else: +            self.pyfile.name = basename(self.pyfile.url) +            if not exists(self.pyfile.url): +                if exists(join(pypath, self.pyfile.url)): +                    self.pyfile.url = join(pypath, self.pyfile.url) +                else: +                    self.fail(_("File not exists.")) +       + +       +    #---------------------------------------------------------------------- +    def deleteTmp(self): +        if self.pyfile.name.startswith("tmp_"): +            os.remove(self.pyfile.url) + +        
\ No newline at end of file diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index a14a51e79..aaf003063 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -33,7 +33,9 @@ class Crypter(Plugin):      def __init__(self, pyfile):          Plugin.__init__(self, pyfile) -        self.packages = [] #put all packages here [ .. (name, folder, [urls]) ..] +        """ Put all packages here. It's a list of tuples like: +        ( name, [list of links], folder ) """ +        self.packages = []      #----------------------------------------------------------------------      def preprocessing(self, thread): @@ -44,28 +46,6 @@ class Crypter(Plugin):          self.createPackages() -     -    #---------------------------------------------------------------------- -    def loadToDisk(self): -        """loads container to disk if its stored remotely and overwrite url,  -        or check existent on several places at disk""" -         -        if self.pyfile.url.startswith("http://"): -            self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] -            content = self.load(self.pyfile.url) -            self.pyfile.url = join(self.config["general"]["download_folder"], self.pyfile.name) -            f = open(self.pyfile.url, "wb" ) -            f.write(content) -            f.close() -             -        else: -            self.pyfile.name = basename(self.pyfile.url) -            if not exists(self.pyfile.url): -                if exists(join(pypath, self.pyfile.url)): -                    self.pyfile.url = join(pypath, self.pyfile.url) -                else: -                    self.fail(_("File not exists.")) -              #----------------------------------------------------------------------      def createPackages(self): 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'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1))          tempdlc.close() -        self.links.append(tempdlc.name) - -        return True +        self.packages.append((tempdlc_name, [tempdlc_name], tempdlc_name)) diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py index c906fe05a..ebd41d279 100644 --- a/module/plugins/container/RSDF.py +++ b/module/plugins/container/RSDF.py @@ -14,16 +14,13 @@ class RSDF(Container):      __author_name__ = ("RaNaN", "spoob")      __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") -    def __init__(self, parent): -        Container.__init__(self, parent) -        self.parent = parent -        self.multi_dl = True -        self.links = [] - -    def proceed(self, url, location): +     +    def decrypt(self, pyfile): +        self.loadToDisk() +              from Crypto.Cipher import AES -        infile = url.replace("\n", "") +        infile = pyfile.url.replace("\n", "")          Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000')          IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') @@ -38,10 +35,13 @@ class RSDF(Container):          data = binascii.unhexlify(''.join(data.split()))          data = data.splitlines() +        links = []          for link in data:              link = base64.b64decode(link)              link = obj.decrypt(link)              decryptedUrl = link.replace('CCF: ', '') -            self.links.append(decryptedUrl) +            links.append(decryptedUrl)          rsdf.close() +         +        self.packages.append((pyfile.name, links, pyfile.name)) | 
