summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/PremiumTo.py
diff options
context:
space:
mode:
authorGravatar synweap15 <shamdog+github@gmail.com> 2014-12-30 20:21:23 +0100
committerGravatar synweap15 <shamdog+github@gmail.com> 2014-12-30 20:21:23 +0100
commitac9ba34bd5e629ddfbe67dec88ff2e0653e80356 (patch)
treef77bc281bd083145b19e82bf0e5ff34f5cd6f01a /module/plugins/hoster/PremiumTo.py
parent[Oboom] new hoster and account (diff)
parentUpdate some MultiHoster __pattern__ (diff)
downloadpyload-ac9ba34bd5e629ddfbe67dec88ff2e0653e80356.tar.xz
Merge pull request #1 from pyload/stable
Merge
Diffstat (limited to 'module/plugins/hoster/PremiumTo.py')
-rw-r--r--module/plugins/hoster/PremiumTo.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
new file mode 100644
index 000000000..fa4caad5a
--- /dev/null
+++ b/module/plugins/hoster/PremiumTo.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import with_statement
+
+from os import remove
+from os.path import exists
+from urllib import quote
+
+from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
+from module.utils import fs_encode
+
+
+class PremiumTo(MultiHoster):
+ __name__ = "PremiumTo"
+ __type__ = "hoster"
+ __version__ = "0.16"
+
+ __pattern__ = r'https?://(?:www\.)?premium\.to/.+'
+
+ __description__ = """Premium.to hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("RaNaN", "RaNaN@pyload.org"),
+ ("zoidberg", "zoidberg@mujmail.cz"),
+ ("stickell", "l.stickell@yahoo.it")]
+
+
+ def setup(self):
+ self.resumeDownload = True
+ self.chunkLimit = 1
+
+
+ def handlePremium(self):
+ #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(self.pyfile.url, "")},
+ disposition=True)
+
+
+ def checkFile(self):
+ super(PremiumTo, self).checkFile()
+
+ check = self.checkDownload({"nopremium": "No premium account available"})
+
+ if check == "nopremium":
+ self.retry(60, 5 * 60, "No premium account available")
+
+ err = ''
+ if self.req.http.code == '420':
+ # Custom error code send - fail
+ lastDownload = fs_encode(self.lastDownload)
+ with open(lastDownload, "rb") as f:
+ err = f.read(256).strip()
+ remove(lastDownload)
+
+ if err:
+ self.fail(err)
+
+
+getInfo = create_getInfo(PremiumTo)