summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-22 02:56:40 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-22 02:56:40 +0200
commit135dcc25125dd3460ae1c3d67b0f5e7b00dcedac (patch)
tree9c7aa72806f9c963b1d9e716943f1a187bc42f0d /module/plugins
parent[Account] Add method 'setup' (diff)
downloadpyload-135dcc25125dd3460ae1c3d67b0f5e7b00dcedac.tar.xz
Update XFS plugins
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/internal/XFSAccount.py38
-rw-r--r--module/plugins/internal/XFSCrypter.py30
-rw-r--r--module/plugins/internal/XFSHoster.py30
3 files changed, 34 insertions, 64 deletions
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 1b424c964..66052df09 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -11,8 +11,8 @@ from module.plugins.internal.utils import parse_html_form, parse_time, set_cooki
class XFSAccount(MultiAccount):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.54"
- __status__ = "testing"
+ __version__ = "0.55"
+ __status__ = "stable"
__config__ = [("activated" , "bool" , "Activated" , True ),
("multi" , "bool" , "Multi-hoster" , True ),
@@ -47,19 +47,28 @@ class XFSAccount(MultiAccount):
LOGIN_SKIP_PATTERN = r'op=logout'
- def set_xfs_cookie(self):
- if not self.PLUGIN_DOMAIN:
- self.log_warning(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN"))
- return
-
+ def _set_xfs_cookie(self):
cookie = (self.PLUGIN_DOMAIN, "lang", "english")
-
if isinstance(self.COOKIES, list) and cookie not in self.COOKIES:
self.COOKIES.insert(cookie)
else:
set_cookie(self.req.cj, *cookie)
+ def setup(self):
+ if not self.PLUGIN_DOMAIN:
+ self.fail_login(_("Missing PLUGIN_DOMAIN"))
+
+ if not self.PLUGIN_URL:
+ self.PLUGIN_URL = "http://www.%s/" % self.PLUGIN_DOMAIN
+
+ if not self.LOGIN_URL:
+ self.LOGIN_URL = urlparse.urljoin(self.PLUGIN_URL, "login.html")
+
+ if self.COOKIES:
+ self._set_xfs_cookie()
+
+
def grab_hosters(self, user, password, data):
pass
@@ -164,19 +173,6 @@ class XFSAccount(MultiAccount):
def signin(self, user, password, data):
- if self.PLUGIN_DOMAIN:
- if not self.PLUGIN_URL:
- self.PLUGIN_URL = "http://www.%s/" % self.PLUGIN_DOMAIN
-
- if self.COOKIES:
- self.set_xfs_cookie()
-
- if not self.PLUGIN_URL:
- self.fail_login(_("Missing PLUGIN_URL"))
-
- if not self.LOGIN_URL:
- self.LOGIN_URL = urlparse.urljoin(self.PLUGIN_URL, "login.html")
-
self.html = self.load(self.LOGIN_URL, cookies=self.COOKIES)
if re.search(self.LOGIN_SKIP_PATTERN, self.html):
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index d3ddadd2f..13757fa1f 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -7,8 +7,8 @@ from module.plugins.internal.utils import set_cookie
class XFSCrypter(SimpleCrypter):
__name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.20"
- __status__ = "testing"
+ __version__ = "0.21"
+ __status__ = "stable"
__pattern__ = r'^unmatchable$'
__config__ = [("activated" , "bool", "Activated" , True),
@@ -32,13 +32,8 @@ class XFSCrypter(SimpleCrypter):
TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)'
- def set_xfs_cookie(self):
- if not self.PLUGIN_DOMAIN:
- self.log_warning(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN"))
- return
-
+ def _set_xfs_cookie(self):
cookie = (self.PLUGIN_DOMAIN, "lang", "english")
-
if isinstance(self.COOKIES, list) and cookie not in self.COOKIES:
self.COOKIES.insert(cookie)
else:
@@ -46,19 +41,12 @@ class XFSCrypter(SimpleCrypter):
def prepare(self):
- if not self.PLUGIN_DOMAIN:
- if self.account:
- account = self.account
- else:
- account_name = self.classname.rstrip("Folder")
- account = self.pyload.accountManager.getAccountPlugin(account_name)
-
- if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN:
- self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN
- else:
- self.fail(_("Missing PLUGIN_DOMAIN"))
+ if not self.PLUGIN_DOMAIN and self.account and self.account.PLUGIN_DOMAIN:
+ self.PLUGIN_DOMAIN = self.account.PLUGIN_DOMAIN
+ else:
+ self.fail(_("Missing PLUGIN_DOMAIN"))
if self.COOKIES:
- self.set_xfs_cookie()
+ self._set_xfs_cookie()
- return super(XFSCrypter, self).prepare()
+ super(XFSCrypter, self).prepare()
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index e3f2cab51..293b01c4b 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -13,8 +13,8 @@ from module.plugins.internal.utils import html_unescape, seconds_to_midnight
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.67"
- __status__ = "testing"
+ __version__ = "0.68"
+ __status__ = "stable"
__pattern__ = r'^unmatchable$'
__config__ = [("activated" , "bool", "Activated" , True),
@@ -61,13 +61,8 @@ class XFSHoster(SimpleHoster):
self.resume_download = self.premium
- def set_xfs_cookie(self):
- if not self.PLUGIN_DOMAIN:
- self.log_warning(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN"))
- return
-
+ def _set_xfs_cookie(self):
cookie = (self.PLUGIN_DOMAIN, "lang", "english")
-
if isinstance(self.COOKIES, list) and cookie not in self.COOKIES:
self.COOKIES.insert(cookie)
else:
@@ -75,22 +70,13 @@ class XFSHoster(SimpleHoster):
def prepare(self):
- """
- Initialize important variables
- """
- if not self.PLUGIN_DOMAIN:
- if self.account:
- account = self.account
- else:
- account = self.pyload.accountManager.getAccountPlugin(self.classname)
-
- if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN:
- self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN
- else:
- self.fail(_("Missing PLUGIN_DOMAIN"))
+ if not self.PLUGIN_DOMAIN and self.account and self.account.PLUGIN_DOMAIN:
+ self.PLUGIN_DOMAIN = self.account.PLUGIN_DOMAIN
+ else:
+ self.fail(_("Missing PLUGIN_DOMAIN"))
if self.COOKIES:
- self.set_xfs_cookie()
+ self._set_xfs_cookie()
if not self.LINK_PATTERN:
pattern = r'(?:file: "(.+?)"|(https?://(?:www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<])'