summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-08-04 18:06:42 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-08-04 18:06:42 +0200
commit2cf928db10224b5327f918dceaa13273753620ac (patch)
tree2bf7d443308198f170c2b9eff137099467648059 /module
parentMerge pull request #1696 from Gutz-Pilz/patch-4 (diff)
downloadpyload-2cf928db10224b5327f918dceaa13273753620ac.tar.xz
Some fixes
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/UploadedTo.py5
-rw-r--r--module/plugins/hooks/AntiStandby.py2
-rw-r--r--module/plugins/hoster/ZDF.py4
-rw-r--r--module/plugins/internal/Account.py15
-rw-r--r--module/plugins/internal/Plugin.py6
-rw-r--r--module/plugins/internal/SimpleHoster.py7
-rw-r--r--module/plugins/internal/XFSAccount.py8
-rw-r--r--module/plugins/internal/XFSCrypter.py9
-rw-r--r--module/plugins/internal/XFSHoster.py9
9 files changed, 34 insertions, 31 deletions
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 9cacad58f..59d3fcff9 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class UploadedTo(Account):
__name__ = "UploadedTo"
__type__ = "account"
- __version__ = "0.34"
+ __version__ = "0.35"
__status__ = "testing"
__description__ = """Uploaded.to account plugin"""
@@ -17,10 +17,11 @@ class UploadedTo(Account):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+ COOKIES = False
+
PREMIUM_PATTERN = r'<em>Premium</em>'
VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>(.+?)<'
TRAFFIC_LEFT_PATTERN = r'<b class="cB">(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
- COOKIES = False
def parse_info(self, user, password, data, req):
diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py
index 2d7a165a6..48b86fa55 100644
--- a/module/plugins/hooks/AntiStandby.py
+++ b/module/plugins/hooks/AntiStandby.py
@@ -13,7 +13,7 @@ except ImportError:
pass
from module.plugins.internal.Addon import Addon, Expose
-from module.utils import save_join as fs_join, fs_encode
+from module.utils import fs_encode, save_join as fs_join
class Kernel32(object):
diff --git a/module/plugins/hoster/ZDF.py b/module/plugins/hoster/ZDF.py
index 549dd718c..008a6241d 100644
--- a/module/plugins/hoster/ZDF.py
+++ b/module/plugins/hoster/ZDF.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Hoster import Hoster
class ZDF(Hoster):
__name__ = "ZDF Mediathek"
__type__ = "hoster"
- __version__ = "0.82"
+ __version__ = "0.83"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?zdf\.de/ZDFmediathek/\D*(\d+)\D*'
@@ -42,7 +42,7 @@ class ZDF(Hoster):
def process(self, pyfile):
- xml = etree.fromstring(self.load(self.XML_API % self.get_id(pyfile.url)).encode("UTF-8"))
+ xml = etree.fromstring(self.load(self.XML_API % self.get_id(pyfile.url), decode=False))
status = xml.findtext("./status/statuscode")
if status != "ok":
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 4553f3a79..ec89caa00 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -13,7 +13,7 @@ from module.utils import compare_time, lock, parseFileSize as parse_size
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.15"
+ __version__ = "0.16"
__status__ = "testing"
__description__ = """Base account plugin"""
@@ -190,7 +190,6 @@ class Account(Plugin):
return data
- @lock
def get_info(self, user, reload=False):
"""
Retrieve account infos for an user, do **not** overwrite this method!\\
@@ -213,13 +212,13 @@ class Account(Plugin):
safe_info['data']['password'] = "**********" #@TODO: Remove in 0.4.10
self.log_debug("Account info for user `%s`: %s" % (user, safe_info))
+ elif self.INFO_THRESHOLD > 0 and self.info[user]['login']['timestamp'] + self.INFO_THRESHOLD < time.time():
+ self.log_debug("Reached data timeout for %s" % user)
+ info = self.get_info(user, True)
+
else:
info = self.info[user]
- if self.INFO_THRESHOLD > 0 and info['login']['timestamp'] + self.INFO_THRESHOLD < time.time():
- self.log_debug("Reached data timeout for %s" % user)
- self.schedule_refresh(user)
-
return info
@@ -371,12 +370,12 @@ class Account(Plugin):
self.schedule_refresh(user, 60 * 60)
- def schedule_refresh(self, user, time=0, reload=True):
+ def schedule_refresh(self, user, time=0):
"""
Add task to refresh account info to sheduler
"""
self.log_debug("Scheduled refresh for user `%s` in %s seconds" % (user, time))
- self.pyload.scheduler.addJob(time, self.get_info, [user, reload])
+ self.pyload.scheduler.addJob(time, self.get_info, [user, True])
#: Deprecated method, use `schedule_refresh` instead (Remove in 0.4.10)
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 5f70a292d..7b45c40a8 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -146,7 +146,7 @@ def chunks(iterable, size):
class Plugin(object):
__name__ = "Plugin"
__type__ = "hoster"
- __version__ = "0.29"
+ __version__ = "0.30"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -334,8 +334,8 @@ class Plugin(object):
req = self.req or self.pyload.requestFactory.getRequest(self.__name__)
#@TODO: Move to network in 0.4.10
- if hasattr(self, 'COOKIES') and isinstance(self.COOKIES, list):
- set_cookies(req.cj, self.COOKIES)
+ if isinstance(cookies, list):
+ set_cookies(req.cj, cookies)
res = req.load(url, get, post, ref, bool(cookies), just_header, multipart, decode is True) #@TODO: Fix network multipart in 0.4.10
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index e2cc21ed8..8d4100026 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -23,7 +23,7 @@ statusMap = dict((v, k) for k, v in _statusMap.items())
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "1.78"
+ __version__ = "1.79"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -221,9 +221,6 @@ class SimpleHoster(Hoster):
self.req.setOption("timeout", 120)
- if hasattr(self, 'COOKIES') and isinstance(self.COOKIES, list):
- set_cookies(self.req.cj, self.COOKIES)
-
if self.LINK_PATTERN:
if not hasattr(self, 'LINK_FREE_PATTERN'):
self.LINK_FREE_PATTERN = self.LINK_PATTERN
@@ -250,7 +247,7 @@ class SimpleHoster(Hoster):
def preload(self):
self.html = self.load(self.pyfile.url,
- cookies=bool(self.COOKIES),
+ cookies=self.COOKIES,
ref=False,
decode=self.TEXT_ENCODING)
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 7093ccd27..e0f6b1ee8 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -11,7 +11,7 @@ from module.plugins.internal.Plugin import parse_html_form, set_cookie
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.41"
+ __version__ = "0.42"
__status__ = "testing"
__description__ = """XFileSharing account plugin"""
@@ -143,11 +143,11 @@ class XFSAccount(Account):
if not self.HOSTER_URL:
self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN
- if hasattr(self, 'COOKIES'):
- if isinstance(self.COOKIES, list):
+ if self.COOKIES:
+ if isinstance(self.COOKIES, list) and not self.COOKIES.count((self.HOSTER_DOMAIN, "lang", "english")):
self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
else:
- set_cookie(req.cj, self.HOSTER_DOMAIN, "lang", "english")
+ set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english")
if not self.HOSTER_URL:
self.login_fail(_("Missing HOSTER_URL"))
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index fcb017466..eaf295bf2 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class XFSCrypter(SimpleCrypter):
__name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.11"
+ __version__ = "0.12"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -40,7 +40,10 @@ class XFSCrypter(SimpleCrypter):
else:
self.fail(_("Missing HOSTER_DOMAIN"))
- if isinstance(self.COOKIES, list):
- self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
+ if self.COOKIES:
+ if isinstance(self.COOKIES, list) and not self.COOKIES.count((self.HOSTER_DOMAIN, "lang", "english")):
+ self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
+ else:
+ set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english")
return super(XFSCrypter, self).prepare()
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 962cffb06..715ef93ca 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -13,7 +13,7 @@ from module.utils import html_unescape
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.55"
+ __version__ = "0.56"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -71,8 +71,11 @@ class XFSHoster(SimpleHoster):
else:
self.fail(_("Missing HOSTER_DOMAIN"))
- if isinstance(self.COOKIES, list):
- self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
+ if self.COOKIES:
+ if isinstance(self.COOKIES, list) and not self.COOKIES.count((self.HOSTER_DOMAIN, "lang", "english")):
+ self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
+ else:
+ set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english")
if not self.LINK_PATTERN:
pattern = r'(?:file: "(.+?)"|(https?://(?:www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<])'