diff options
Diffstat (limited to 'module/plugins/internal/XFSAccount.py')
-rw-r--r-- | module/plugins/internal/XFSAccount.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 5a6f0ee9c..e09f7dddc 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -4,17 +4,22 @@ import re import time import urlparse -from module.plugins.internal.Account import Account -# from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.Plugin import parse_html_form, parse_time, set_cookie +from module.plugins.internal.MultiAccount import MultiAccount +from module.plugins.internal.utils import parse_html_form, parse_time, set_cookie -class XFSAccount(Account): +class XFSAccount(MultiAccount): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.52" + __version__ = "0.54" __status__ = "testing" + __config__ = [("activated" , "bool" , "Activated" , True ), + ("multi" , "bool" , "Multi-hoster" , True ), + ("multi_mode" , "all;listed;unlisted", "Hosters to use" , "all"), + ("multi_list" , "str" , "Hoster list (comma separated)", "" ), + ("multi_interval", "int" , "Reload interval in hours" , 12 )] + __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), @@ -44,7 +49,7 @@ class XFSAccount(Account): def set_xfs_cookie(self): if not self.PLUGIN_DOMAIN: - self.log_error(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN")) + self.log_warning(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN")) return cookie = (self.PLUGIN_DOMAIN, "lang", "english") @@ -55,6 +60,10 @@ class XFSAccount(Account): set_cookie(self.req.cj, *cookie) + def grab_hosters(self, user, password, data): + pass + + def grab_info(self, user, password, data): validuntil = None trafficleft = None @@ -207,7 +216,10 @@ class XFSAccount(Account): finally: errmsg = re.sub(r'<.*?>', " ", errmsg.strip()) - self.timeout = parse_time(errmsg) + new_timeout = parse_time(errmsg) + if new_timeout > self.timeout: + self.timeout = new_timeout + self.fail_login(errmsg) m = re.search(self.LOGIN_FAIL_PATTERN, self.html) |