diff options
author | Gregy <gregy@gregy.cz> | 2010-08-08 23:05:47 +0200 |
---|---|---|
committer | Gregy <gregy@gregy.cz> | 2010-08-08 23:05:47 +0200 |
commit | a574e7e732af4efa66f5ad69354065f28a218392 (patch) | |
tree | d44b577dec85415305a7853161ab533d51211f6d | |
parent | NetloadIn partial rewrite (issues fix, implemented info prefetch) (diff) | |
parent | MU link checker (diff) | |
download | pyload-a574e7e732af4efa66f5ad69354065f28a218392.tar.xz |
merge
-rw-r--r-- | module/FileDatabase.py | 6 | ||||
-rwxr-xr-x | module/network/Request.py | 4 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 2 | ||||
-rw-r--r-- | module/plugins/container/CCF.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 44 | ||||
-rw-r--r-- | module/plugins/hoster/MyvideoDe.py | 18 |
6 files changed, 58 insertions, 20 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index 98d75d58e..3ede67a98 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -163,9 +163,6 @@ class FileHandler: p = self.getPackage(id) e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") - if self.packageCache.has_key(id): - del self.packageCache[id] - pyfiles = self.cache.values() for pyfile in pyfiles: @@ -176,6 +173,9 @@ class FileHandler: self.db.deletePackage(p) self.core.pullManager.addEvent(e) + if self.packageCache.has_key(id): + del self.packageCache[id] + self.lock.release() #---------------------------------------------------------------------- diff --git a/module/network/Request.py b/module/network/Request.py index d1964d87f..7413358d7 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -378,12 +378,12 @@ class Request: except: pass -def getURL(url): +def getURL(url, get={}, post={}): """ currently used for update check """ req = Request() - c = req.load(url) + c = req.load(url, get, post) req.pycurl.close() return c diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 8392486f1..aa4aff171 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -69,8 +69,6 @@ class Plugin(object): self.config = pyfile.m.core.config self.core = pyfile.m.core - self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) - self.wantReconnect = False self.multiDL = True diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index a18a7c309..8b35589f3 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -8,7 +8,7 @@ from module.plugins.Container import Container from module.network.MultipartPostHandler import MultipartPostHandler from os import makedirs -from os.path import exists +from os.path import exists, join class CCF(Container): __name__ = "CCF" @@ -33,7 +33,7 @@ class CCF(Container): if not exists(location): makedirs(location) - tempdlc_name = "tmp_%s.dlc" % join(location, pyfile.name) + tempdlc_name = join(location, "tmp_%s.dlc" % pyfile.name) tempdlc = open(tempdlc_name, "w") tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1)) tempdlc.close() diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 06a25f44b..a1eaf6cc5 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -8,6 +8,44 @@ from time import time from module.plugins.Hoster import Hoster +from module.network.Request import getURL + +def getInfo(urls): + url = "http://megaupload.com/mgr_linkcheck.php" + + ids = [x.split("=")[-1] for x in urls] + + i = 0 + post = {} + for id in ids: + post["id%i"%i] = id + i += 1 + + api = getURL(url, {}, post) + api = [x.split("&") for x in re.split(r"&?(?=id[\d]+=)", api)] + + result = [] + i=0 + for data in api: + if data[0].startswith("id"): + tmp = [x.split("=") for x in data] + if tmp[2][1] == "3": + status = 3 + elif tmp[0][1] == "0": + status = 2 + elif tmp[0][1] == "1": + status = 1 + else: + status = 3 + + name = tmp[3][1] + size = tmp[1][1] + + result.append( (name, size, status, urls[i] ) ) + i += 1 + + yield result + class MegauploadCom(Hoster): __name__ = "MegauploadCom" __type__ = "hoster" @@ -33,16 +71,14 @@ class MegauploadCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) - def download_html(self): - captcha_image = tempfile.NamedTemporaryFile(suffix=".gif").name - + def download_html(self): for i in range(5): self.html[0] = self.load(self.pyfile.url) try: url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1) except: continue - self.pyfile.status.waituntil = time() + 10 + captcha = self.decryptCaptcha(url_captcha_html) captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1) megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1) diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index 5412fd570..f2d2082a7 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -2,6 +2,7 @@ import re from module.plugins.Hoster import Hoster +from module.unescape import unescape class MyvideoDe(Hoster): __name__ = "MyvideoDe" @@ -12,14 +13,17 @@ class MyvideoDe(Hoster): __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") - def __init__(self, parent): - Hoster.__init__(self, parent) - self.parent = parent + def setup(self): self.html = None - self.url = self.parent.url + + def process(self, pyfile): + self.pyfile = pyfile + self.download_html() + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) def download_html(self): - self.html = self.load(self.url) + self.html = self.load(self.pyfile.url) def get_file_url(self): videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1) @@ -29,11 +33,11 @@ class MyvideoDe(Hoster): def get_file_name(self): file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>" - return re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv' + return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') def file_exists(self): self.download_html() - self.load(str(self.url), cookies=False, just_header=True) + self.load(str(self.pyfile.url), cookies=False, just_header=True) if self.req.lastEffectiveURL == "http://www.myvideo.de/": return False return True |