diff options
| author | 2014-12-17 20:02:20 +0100 | |
|---|---|---|
| committer | 2014-12-17 20:02:20 +0100 | |
| commit | 57300575fa97107d172e0c9909b244c8c8ae6c12 (patch) | |
| tree | 86dcbc38175e55c3ac077ff9a894fe74bb3d54ea /module/plugins/hoster/MyfastfileCom.py | |
| parent | [FilerNet] Typo (diff) | |
| download | pyload-57300575fa97107d172e0c9909b244c8c8ae6c12.tar.xz | |
Extend SimpleHoster in multi-hoster plugins
Diffstat (limited to 'module/plugins/hoster/MyfastfileCom.py')
| -rw-r--r-- | module/plugins/hoster/MyfastfileCom.py | 44 | 
1 files changed, 20 insertions, 24 deletions
| diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index a2e582bd0..947d302b5 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -3,10 +3,10 @@  import re  from module.common.json_layer import json_loads -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -class MyfastfileCom(Hoster): +class MyfastfileCom(SimpleHoster):      __name__    = "MyfastfileCom"      __type__    = "hoster"      __version__ = "0.04" @@ -19,28 +19,24 @@ class MyfastfileCom(Hoster):      def setup(self): -        self.chunkLimit = -1 +        self.chunkLimit     = -1          self.resumeDownload = True -    def process(self, pyfile): -        if re.match(self.__pattern__, pyfile.url): -            new_url = pyfile.url -        elif not self.account: -            self.logError(_("Please enter your %s account or deactivate this plugin") % "Myfastfile.com") -            self.fail(_("No Myfastfile.com account provided")) -        else: -            self.logDebug("Original URL: %s" % pyfile.url) -            page = self.load('http://myfastfile.com/api.php', -                             get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], -                                  'link': pyfile.url}) -            self.logDebug("JSON data: " + page) -            page = json_loads(page) -            if page['status'] != 'ok': -                self.fail(_("Unable to unrestrict link")) -            new_url = page['link'] - -        if new_url != pyfile.url: -            self.logDebug("Unrestricted URL: " + new_url) - -        self.download(new_url, disposition=True) +    def handleMulti(self): +        self.logDebug("Original URL: %s" % self.pyfile.url) + +        page = self.load('http://myfastfile.com/api.php', +                         get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], +                              'link': self.pyfile.url}) +        self.logDebug("JSON data: " + page) +        page = json_loads(page) +        if page['status'] != 'ok': +            self.fail(_("Unable to unrestrict link")) +        self.link = page['link'] + +        if self.link != self.pyfile.url: +            self.logDebug("Unrestricted URL: " + self.link) + + +getInfo = create_getInfo(MyfastfileCom) | 
