summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SimpleHoster.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-30 17:16:09 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-30 17:25:04 +0100
commit56ff5aff808975456163c027c670844baeebc2a8 (patch)
tree3e138b6ec339cfca8c65011590930a8a7b8a7dee /module/plugins/internal/SimpleHoster.py
parent[SimpleCrypter] Fix cookies support (diff)
downloadpyload-56ff5aff808975456163c027c670844baeebc2a8.tar.xz
[SimpleHoster] Fix checkTrafficLeft, ddl routine and cookies support
Diffstat (limited to 'module/plugins/internal/SimpleHoster.py')
-rw-r--r--module/plugins/internal/SimpleHoster.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index c47a715f0..de21f4d3c 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -166,7 +166,7 @@ def timestamp():
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.44"
+ __version__ = "0.45"
__pattern__ = None
@@ -233,19 +233,20 @@ class SimpleHoster(Hoster):
self.req.setOption("timeout", 120)
self.pyfile.url = replace_patterns(self.pyfile.url, self.FILE_URL_REPLACEMENTS)
- self.html = getURL(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES))
-
-
- def process(self, pyfile):
- self.prepare()
if self.CHECK_DIRECT_DOWNLOAD and self.premium:
- header = self.load(self.pyfile.url, just_header=True)
+ header = self.load(self.pyfile.url, just_header=True, decode=True)
if 'location' in header:
self.logDebug("Direct download link detected")
self.download(header['location'], ref=True, cookies=True, disposition=True)
return
+ self.html = self.load(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES))
+
+
+ def process(self, pyfile):
+ self.prepare()
+
premium_only = hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html)
if not premium_only: #: Usually premium only pages doesn't show the file information
self.getFileInfo()
@@ -340,11 +341,15 @@ class SimpleHoster(Hoster):
def checkTrafficLeft(self):
traffic = self.account.getAccountInfo(self.user, True)['trafficleft']
- if traffic == -1:
+
+ if traffic is None:
+ return False
+ elif traffic == -1:
return True
- size = self.pyfile.size / 1024
- self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size, self.user, traffic))
- return size <= traffic
+ else:
+ size = self.pyfile.size / 1024
+ self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size, self.user, traffic))
+ return size <= traffic
#@TODO: Remove in 0.4.10