summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-02 02:37:18 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-02 02:37:18 +0100
commite0cba81ae8d59ee24e1cd1f1cf1697c5e61118ce (patch)
treefa3dca0013f2ddeec68b6bb8cc728829379748b1
parent[RapiduNet] Account trafficleft (diff)
downloadpyload-e0cba81ae8d59ee24e1cd1f1cf1697c5e61118ce.tar.xz
[PremiumTo] Fixup
-rw-r--r--module/plugins/accounts/PremiumTo.py16
-rw-r--r--module/plugins/hooks/PremiumTo.py14
-rw-r--r--module/plugins/hoster/PremiumTo.py14
3 files changed, 12 insertions, 32 deletions
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py
index ef3d0cc19..2c486a1dd 100644
--- a/module/plugins/accounts/PremiumTo.py
+++ b/module/plugins/accounts/PremiumTo.py
@@ -6,7 +6,7 @@ from module.plugins.Account import Account
class PremiumTo(Account):
__name__ = "PremiumTo"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.06"
__description__ = """Premium.to account plugin"""
__license__ = "GPLv3"
@@ -16,12 +16,14 @@ class PremiumTo(Account):
def loadAccountInfo(self, user, req):
- api_r = req.load("http://premium.to/api/straffic.php",
- get={'username': self.username, 'password': self.password})
-
- trafficleft = sum(map(float, api_r.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
-
- return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1}
+ traffic = req.load("http://premium.to/api/traffic.php",
+ get={'username': self.username, 'password': self.password})
+
+ if "wrong username" not in traffic:
+ trafficleft = float(traffic.strip()) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
+ return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1}
+ else:
+ return {'premium': False, 'trafficleft': None, 'validuntil': None}
def login(self, user, data, req):
diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py
index 348bb6789..a4203c8bb 100644
--- a/module/plugins/hooks/PremiumTo.py
+++ b/module/plugins/hooks/PremiumTo.py
@@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook
class PremiumTo(MultiHook):
__name__ = "PremiumTo"
__type__ = "hook"
- __version__ = "0.06"
+ __version__ = "0.07"
__config__ = [("mode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"),
("pluginlist", "str", "Hoster list (comma separated)", "")]
@@ -22,15 +22,3 @@ class PremiumTo(MultiHook):
page = self.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("PremiumTo")
-
- user = self.account.selectAccount()[0]
-
- if not user:
- self.logError(_("Please add your premium.to account first and restart pyLoad"))
- return
-
- return MultiHook.coreReady(self)
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index fa4caad5a..5dd8e3bec 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -3,8 +3,6 @@
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
@@ -13,7 +11,7 @@ from module.utils import fs_encode
class PremiumTo(MultiHoster):
__name__ = "PremiumTo"
__type__ = "hoster"
- __version__ = "0.16"
+ __version__ = "0.17"
__pattern__ = r'https?://(?:www\.)?premium\.to/.+'
@@ -24,20 +22,12 @@ class PremiumTo(MultiHoster):
("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, "")},
+ 'link' : self.pyfile.url},
disposition=True)