summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-04 03:23:06 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-04 03:23:06 +0100
commite9376045f48255d3cbfdbaf5b5c6fbfd9112f17d (patch)
treebb914f0fcb072b86beddcfb17476835ef44ce9e4 /module/plugins/internal
parent[ZippyshareCom] Update plugin (diff)
downloadpyload-e9376045f48255d3cbfdbaf5b5c6fbfd9112f17d.tar.xz
[SimpleCrypter][SimpleHoster] Fix info data retrieving
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/SimpleCrypter.py14
-rw-r--r--module/plugins/internal/SimpleHoster.py42
2 files changed, 31 insertions, 25 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 0985bac60..a694cc2c9 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -13,7 +13,7 @@ from module.utils import fixup, html_unescape
class SimpleCrypter(Crypter):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.26"
+ __version__ = "0.27"
__pattern__ = r'^unmatchable$'
__config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package']
@@ -60,10 +60,10 @@ class SimpleCrypter(Crypter):
LINK_PATTERN = None
NAME_REPLACEMENTS = [("&#?\w+;", fixup)]
- URL_REPLACEMENTS = []
+ URL_REPLACEMENTS = []
TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct
- COOKIES = True #: or False or list of tuples [(domain, name, value)]
+ COOKIES = True #: or False or list of tuples [(domain, name, value)]
LOGIN_ACCOUNT = False
LOGIN_PREMIUM = False
@@ -96,7 +96,7 @@ class SimpleCrypter(Crypter):
self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS)
- if not self.html:
+ if self.html is None:
self.html = self.load(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES))
if isinstance(self.TEXT_ENCODING, basestring):
@@ -109,7 +109,8 @@ class SimpleCrypter(Crypter):
if self.html is None:
self.fail(_("No html retrieved"))
- info = self.getFileInfo()
+ if not self.info:
+ self.getFileInfo()
self.links = self.getLinks()
@@ -119,7 +120,7 @@ class SimpleCrypter(Crypter):
self.logDebug("Package has %d links" % len(self.links))
if self.links:
- self.packages = [(info['name'], self.links, info['folder'])]
+ self.packages = [(self.info['name'], self.links, self.info['folder'])]
def getFileInfo(self):
@@ -132,6 +133,7 @@ class SimpleCrypter(Crypter):
if status is 1:
self.offline()
+
elif status is 6:
self.tempOffline()
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index ac90e193a..3de49bef9 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -147,23 +147,21 @@ def parseFileInfo(self, url="", html=""):
unit = info['units'] if 'units' in info else None
info['size'] = parseFileSize(info['size'], unit)
- if not hasattr(self, "html") or self.html is None:
+ if hasattr(self, "html") and self.html is None:
self.html = html
- if not hasattr(self, "info"):
- self.info = {}
-
- try:
- self.logDebug(_("File info (before update): %s") % self.info)
- except:
- pass
+ if hasattr(self, "info"):
+ try:
+ self.logDebug(_("File info (before update): %s") % self.info)
+ except:
+ pass
- self.info.update(info)
+ self.info.update(info)
- try:
- self.logDebug(_("File info (after update): %s") % self.info)
- except:
- pass
+ try:
+ self.logDebug(_("File info (after update): %s") % self.info)
+ except:
+ pass
return info['name'], info['size'], info['status'], url
@@ -203,7 +201,7 @@ def timestamp():
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.49"
+ __version__ = "0.50"
__pattern__ = r'^unmatchable$'
@@ -246,10 +244,10 @@ class SimpleHoster(Hoster):
NAME_REPLACEMENTS = [("&#?\w+;", fixup)]
SIZE_REPLACEMENTS = []
- URL_REPLACEMENTS = []
+ URL_REPLACEMENTS = []
- TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct
- COOKIES = True #: or False or list of tuples [(domain, name, value)]
+ TEXT_ENCODING = False #: Set to True or encoding name if encoding in http header is not correct
+ COOKIES = True #: or False or list of tuples [(domain, name, value)]
FORCE_CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account
@@ -274,8 +272,11 @@ class SimpleHoster(Hoster):
direct_link = self.getDirectLink(self.pyfile.url)
if direct_link:
return direct_link
+ else:
+ self.html = None
+ self.info = {}
- if not self.html:
+ if self.html is None:
self.html = self.load(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES))
if isinstance(self.TEXT_ENCODING, basestring):
@@ -286,6 +287,7 @@ class SimpleHoster(Hoster):
direct_link = self.prepare()
if isinstance(direct_link, basestring):
+ self.logInfo(_("Direct download link detected"))
self.download(direct_link, ref=True, cookies=True, disposition=True)
elif self.html is None:
@@ -293,7 +295,7 @@ class SimpleHoster(Hoster):
else:
premium_only = hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html)
- if not premium_only and 'status' not in self.info: #: Usually premium only pages doesn't show any file information
+ if not premium_only and not self.info: #: Usually premium only pages doesn't show any file information
self.getFileInfo()
if self.premium and (not self.FORCE_CHECK_TRAFFIC or self.checkTrafficLeft()):
@@ -330,8 +332,10 @@ class SimpleHoster(Hoster):
if status is 1:
self.offline()
+
elif status is 6:
self.tempOffline()
+
elif status is not 2:
self.error(_("File info: %s") % self.info)