diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-18 22:19:25 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-18 22:19:25 +0100 |
commit | d89e6a0eda653f45090c0265aa724bfd011a2ca8 (patch) | |
tree | db8cdc153950fa13a0da6efc99ae602d3ccded76 | |
parent | netfolder, hotfile fix, filesonic/sharingmatrix beta (diff) | |
download | pyload-d89e6a0eda653f45090c0265aa724bfd011a2ca8.tar.xz |
new cryptit plugin
-rw-r--r-- | module/network/HTTPChunk.py | 11 | ||||
-rw-r--r-- | module/plugins/Crypter.py | 7 | ||||
-rw-r--r-- | module/plugins/crypter/CryptItCom.py | 40 |
3 files changed, 29 insertions, 29 deletions
diff --git a/module/network/HTTPChunk.py b/module/network/HTTPChunk.py index c4bf1d64c..9ca1be909 100644 --- a/module/network/HTTPChunk.py +++ b/module/network/HTTPChunk.py @@ -20,6 +20,7 @@ from os import remove from os.path import exists from time import sleep from re import search +from logging import getLogger import pycurl @@ -131,6 +132,8 @@ class HTTPChunk(HTTPRequest): self.BOMChecked = False # check and remove byte order mark + self.log = getLogger("log") + @property def cj(self): return self.p.cj @@ -150,17 +153,17 @@ class HTTPChunk(HTTPRequest): if self.range: #do nothing if chunk already finished - if not self.arrived + self.range[0] - self.range[1]: return None + if self.arrived + self.range[0] >= self.range[1]: return None if self.id == len(self.p.info.chunks) - 1: #as last chunk dont set end range, so we get everything range = "%i-" % (self.arrived + self.range[0]) else: range = "%i-%i" % (self.arrived + self.range[0], min(self.range[1] + 1, self.p.size - 1)) - print "Chunked resume with range %s" % range + self.log.debug("Chunked resume with range %s" % range) self.c.setopt(pycurl.RANGE, range) else: - print "Resume File from %i" % self.arrived + self.log.debug("Resume File from %i" % self.arrived) self.c.setopt(pycurl.RESUME_FROM, self.arrived) else: @@ -170,7 +173,7 @@ class HTTPChunk(HTTPRequest): else: range = "%i-%i" % (self.range[0], min(self.range[1] + 1, self.p.size - 1)) - print "Chunked with range %s" % range + self.log.debug("Chunked with range %s" % range) self.c.setopt(pycurl.RANGE, range) self.fp = open(self.p.info.getChunkName(self.id), "wb") diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index 0cff3bf1c..ae8fef9e4 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -60,7 +60,10 @@ class Crypter(Plugin): """ create new packages from self.packages """ for pack in self.packages: - self.log.debug(_("Parsed package %(name)s with %(len)d links") % { "name" : pack[0], "len" : len(pack[1]) } ) + self.log.debug("Parsed package %(name)s with %(len)d links" % { "name" : pack[0], "len" : len(pack[1]) } ) - self.core.server_methods.add_package(pack[0], pack[1], self.pyfile.package().queue) + pid = self.core.server_methods.add_package(pack[0], pack[1], self.pyfile.package().queue) + + if self.pyfile.package().password: + self.core.server_methods.set_package_data(pid, {"password": self.pyfile.package().password}) diff --git a/module/plugins/crypter/CryptItCom.py b/module/plugins/crypter/CryptItCom.py index 4dff06b21..6d3e8d433 100644 --- a/module/plugins/crypter/CryptItCom.py +++ b/module/plugins/crypter/CryptItCom.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- -import tempfile + import re -from os import remove -import os.path -from time import time +from random import randint + from module.plugins.Crypter import Crypter @@ -18,27 +17,22 @@ class CryptItCom(Crypter): __author_name__ = ("jeix") __author_mail__ = ("jeix@hasnomail.de") - def __init__(self, parent): - Crypter.__init__(self, parent) - self.parent = parent - def file_exists(self): - html = self.load(self.parent.url) + html = self.load(self.pyfile.url) if r'<div class="folder">Was ist Crypt-It</div>' in html: return False - return True - - def proceed(self, url, location): + return True + + def decrypt(self, pyfile): + if not self.file_exists(): + self.offline() + + # @TODO parse name and password repl_pattern = r"/(s|e|d|c)/" - url = re.sub(repl_pattern, r"/d/", url) - - # download ccf - file_name = os.path.join(tempfile.gettempdir(), "pyload_tmp_%d.ccf"%time()) - file_name = self.req.download(url, file_name) - if file_name == "redir.ccf": - remove(file_name) - raise Exception, _("File not found") - - # and it to package - self.links = [file_name] + url = re.sub(repl_pattern, r"/d/", self.pyfile.url) + + pyfile.name = "cryptit_%s_tmp.ccf" % randint(0,1000) + location = self.download(url) + + self.packages.append(["Crypt-it Package", [location], "Crypt-it Package"])
\ No newline at end of file |