diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-04 17:48:45 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-04 17:48:45 +0100 |
commit | 108a7a3a554806394b7fe055f4a9f40f47c230ef (patch) | |
tree | 19acf37dfbb1f8be0ae3c281a73a4bf0e1f1b604 | |
parent | share-online, try fix (diff) | |
download | pyload-108a7a3a554806394b7fe055f4a9f40f47c230ef.tar.xz |
files.mail.ru improvement
-rw-r--r-- | module/plugins/Plugin.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/FilesMailRu.py | 44 | ||||
-rw-r--r-- | module/web/media/default/css/window.css | 2 |
3 files changed, 27 insertions, 25 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 502f7bc24..b1cedb341 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -343,7 +343,7 @@ class Plugin(object): self.lastDownload = join(location, name) return self.lastDownload - def checkDownload(self, rules, api_size=0 ,max_size=50000, delete=True): + def checkDownload(self, rules, api_size=0 ,max_size=50000, delete=True, read_size=0): """ checks the content of the last downloaded file rules - dict with names and rules to match(re or strings) size - excpected size @@ -355,10 +355,10 @@ class Plugin(object): size = size.st_size if api_size and api_size <= size: return None - elif size > max_size: return None + elif size > max_size and not read_size: return None self.log.debug("Download Check triggered") f = open(self.lastDownload, "rb") - content = f.read() + content = f.read(read_size if read_size else -1) f.close() self.log.debug("Content: %s" % content) for name, rule in rules.iteritems(): diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index cb180a858..ce939587d 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -4,28 +4,29 @@ import re from module.plugins.Hoster import Hoster from module.network.Request import getURL - +from module.plugins.Plugin import chunks def getInfo(urls): result = [] - for url in urls: - src = getURL(url) - if r'<div class="errorMessage mb10">' in src: - result.append(url, 0, 1, url) - elif r'Page cannot be displayed' in src: - result.append(url, 0, 1, url) - else: - try: - url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' - file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0] - result.append(file_name, 0, 2, url) - except: - result.append(url, 0, 1, url) - - - # status 1=OFFLINE, 2=OK, 3=UNKNOWN - # result.append(#name,#size,#status,#url) - yield result + for chunk in chunks(urls, 10): + for url in chunk: + src = getURL(url) + if r'<div class="errorMessage mb10">' in src: + result.append((url, 0, 1, url)) + elif r'Page cannot be displayed' in src: + result.append((url, 0, 1, url)) + else: + try: + url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' + file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0] + result.append((file_name, 0, 2, url)) + except: + pass + + + # status 1=OFFLINE, 2=OK, 3=UNKNOWN + # result.append((#name,#size,#status,#url)) + yield result class FilesMailRu(Hoster): __name__ = "FilesMailRu" @@ -84,7 +85,8 @@ class FilesMailRu(Hoster): # The maximum UploadSize allowed on files.mail.ru at the moment is 100MB # so i set it to check every download because sometimes there are downloads # that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file - check = self.checkDownload({"empty": "<meta name="}, max_size=110000000) - if check == "empty": + # (Loading 100MB in to ram is not an option) + check = self.checkDownload({"html": "<meta name="}, read_size=50000) + if check == "html": self.log.info(_("There was HTML Code in the Downloaded File("+ filename +")...redirect error? The Download will be restarted.")) self.retry() diff --git a/module/web/media/default/css/window.css b/module/web/media/default/css/window.css index 8b13ab798..dfe62a1f3 100644 --- a/module/web/media/default/css/window.css +++ b/module/web/media/default/css/window.css @@ -7,7 +7,7 @@ left:50%;
top:150px;
margin-left: -350px;
- position: fixed;
+ position: absolute;
background: #FFF;
display:none;
}
|