summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/Premium4Me.py29
-rw-r--r--module/plugins/accounts/PremiumTo.py28
-rw-r--r--module/plugins/hooks/PremiumTo.py (renamed from module/plugins/hooks/Premium4Me.py)14
-rw-r--r--module/plugins/hoster/PremiumTo.py (renamed from module/plugins/hoster/Premium4Me.py)20
4 files changed, 44 insertions, 47 deletions
diff --git a/module/plugins/accounts/Premium4Me.py b/module/plugins/accounts/Premium4Me.py
deleted file mode 100644
index 9f66af414..000000000
--- a/module/plugins/accounts/Premium4Me.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.Account import Account
-
-
-class Premium4Me(Account):
- __name__ = "Premium4Me"
- __type__ = "account"
- __version__ = "0.03"
-
- __description__ = """Premium.to account plugin"""
- __author_name__ = ("RaNaN", "zoidberg", "stickell")
- __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
-
-
- def loadAccountInfo(self, user, req):
- traffic = req.load("http://premium.to/api/traffic.php?authcode=%s" % self.authcode)
-
- account_info = {"trafficleft": int(traffic) / 1024,
- "validuntil": -1}
-
- return account_info
-
- def login(self, user, data, req):
- self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % (
- user, data['password'])).strip()
-
- if "wrong username" in self.authcode:
- self.wrongPassword()
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py
new file mode 100644
index 000000000..5678f8210
--- /dev/null
+++ b/module/plugins/accounts/PremiumTo.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Account import Account
+
+
+class PremiumTo(Account):
+ __name__ = "PremiumTo"
+ __type__ = "account"
+ __version__ = "0.04"
+ __description__ = """Premium.to account plugin"""
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ api_r = req.load("http://premium.to/api/straffic.php",
+ get={'username': self.username, 'password': self.password})
+ traffic = sum(map(int, api_r.split(';')))
+
+ return {"trafficleft": int(traffic) / 1024, "validuntil": -1}
+
+ def login(self, user, data, req):
+ self.username = user
+ self.password = data['password']
+ authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % (
+ user, self.password)).strip()
+
+ if "wrong username" in authcode:
+ self.wrongPassword()
diff --git a/module/plugins/hooks/Premium4Me.py b/module/plugins/hooks/PremiumTo.py
index 9c6701b06..0572dab34 100644
--- a/module/plugins/hooks/Premium4Me.py
+++ b/module/plugins/hooks/PremiumTo.py
@@ -4,26 +4,24 @@ from module.network.RequestFactory import getURL
from module.plugins.internal.MultiHoster import MultiHoster
-class Premium4Me(MultiHoster):
- __name__ = "Premium4Me"
+class PremiumTo(MultiHoster):
+ __name__ = "PremiumTo"
__type__ = "hook"
- __version__ = "0.03"
-
+ __version__ = "0.04"
__config__ = [("activated", "bool", "Activated", False),
("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"),
("hosterList", "str", "Hoster list (comma separated)", "")]
-
__description__ = """Premium.to hook plugin"""
__author_name__ = ("RaNaN", "zoidberg", "stickell")
__author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
-
def getHoster(self):
- page = getURL("http://premium.to/api/hosters.php?authcode=%s" % self.account.authcode)
+ page = getURL("http://premium.to/api/hosters.php",
+ get={'username': self.account.username, 'password': self.account.password})
return [x.strip() for x in page.replace("\"", "").split(";")]
def coreReady(self):
- self.account = self.core.accountManager.getAccountPlugin("Premium4Me")
+ self.account = self.core.accountManager.getAccountPlugin("PremiumTo")
user = self.account.selectAccount()[0]
diff --git a/module/plugins/hoster/Premium4Me.py b/module/plugins/hoster/PremiumTo.py
index ea841338a..3ab7e34ac 100644
--- a/module/plugins/hoster/Premium4Me.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -8,18 +8,15 @@ from module.plugins.Hoster import Hoster
from module.utils import fs_encode
-class Premium4Me(Hoster):
- __name__ = "Premium4Me"
+class PremiumTo(Hoster):
+ __name__ = "PremiumTo"
__type__ = "hoster"
- __version__ = "0.08"
-
- __pattern__ = r'http://(?:www\.)?premium.to/.*'
-
+ __version__ = "0.09"
+ __pattern__ = r'https?://(?:www\.)?premium.to/.*'
__description__ = """Premium.to hoster plugin"""
__author_name__ = ("RaNaN", "zoidberg", "stickell")
__author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
-
def setup(self):
self.resumeDownload = True
self.chunkLimit = 1
@@ -29,7 +26,7 @@ class Premium4Me(Hoster):
self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to")
self.fail("No premium.to account provided")
- self.logDebug("premium.to: Old URL: %s" % pyfile.url)
+ self.logDebug("Old URL: %s" % pyfile.url)
tra = self.getTraffic()
@@ -37,7 +34,8 @@ class Premium4Me(Hoster):
self.req.setOption("timeout", 120)
self.download(
- "http://premium.to/api/getfile.php?authcode=%s&link=%s" % (self.account.authcode, quote(pyfile.url, "")),
+ "http://premium.to/api/getfile.php",
+ get={"username": self.account.username, "password": self.account.password, "link": quote(pyfile.url, "")},
disposition=True)
check = self.checkDownload({"nopremium": "No premium account available"})
@@ -66,7 +64,9 @@ class Premium4Me(Hoster):
def getTraffic(self):
try:
- traffic = int(self.load("http://premium.to/api/traffic.php?authcode=%s" % self.account.authcode))
+ api_r = self.load("http://premium.to/api/straffic.php",
+ get={'username': self.account.username, 'password': self.account.password})
+ traffic = sum(map(int, api_r.split(';')))
except:
traffic = 0
return traffic