diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 21:59:10 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 21:59:10 +0100 |
commit | 8e7d14bae4d3c836f029a1235eb227380acc3f75 (patch) | |
tree | ebd0679642cccb994e70a89a106b394189cb28bc /pyload/plugin/hoster/PremiumTo.py | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
download | pyload-8e7d14bae4d3c836f029a1235eb227380acc3f75.tar.xz |
Fix plugins to work on 0.4.10
Diffstat (limited to 'pyload/plugin/hoster/PremiumTo.py')
-rw-r--r-- | pyload/plugin/hoster/PremiumTo.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/PremiumTo.py b/pyload/plugin/hoster/PremiumTo.py new file mode 100644 index 000000000..07945f873 --- /dev/null +++ b/pyload/plugin/hoster/PremiumTo.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +from os import remove + +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import fs_encode + + +class PremiumTo(MultiHoster): + __name__ = "PremiumTo" + __type__ = "hoster" + __version__ = "0.21" + + __pattern__ = r'^unmatchable$' + + __description__ = """Premium.to multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + CHECK_TRAFFIC = True + + + def handlePremium(self, pyfile): + #raise timeout to 2min + self.download("http://premium.to/api/getfile.php", + get={'username': self.account.username, + 'password': self.account.password, + 'link' : pyfile.url}, + disposition=True) + + + def checkFile(self): + if self.checkDownload({'nopremium': "No premium account available"}): + self.retry(60, 5 * 60, "No premium account available") + + err = '' + if self.req.http.code == '420': + # Custom error code send - fail + file = fs_encode(self.lastDownload) + with open(file, "rb") as f: + err = f.read(256).strip() + remove(file) + + if err: + self.fail(err) + + return super(PremiumTo, self).checkFile() |