diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-23 03:03:42 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-23 03:03:42 +0200 |
commit | eca1d95f5add1cc3148a282a4dae61077109ed01 (patch) | |
tree | 12eed69533360b055801d4dd1ee275be0418d5ff /module/plugins/crypter/XFileSharingFolder.py | |
parent | [utils] Improve method html_unescape (diff) | |
download | pyload-eca1d95f5add1cc3148a282a4dae61077109ed01.tar.xz |
Rewrite XFileSharing
Diffstat (limited to 'module/plugins/crypter/XFileSharingFolder.py')
-rw-r--r-- | module/plugins/crypter/XFileSharingFolder.py | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/module/plugins/crypter/XFileSharingFolder.py b/module/plugins/crypter/XFileSharingFolder.py index 6341e9895..4f08e63df 100644 --- a/module/plugins/crypter/XFileSharingFolder.py +++ b/module/plugins/crypter/XFileSharingFolder.py @@ -8,10 +8,9 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingFolder(XFSCrypter): __name__ = "XFileSharingFolder" __type__ = "crypter" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" - # __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+' __pattern__ = r'^unmatchable$' __config__ = [("activated" , "bool", "Activated" , True), ("use_subfolder" , "bool", "Save package to subfolder" , True), @@ -28,48 +27,30 @@ class XFileSharingFolder(XFSCrypter): def init(self): - super(XFileSharingFolder, self).init() - self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.classname]['pattern'] self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|-)', self.PLUGIN_DOMAIN) if part != '.') - + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'\.|\d+|-', self.PLUGIN_DOMAIN) if part != '.') - def _setup(self): - account_name = self.classname if not self.account or self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME - self.chunk_limit = 1 - self.multiDL = True + #@TODO: Recheck in 0.4.10 + def setup_base(self): if self.account: - self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user) - self.premium = self.account.premium - self.resume_download = self.premium + self.req = self.pyload.requestFactory.getRequest(self.PLUGIN_NAME, self.account.user) + self.premium = self.account.info['data']['premium'] #@NOTE: Avoid one unnecessary get_info call by `self.account.premium` here else: - self.req = self.pyload.requestFactory.getRequest(account_name) - self.premium = False - self.resume_download = False - - - def load_account(self): - if self.req: - self.req.close() + self.req = self.pyload.requestFactory.getRequest(self.classname) + self.premium = False - if not self.account: - self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME) + super(SimpleCrypter, self).setup_base() - if not self.account: - self.account = self.pyload.accountManager.getAccountPlugin(self.classname) - if self.account: - if not self.account.PLUGIN_DOMAIN: - self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN - - if not self.account.user: #@TODO: Move to `Account` in 0.4.10 - self.account.user = self.account.select()[0] - - if not self.account.logged: - self.account = False + #@TODO: Recheck in 0.4.10 + def load_account(self): + class_name = self.classname + self.__class__.__name__ = self.PLUGIN_NAME + super(XFileSharingFolder, self).load_account() + self.__class__.__name__ = class_name getInfo = create_getInfo(XFileSharingFolder) |