summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/XFSCrypter.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal/XFSCrypter.py')
-rw-r--r--module/plugins/internal/XFSCrypter.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index 4c059d647..876575874 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -7,17 +7,20 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class XFSCrypter(SimpleCrypter):
__name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.13"
+ __version__ = "0.16"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("use_subfolder" , "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """XFileSharing decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = None
+ PLUGIN_DOMAIN = None
URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')]
@@ -28,23 +31,29 @@ class XFSCrypter(SimpleCrypter):
TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)'
+ 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 prepare(self):
- if not self.HOSTER_DOMAIN:
+ if not self.PLUGIN_DOMAIN:
if self.account:
account = self.account
else:
account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "")
account = self.pyload.accountManager.getAccountPlugin(account_name)
- if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
- self.HOSTER_DOMAIN = account.HOSTER_DOMAIN
+ if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN:
+ self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN
else:
- self.fail(_("Missing HOSTER_DOMAIN"))
+ self.fail(_("Missing PLUGIN_DOMAIN"))
- 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")
+ self.set_xfs_cookie()
return super(XFSCrypter, self).prepare()