From 835e3a576051d9efb558bfcb7964947ab289c255 Mon Sep 17 00:00:00 2001 From: spoob Date: Tue, 13 Apr 2010 18:54:55 +0200 Subject: Pack Fixes --- module/Plugin.py | 14 ++++++++------ module/plugins/hoster/DepositfilesCom.py | 2 +- module/plugins/hoster/DuckloadCom.py | 8 ++------ module/plugins/hoster/FilefactoryCom.py | 7 +++---- module/plugins/hoster/FilesmonsterCom.py | 13 +++++-------- module/plugins/hoster/FreakshareNet.py | 6 +++--- module/plugins/hoster/GigasizeCom.py | 10 +++------- module/plugins/hoster/HotfileCom.py | 4 ++-- module/plugins/hoster/MegauploadCom.py | 6 +++--- module/plugins/hoster/MyvideoDe.py | 4 ++-- module/plugins/hoster/RapidshareCom.py | 10 +++++----- module/plugins/hoster/ShareonlineBiz.py | 10 +++++----- module/plugins/hoster/ShragleCom.py | 4 ++-- module/plugins/hoster/StorageTo.py | 7 ++----- module/plugins/hoster/XupIn.py | 4 ++-- module/plugins/hoster/YoupornCom.py | 2 +- module/plugins/hoster/YoutubeCom.py | 2 +- module/plugins/hoster/ZippyshareCom.py | 6 +----- module/plugins/hoster/ZshareNet.py | 4 ++-- 19 files changed, 53 insertions(+), 70 deletions(-) diff --git a/module/Plugin.py b/module/Plugin.py index 4f6b1b39a..fd230c400 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -23,6 +23,7 @@ from os.path import exists from os.path import join from time import sleep +import sys from module.network.Request import Request from os import makedirs @@ -52,9 +53,9 @@ class Plugin(): self.ocr = None #captcha reader instance self.logger = logging.getLogger("log") self.decryptNow = True - - def prepare(self, thread): self.pyfile = self.parent + + def prepare(self, thread): self.want_reconnect = False self.pyfile.status.exists = self.file_exists() @@ -170,12 +171,13 @@ class Plugin(): return self.req.load(url, get, post, ref, cookies, just_header) def download(self, url, file_name, get={}, post={}, ref=True, cookies=True): - if self.pyfile.package.data["package_name"] != "links.txt": + download_folder = self.parent.core.config['general']['download_folder'] + if self.pyfile.package.data["package_name"] != (self.parent.core.config['general']['link_file']): self.pyfile.folder = self.pyfile.package.data["package_name"] - location = join("Downloads", self.pyfile.folder) + location = join(download_folder, self.pyfile.folder.decode(sys.getfilesystemencoding())) makedirs(location) - file_path = join(location, self.pyfile.status.filename) + file_path = join(location.decode(sys.getfilesystemencoding()), self.pyfile.status.filename.decode(sys.getfilesystemencoding())) else: - file_path = join("Downloads", self.pyfile.status.filename) + file_path = join(download_folder, self.pyfile.status.filename.decode(sys.getfilesystemencoding())) self.pyfile.status.filename = self.req.download(url, file_path, get, post, ref, cookies) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 11c202013..b5ab5c6f7 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -29,7 +29,7 @@ class DepositfilesCom(Plugin): return re.search('File name: ', self.html).group(1) def file_exists(self): - self.html = self.req.load(self.parent.url) + self.html = self.load(self.parent.url) if re.search(r"Such file does not exist or it has been removed for infringement of copyrights", self.html) != None: return False return True diff --git a/module/plugins/hoster/DuckloadCom.py b/module/plugins/hoster/DuckloadCom.py index 7482fe617..31b7d112b 100644 --- a/module/plugins/hoster/DuckloadCom.py +++ b/module/plugins/hoster/DuckloadCom.py @@ -47,8 +47,8 @@ class DuckloadCom(Plugin): def download_html(self): url = self.parent.url - self.html[0] = self.req.load(url, cookies=True) - self.html[1] = self.req.load(url, cookies=True, post={"server": "1", "sn": "Stream Starten"}) + self.html[0] = self.load(url) + self.html[1] = self.load(url, post={"server": "1", "sn": "Stream Starten"}) def get_file_url(self): """ returns the absolute downloadable filepath @@ -80,7 +80,3 @@ class DuckloadCom(Plugin): return False else: return True - - def proceed(self, url, location): - self.req.download(url, location, cookies=True) - diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 873fb548e..0125d442e 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -50,9 +50,9 @@ class FilefactoryCom(Plugin): def download_html(self): url = self.parent.url - self.html = self.req.load(url, cookies=True) + self.html = self.load(url, cookies=True) tempurl = re.search('a href=\"(.*?)\".*?button\.basic\.jpg', self.html).group(1) - self.htmlwithlink = self.req.load("http://www.filefactory.com"+tempurl, cookies=True) + self.htmlwithlink = self.load("http://www.filefactory.com"+tempurl, cookies=True) def get_file_url(self): """ returns the absolute downloadable filepath @@ -97,6 +97,5 @@ class FilefactoryCom(Plugin): return True def proceed(self, url, location): - - self.req.download(url, location, cookies=True) + self.download(url, location, cookies=True) diff --git a/module/plugins/hoster/FilesmonsterCom.py b/module/plugins/hoster/FilesmonsterCom.py index 27c687363..99a2ccd57 100644 --- a/module/plugins/hoster/FilesmonsterCom.py +++ b/module/plugins/hoster/FilesmonsterCom.py @@ -38,7 +38,7 @@ class FilesmonsterCom(Plugin): def download_html(self): self.url = self.parent.url - self.html = self.req.load(self.url) # get the start page + self.html = self.load(self.url) # get the start page def get_file_url(self): """ returns the absolute downloadable filepath @@ -62,8 +62,6 @@ class FilesmonsterCom(Plugin): return self.parent.url def file_exists(self): - """ returns True or False - """ if self.html == None: self.download_html() if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None: @@ -73,15 +71,15 @@ class FilesmonsterCom(Plugin): def get_download_page(self): herewego = re.findall(r"\s*\n\s*", self.html) - the_download_page = self.req.load("http://filesmonster.com/get/free/", None, herewego) + the_download_page = self.load("http://filesmonster.com/get/free/", None, herewego) temporary_filtered = re.search(r"\s*\n(\s*\s*\n)*?\s*", the_download_page).group(0) all_the_tuples = re.findall(r"", herewego) request_options = list() @@ -140,4 +140,4 @@ class FreakshareNet(Plugin): temp_response = temp_conn.getresponse() new_url = temp_response.getheader("Location") # we need the Location-header temp_conn.close - self.req.download(new_url, location, None, None, cookies=False) + self.download(new_url, location, cookies=False) diff --git a/module/plugins/hoster/GigasizeCom.py b/module/plugins/hoster/GigasizeCom.py index e22fe8593..a14e17bf8 100644 --- a/module/plugins/hoster/GigasizeCom.py +++ b/module/plugins/hoster/GigasizeCom.py @@ -29,14 +29,14 @@ class GigasizeCom(Plugin): def download_html(self): url = self.parent.url - self.html[0] = self.req.load(url, cookies=True) + self.html[0] = self.load(url, cookies=True) captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name for i in range(5): - self.req.download("http://www.gigasize.com/randomImage.php", captcha_image, cookies=True) + self.download("http://www.gigasize.com/randomImage.php", captcha_image, cookies=True) captcha = self.ocr.get_captcha(captcha_image) - self.html[1] = self.req.load("http://www.gigasize.com/formdownload.php", None, {"txtNumber": captcha}, cookies=True) + self.html[1] = self.load("http://www.gigasize.com/formdownload.php", None, {"txtNumber": captcha}, cookies=True) if re.search(r"Package features", self.html[1]) != None: if re.search(r"YOU HAVE REACHED YOUR HOURLY LIMIT", self.html[1]) != None: @@ -78,7 +78,3 @@ class GigasizeCom(Plugin): return False else: return True - - def proceed(self, url, location): - print url - print self.req.load(url, cookies=True) diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 38e7caca8..d412ddd23 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -61,7 +61,7 @@ class HotfileCom(Plugin): self.req.add_auth(self.config['username'], self.config['password']) self.url = self.parent.url + "?lang=en" print self.url - self.html[0] = self.req.load(self.url, cookies=True) + self.html[0] = self.load(self.url, cookies=True) def get_file_url(self): if self.config['premium']: @@ -70,7 +70,7 @@ class HotfileCom(Plugin): else: form_content = re.search(r"
\s*)*?\n", self.html[0]).group(0) form_posts = re.findall(r"", form_content) - self.html[1] = self.req.load(self.url, post=form_posts, cookies=True) + self.html[1] = self.load(self.url, post=form_posts, cookies=True) file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.html[1]).group(1) return file_url diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index deeedc691..a544775d4 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -31,14 +31,14 @@ class MegauploadCom(Plugin): captcha_image = tempfile.NamedTemporaryFile(suffix=".gif").name for i in range(5): - self.html[0] = self.req.load(self.parent.url, cookies=True) + self.html[0] = self.load(self.parent.url, cookies=True) url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1) - self.req.download(url_captcha_html, captcha_image, cookies=True) + self.download(url_captcha_html, captcha_image, cookies=True) captcha = self.ocr.get_captcha(captcha_image) os.remove(captcha_image) captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1) megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1) - self.html[1] = self.req.load(self.parent.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}, cookies=True) + self.html[1] = self.load(self.parent.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}, cookies=True) if re.search(r"Waiting time before each download begins", self.html[1]) != None: break self.time_plus_wait = time() + 45 diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index 0fe315547..365cca59c 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -20,7 +20,7 @@ class MyvideoDe(Plugin): self.url = self.parent.url def download_html(self): - self.html = self.req.load(self.url) + self.html = self.load(self.url) def get_file_url(self): videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1) @@ -34,7 +34,7 @@ class MyvideoDe(Plugin): def file_exists(self): self.download_html() - self.req.load(str(self.url), cookies=False, just_header=True) + self.load(str(self.url), cookies=False, just_header=True) if self.req.lastEffectiveURL == "http://www.myvideo.de/": return False return True diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 856f06529..506cee6c1 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -80,7 +80,7 @@ class RapidshareCom(Plugin): if m: api_param_file["files"] = m.group(1) api_param_file["filenames"] = m.group(2) - src = self.req.load(api_url_base, cookies=False, get=api_param_file) + src = self.load(api_url_base, cookies=False, get=api_param_file) if src.startswith("ERROR"): return fields = src.split(",") @@ -108,7 +108,7 @@ class RapidshareCom(Plugin): if self.config["premium"]: api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", \ "login": self.config['username'], "password": self.config['password']} - src = self.req.load(api_url_base, cookies=False, get=api_param_prem) + src = self.load(api_url_base, cookies=False, get=api_param_prem) if src.startswith("ERROR"): self.config["premium"] = False self.logger.info("Rapidshare: Login failed") @@ -125,13 +125,13 @@ class RapidshareCom(Plugin): def download_html(self): """ gets the url from self.parent.url saves html in self.html and parses """ - self.html[0] = self.req.load(self.url, cookies=True) + self.html[0] = self.load(self.url, cookies=True) def get_wait_time(self): """downloads html with the important informations """ file_server_url = re.search(r"Downloading:(.*?)(.*?)" return re.search(file_name_pattern, self.html).group(1).strip() - - def proceed(self, url, location): - self.req.download(url, location, cookies=True) diff --git a/module/plugins/hoster/XupIn.py b/module/plugins/hoster/XupIn.py index 2a914b3d5..f48a3e944 100644 --- a/module/plugins/hoster/XupIn.py +++ b/module/plugins/hoster/XupIn.py @@ -36,10 +36,10 @@ class XupIn(Plugin): return re.search(file_name_pattern, self.html).group(1) def file_exists(self): - self.html = self.req.load(self.url) + self.html = self.load(self.url) if re.search(r"File does not exist", self.html) != None or self.html == "": return False return True def proceed(self, url, location): - self.req.download(url, location, post=self.posts) + self.download(url, location, post=self.posts) diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index e501954da..db9cdb85f 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -33,7 +33,7 @@ class YoupornCom(Plugin): def download_html(self): url = self.parent.url - self.html = self.req.load(url) + self.html = self.load(url) def get_file_url(self): """ returns the absolute downloadable filepath diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 5f3874640..a3185872d 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -24,7 +24,7 @@ class YoutubeCom(Plugin): def download_html(self): url = self.parent.url - self.html = self.req.load(url) + self.html = self.load(url) def get_file_url(self): """ returns the absolute downloadable filepath diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index bec7f8c65..577d036ea 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -25,7 +25,7 @@ class ZippyshareCom(Plugin): def download_html(self): url = self.parent.url - self.html = self.req.load(url, cookies=True) + self.html = self.load(url, cookies=True) def get_file_url(self): """ returns the absolute downloadable filepath @@ -53,7 +53,3 @@ class ZippyshareCom(Plugin): return False else: return True - - def proceed(self, url, location): - - self.req.download(url, location, cookies=True) diff --git a/module/plugins/hoster/ZshareNet.py b/module/plugins/hoster/ZshareNet.py index 08f28a35c..c3de0e475 100644 --- a/module/plugins/hoster/ZshareNet.py +++ b/module/plugins/hoster/ZshareNet.py @@ -27,14 +27,14 @@ class ZshareNet(Plugin): def download_html(self): url = self.parent.url - self.html[0] = self.req.load(url) + self.html[0] = self.load(url) if "/video/" in url: url = url.replace("/video/", "/download/") elif "/audio/" in url: url = url.replace("/audio/", "/download/") elif "/image/" in url: url = url.replace("/image/", "/download/") - self.html[1] = self.req.load(url, None, {"download": "1"}) + self.html[1] = self.load(url, None, {"download": "1"}) def get_file_url(self): """ returns the absolute downloadable filepath -- cgit v1.2.3