summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/XFSAccount.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal/XFSAccount.py')
-rw-r--r--module/plugins/internal/XFSAccount.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 91136a2a0..7b9410222 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -13,7 +13,7 @@ from module.plugins.internal.Plugin import parse_html_form, set_cookie
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.48"
+ __version__ = "0.49"
__status__ = "testing"
__description__ = """XFileSharing account plugin"""
@@ -42,6 +42,16 @@ class XFSAccount(Account):
LOGIN_SKIP_PATTERN = r'op=logout'
+ def set_xfs_cookie(self):
+ if not self.COOKIES:
+ return
+
+ if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES:
+ self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english"))
+ else:
+ set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english")
+
+
def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
@@ -61,7 +71,7 @@ class XFSAccount(Account):
premium = True if re.search(self.PREMIUM_PATTERN, html) else False
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1).strip()
self.log_debug("Expire date: " + expiredate)
@@ -84,7 +94,7 @@ class XFSAccount(Account):
self.log_debug("VALID_UNTIL_PATTERN not found")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
try:
traffic = m.groupdict()
size = traffic['S']
@@ -146,11 +156,7 @@ class XFSAccount(Account):
if not self.PLUGIN_URL:
self.PLUGIN_URL = "http://www.%s/" % self.PLUGIN_DOMAIN
- if self.COOKIES:
- if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES:
- self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english"))
- else:
- set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english")
+ self.set_xfs_cookie()
if not self.PLUGIN_URL:
self.fail_login(_("Missing PLUGIN_URL"))