From 6cd895b4ee930cc0d1ed21bf13f58804f49fb304 Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:49:14 +0200 Subject: Create HighWayMe.py --- module/plugins/accounts/HighWayMe.py | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 module/plugins/accounts/HighWayMe.py diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py new file mode 100644 index 000000000..b192f6fa4 --- /dev/null +++ b/module/plugins/accounts/HighWayMe.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.Account import Account + + +class HighWayMe.py(Account): + __name__ = "HighWayMe.py" + __type__ = "account" + __version__ = "0.01" + + __description__ = """High-Way.Me account plugin""" + __license__ = "GPLv3" + __authors__ = [("yannik995", "evolutionclip@live.de")] + + + def loadAccountInfo(self, user, req): + premium = False + validuntil = -1 + trafficleft = None + + json_data = req.load('https://high-way.me/api.php?user') + + self.logDebug("JSON data: %s" % json_data) + + json_data = json_loads(json_data) + + if 'premium' in json_data['user'] and json_data['user']['premium']: + premium = True + + if 'premium_bis' in json_data['user'] and json_data['user']['premium_bis']: + validuntil = float(json_data['user']['premium_bis']) + + if 'premium_traffic' in json_data['user'] and json_data['user']['premium_traffic']: + trafficleft = float(json_data['user']['premium_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + + return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} + + + def login(self, user, data, req): + + html = req.load("https://high-way.me/api.php?login", + post={'login': '1', 'user': user, 'pass': data['password']}, + decode=True) + + if 'UserOrPassInvalid' in html: + self.wrongPassword() -- cgit v1.2.3 From b9a16ec6d3ea9711e0d7e349cc0c32a79ffbc62a Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:49:33 +0200 Subject: Create HighWayMe.py --- module/plugins/hooks/HighWayMe.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 module/plugins/hooks/HighWayMe.py diff --git a/module/plugins/hooks/HighWayMe.py b/module/plugins/hooks/HighWayMe.py new file mode 100644 index 000000000..2a1ff2991 --- /dev/null +++ b/module/plugins/hooks/HighWayMe.py @@ -0,0 +1,29 @@ ++# -*- coding: utf-8 -*- ++ ++from module.common.json_layer import json_loads ++from module.plugins.internal.MultiHook import MultiHook ++ ++ ++class HighWayMeHook(MultiHook): ++ __name__ = "HighWayMeHook" ++ __type__ = "hook" ++ __version__ = "0.01" ++ ++ __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ++ ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ++ ("revertfailed" , "bool" , "Revert to standard download if fails", True ), ++ ("reload" , "bool" , "Reload plugin list" , True ), ++ ("reloadinterval", "int" , "Reload interval in hours" , 12 )] ++ ++ __description__ = """High-Way.Me hook plugin""" ++ __license__ = "GPLv3" ++ __authors__ = [("EvolutionClip", "evolutionclip@live.de")] ++ ++ ++ def getHosters(self): ++ json_data = self.getURL("https://high-way.me/api.php", get={'hoster': 1}) ++ json_data = json_loads(json_data) ++ ++ host_list = [element['name'] for element in json_data['hoster']] ++ ++ return host_list -- cgit v1.2.3 From 9868e698db21da5997ecd410887728d20cd9a661 Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:49:37 +0200 Subject: Create HighWayMe.py --- module/plugins/hoster/HighWayMe.py | 76 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 module/plugins/hoster/HighWayMe.py diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py new file mode 100644 index 000000000..7e8f8a165 --- /dev/null +++ b/module/plugins/hoster/HighWayMe.py @@ -0,0 +1,76 @@ ++# -*- coding: utf-8 -*- ++ ++import re ++ ++from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo ++from module.plugins.internal.SimpleHoster import secondsToMidnight ++ ++ ++class HighWayMe(MultiHoster): ++ __name__ = "HighWayMe" ++ __type__ = "hoster" ++ __version__ = "0.08" ++ ++ __pattern__ = r'https?://.+high-way\.my' ++ __config__ = [("use_premium", "bool", "Use premium account if available", True)] ++ ++ __description__ = """High-Way.Me multi-hoster plugin""" ++ __license__ = "GPLv3" ++ __authors__ = [("EvolutionClip", "evolutionclip@live.de")] ++ ++ ++ def setup(self): ++ self.chunkLimit = 4 ++ ++ ++ def checkErrors(self): ++ if '0' in self.html or ( ++ "You are not allowed to download from this host" in self.html and self.premium): ++ self.account.relogin(self.user) ++ self.retry() ++ ++ elif "9" in self.html: ++ self.offline() ++ ++ elif "downloadlimit" in self.html: ++ self.logWarning(_("Reached maximum connctions")) ++ self.retry(5, 60, _("Reached maximum connctions")) ++ ++ elif "trafficlimit" in self.html: ++ self.logWarning(_("Reached daily limit")) ++ self.retry(wait_time=secondsToMidnight(gmt=2), reason="Daily limit for this host reached") ++ ++ elif "8" in self.html: ++ self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) ++ self.retry(5, 60, _("Hoster is temporarily unavailable")) ++ ++ ++ def handlePremium(self, pyfile): ++ for i in xrange(5): ++ self.html = self.load("https://high-way.me/load.php", get={'link': self.pyfile.url}) ++ ++ if self.html: ++ self.logDebug("JSON data: " + self.html) ++ break ++ else: ++ self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) ++ self.retry(5, 60, _("Unable to get API data")) ++ ++ self.checkErrors() ++ ++ try: ++ self.pyfile.name = re.search(r'([^<]+)', self.html).group(1) ++ ++ except AttributeError: ++ self.pyfile.name = "" ++ ++ try: ++ self.pyfile.size = re.search(r'(\d+)', self.html).group(1) ++ ++ except AttributeError: ++ self.pyfile.size = 0 ++ ++ self.link = re.search(r'([^<]+)', self.html).group(1) ++ ++ ++getInfo = create_getInfo(HighWayMe) -- cgit v1.2.3 From 0e2188958988b8e39e6b0d899a73aadfda11c2ef Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:50:43 +0200 Subject: Update HighWayMe.py --- module/plugins/accounts/HighWayMe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py index b192f6fa4..76330a3d1 100644 --- a/module/plugins/accounts/HighWayMe.py +++ b/module/plugins/accounts/HighWayMe.py @@ -11,7 +11,7 @@ class HighWayMe.py(Account): __description__ = """High-Way.Me account plugin""" __license__ = "GPLv3" - __authors__ = [("yannik995", "evolutionclip@live.de")] + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3 From ba0d4da7d7944167be120c5a1a87ad2fad9a4226 Mon Sep 17 00:00:00 2001 From: EvolutionClip Date: Fri, 5 Jun 2015 22:56:34 +0200 Subject: Added Comment Line 27: Is not working. It should by if 302 Moved Temporarily then ... But I don't now how to implement it. --- module/plugins/hoster/HighWayMe.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py index 7e8f8a165..e7b3fd739 100644 --- a/module/plugins/hoster/HighWayMe.py +++ b/module/plugins/hoster/HighWayMe.py @@ -24,8 +24,7 @@ + + + def checkErrors(self): -+ if '0' in self.html or ( -+ "You are not allowed to download from this host" in self.html and self.premium): ++ if '0' in self.html: #This is not working. It should by if 302 Moved Temporarily then ... But I don't now how to implement it. + self.account.relogin(self.user) + self.retry() + -- cgit v1.2.3