diff options
author | mkaay <mkaay@mkaay.de> | 2010-05-07 17:31:29 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-05-07 17:31:29 +0200 |
commit | 4c6fbd8177a7499608b177d64297dc5117a8dd9a (patch) | |
tree | 903187b2fb69eabe3b6f59c31e2d9f245bdd0412 /module/plugins/hoster | |
parent | better rapidshare traffic share handling (diff) | |
download | pyload-4c6fbd8177a7499608b177d64297dc5117a8dd9a.tar.xz |
UploadedTo account plugin
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 24 |
2 files changed, 17 insertions, 12 deletions
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index c1f691af8..63058b044 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -43,7 +43,6 @@ class RapidshareCom(Hoster): self.start_dl = False def prepare(self, thread): - self.req.clear_cookies() self.no_slots = True self.want_reconnect = False @@ -53,9 +52,9 @@ class RapidshareCom(Hoster): if self.usePremium: info = self.account.getAccountInfo(self.account.getAccountData(self)[0]) - self.logger.info(_("Rapidshare: Use Premium Account (%sGB left)") % (info["trafficleft"]/1024/1024)) + self.logger.info(_("%s: Use Premium Account (%sGB left)") % (self.__name__, info["trafficleft"]/1024/1024)) if self.api_data["size"] / 1024 > info["trafficleft"]: - self.logger.info(_("Rapidshare: Not enough traffic left")) + self.logger.info(_("%s: Not enough traffic left" % self.__name__)) self.usePremium = False else: self.pyfile.status.url = self.parent.url diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 43f54c099..1ac277447 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -24,7 +24,8 @@ class UploadedTo(Hoster): self.read_config() self.account = None self.multi_dl = False - if self.config['premium']: + self.usePremium = self.config['premium'] + if self.usePremium: self.account = self.parent.core.pluginManager.getAccountPlugin(self.__name__) req = self.account.getAccountRequest(self) if req: @@ -32,7 +33,7 @@ class UploadedTo(Hoster): self.multi_dl = True self.req.canContinue = True else: - self.config['premium'] = False + self.usePremium = False self.start_dl = False @@ -41,7 +42,6 @@ class UploadedTo(Hoster): tries = 0 while not self.pyfile.status.url: - #self.req.clear_cookies() self.download_html() self.pyfile.status.exists = self.file_exists() @@ -53,9 +53,15 @@ class UploadedTo(Hoster): self.pyfile.status.filename = self.get_file_name() - if self.config['premium']: - self.pyfile.status.url = self.parent.url - return True + if self.usePremium: + info = self.account.getAccountInfo(self.account.getAccountData(self)[0]) + self.logger.info(_("%s: Use Premium Account (%sGB left)") % (self.__name__, info["trafficleft"]/1024/1024)) + if self.api_data["size"] > info["trafficleft"]: + self.logger.info(_("%s: Not enough traffic left" % self.__name__)) + self.usePremium = False + else: + self.pyfile.status.url = self.parent.url + return True self.get_waiting_time() @@ -82,7 +88,7 @@ class UploadedTo(Hoster): self.api_data = {} lines = src.splitlines() self.api_data["filename"] = lines[0] - self.api_data["size"] = lines[1] # in kbytes + self.api_data["size"] = int(lines[1]) # in kbytes self.api_data["checksum"] = lines[2] #sha1 def download_html(self): @@ -99,7 +105,7 @@ class UploadedTo(Hoster): self.time_plus_wait = 0 def get_file_url(self): - if self.config['premium']: + if self.usePremium: self.start_dl = True return self.parent.url try: @@ -134,7 +140,7 @@ class UploadedTo(Hoster): return url def proceed(self, url, location): - if self.config['premium']: + if self.usePremium: self.load(url, cookies=True, just_header=True) if self.cleanUrl(self.req.lastEffectiveURL) == self.cleanUrl(url): self.logger.info(_("UploadedTo indirect download")) |