From 8e7d14bae4d3c836f029a1235eb227380acc3f75 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 16 Feb 2015 21:59:10 +0100 Subject: Fix plugins to work on 0.4.10 --- pyload/plugin/hoster/PremiumTo.py | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pyload/plugin/hoster/PremiumTo.py (limited to 'pyload/plugin/hoster/PremiumTo.py') 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() -- cgit v1.2.3