summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SimpleHoster.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-10 16:01:38 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-10 16:01:38 +0100
commit502c1437e838282aa56a286bb3751382c3aaf65e (patch)
tree088f89ac569dc928e8c478bf4163a2595b6b0510 /module/plugins/internal/SimpleHoster.py
parent[MultiHoster] Fix filename recognition (diff)
downloadpyload-502c1437e838282aa56a286bb3751382c3aaf65e.tar.xz
Improve getInfo
Diffstat (limited to 'module/plugins/internal/SimpleHoster.py')
-rw-r--r--module/plugins/internal/SimpleHoster.py40
1 files changed, 23 insertions, 17 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 1a2961167..fb19b8725 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -183,7 +183,7 @@ def secondsToMidnight(gmt=0):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.92"
+ __version__ = "0.93"
__pattern__ = r'^unmatchable$'
@@ -264,7 +264,7 @@ class SimpleHoster(Hoster):
or urlparse(url).query.split('=', 1)[::-1][0].split('&', 1)[0]
or _("Unknown")),
'size' : 0,
- 'status': 3,
+ 'status': 3 if url else 8,
'url' : url}
@@ -462,6 +462,10 @@ class SimpleHoster(Hoster):
def checkErrors(self):
+ if not self.html:
+ self.logWarning(_("No html code to check"))
+ return
+
if hasattr(self, 'PREMIUM_ONLY_PATTERN') and self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html):
self.fail(_("Link require a premium account to be handled"))
@@ -483,42 +487,44 @@ class SimpleHoster(Hoster):
def checkStatus(self, getinfo=True):
- if getinfo:
+ if not self.info or getinfo:
self.logDebug("File info (BEFORE): %s" % self.info)
self.info.update(self.getInfo(self.pyfile.url, self.html))
- if 'status' not in self.info:
- return
+ try:
+ status = self.info['status']
- status = self.info['status']
+ if status is 1:
+ self.offline()
- if status is 1:
- self.offline()
+ elif status is 6:
+ self.tempOffline()
- elif status is 6:
- self.tempOffline()
+ elif status is 8:
+ self.fail()
- elif status is not 2:
+ finally:
self.logDebug("File status: %s" % statusMap[status],
"File info: %s" % self.info)
def checkNameSize(self, getinfo=True):
- if getinfo:
+ if not self.info or getinfo:
self.logDebug("File info (BEFORE): %s" % self.info)
self.info.update(self.getInfo(self.pyfile.url, self.html))
self.logDebug("File info (AFTER): %s" % self.info)
try:
- name = self.info['name']
- size = self.info['size']
url = self.info['url']
-
+ name = self.info['name']
if name and name != url:
self.pyfile.name = name
- else:
- self.pyfile.name = name = self.info['name'] = urlparse(name).path.split('/')[-1]
+ except Exception:
+ pass
+
+ try:
+ size = self.info['size']
if size > 0:
self.pyfile.size = size