summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/PremiumizeMe.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/PremiumizeMe.py')
-rw-r--r--module/plugins/hoster/PremiumizeMe.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index 5f0685483..3d19c88ac 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -1,27 +1,22 @@
# -*- coding: utf-8 -*-
-from pyload.utils import json_loads
-from pyload.plugin.Hoster import Hoster
+from module.common.json_layer import json_loads
+from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
-class PremiumizeMe(Hoster):
+class PremiumizeMe(MultiHoster):
__name__ = "PremiumizeMe"
__type__ = "hoster"
- __version__ = "0.12"
+ __version__ = "0.16"
- __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
+ __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
- __description__ = """Premiumize.me hoster plugin"""
+ __description__ = """Premiumize.me multi-hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")]
- def process(self, pyfile):
- # Check account
- if not self.account or not self.account.canUse():
- self.logError(_("Please enter your %s account or deactivate this plugin") % "premiumize.me")
- self.fail(_("No valid premiumize.me account provided"))
-
+ def handlePremium(self, pyfile):
# In some cases hostsers do not supply us with a filename at download, so we
# are going to set a fall back filename (e.g. for freakshare or xfileshare)
pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash
@@ -33,7 +28,7 @@ class PremiumizeMe(Hoster):
pyfile.name = ".".join(temp)
# Get account data
- (user, data) = self.account.selectAccount()
+ user, data = self.account.selectAccount()
# Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
data = json_loads(self.load("https://api.premiumize.me/pm-api/v1.php",
@@ -44,13 +39,22 @@ class PremiumizeMe(Hoster):
# Check status and decide what to do
status = data['status']
+
if status == 200:
- self.download(data['result']['location'], disposition=True)
+ self.link = data['result']['location']
+ return
+
elif status == 400:
self.fail(_("Invalid link"))
+
elif status == 404:
self.offline()
+
elif status >= 500:
self.tempOffline()
+
else:
self.fail(data['statusmessage'])
+
+
+getInfo = create_getInfo(PremiumizeMe)