summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SimpleHoster.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal/SimpleHoster.py')
-rw-r--r--module/plugins/internal/SimpleHoster.py33
1 files changed, 15 insertions, 18 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index feb373541..b9ac84783 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -92,14 +92,14 @@ def parseHtmlForm(attr_str, html, input_names=None):
def parseFileInfo(self, url="", html=""):
- info = {'name': url, 'size': 0, 'status': 3}
-
if not url and hasattr(self, "pyfile"):
url = self.pyfile.url
+ info = {'name': url, 'size': 0, 'status': 3}
+
if not html:
if url:
- return next(create_getInfo(self)([url]))
+ return create_getInfo(self)([url]).next()
elif hasattr(self, "req") and self.req.http.code == '404':
info['status'] = 1
@@ -155,8 +155,12 @@ def parseFileInfo(self, url="", html=""):
if not hasattr(self, "file_info"):
self.file_info = {}
+ self.logDebug(_("File info (before update): %s") % self.file_info)
+
self.file_info.update(info)
+ self.logDebug(_("File info (after update): %s") % self.file_info)
+
return info['name'], info['size'], info['status'], url
@@ -195,7 +199,7 @@ def timestamp():
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.47"
+ __version__ = "0.48"
__pattern__ = None
@@ -245,10 +249,6 @@ class SimpleHoster(Hoster):
FORCE_CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account
- def init(self):
- self.file_info = {}
-
-
def setup(self):
self.resumeDownload = self.multiDL = self.premium
@@ -313,29 +313,26 @@ class SimpleHoster(Hoster):
def getFileInfo(self):
- name, size, status = parseFileInfo(self)[:3]
+ name, size, status, url = parseFileInfo(self)
- msg = _("File info: %s") % self.file_info
- self.logDebug(msg)
+ if name and name != url:
+ self.pyfile.name = name
+ else:
+ self.pyfile.name = self.file_info['name'] = html_unescape(urlparse(url).path.split("/")[-1])
if status == 1:
self.offline()
elif status == 6:
self.tempOffline()
elif status != 2:
- self.error(msg)
-
- if name:
- self.pyfile.name = name
- else:
- self.pyfile.name = html_unescape(urlparse(self.pyfile.url).path.split("/")[-1])
+ self.error(_("File info: %s") % self.file_info)
if size:
self.pyfile.size = size
else:
self.logError(_("File size not parsed"))
- self.logDebug("FILE NAME: %s" % self.pyfile.name, "FILE SIZE: %d" % self.pyfile.size)
+ self.logDebug("FILE NAME: %s" % self.pyfile.name, "FILE SIZE: %d" % self.pyfile.size or _("Unknown"))
return self.file_info