diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-17 20:02:20 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-17 20:02:20 +0100 |
commit | 57300575fa97107d172e0c9909b244c8c8ae6c12 (patch) | |
tree | 86dcbc38175e55c3ac077ff9a894fe74bb3d54ea /module/plugins/hoster/PremiumTo.py | |
parent | [FilerNet] Typo (diff) | |
download | pyload-57300575fa97107d172e0c9909b244c8c8ae6c12.tar.xz |
Extend SimpleHoster in multi-hoster plugins
Diffstat (limited to 'module/plugins/hoster/PremiumTo.py')
-rw-r--r-- | module/plugins/hoster/PremiumTo.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 9f8037d41..35f21e7ec 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -6,11 +6,11 @@ from os import remove from os.path import exists from urllib import quote -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.utils import fs_encode -class PremiumTo(Hoster): +class PremiumTo(SimpleHoster): __name__ = "PremiumTo" __type__ = "hoster" __version__ = "0.11" @@ -26,27 +26,24 @@ class PremiumTo(Hoster): def setup(self): self.resumeDownload = True - self.chunkLimit = 1 + self.chunkLimit = 1 - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to") - self.fail(_("No premium.to account provided")) - - self.logDebug("Old URL: %s" % pyfile.url) - + def handleMulti(self): tra = self.getTraffic() #raise timeout to 2min self.req.setOption("timeout", 120) + self.link = True self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, - 'link' : quote(pyfile.url, "")}, + 'link' : quote(self.pyfile.url, "")}, disposition=True) + + def checkFile(self): check = self.checkDownload({"nopremium": "No premium account available"}) if check == "nopremium": @@ -65,7 +62,7 @@ class PremiumTo(Hoster): err = _('File does not exist') trb = self.getTraffic() - self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (pyfile.size, tra - trb, trb)) + self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (self.pyfile.size, tra - trb, trb)) if err: self.fail(err) @@ -79,3 +76,6 @@ class PremiumTo(Hoster): except: traffic = 0 return traffic + + +getInfo = create_getInfo(PremiumTo) |