summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar EvolutionClip <evolutionclip@live.de> 2015-06-05 22:49:37 +0200
committerGravatar EvolutionClip <evolutionclip@live.de> 2015-06-05 22:49:37 +0200
commit9868e698db21da5997ecd410887728d20cd9a661 (patch)
tree1e9673b16be07212d3f027a823a843eadcf3782e /module/plugins/hoster
parentCreate HighWayMe.py (diff)
downloadpyload-9868e698db21da5997ecd410887728d20cd9a661.tar.xz
Create HighWayMe.py
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/HighWayMe.py76
1 files changed, 76 insertions, 0 deletions
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 '<valid>0</valid>' 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 "<code>9</code>" 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 "<code>8</code>" 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'<name>([^<]+)</name>', self.html).group(1)
++
++ except AttributeError:
++ self.pyfile.name = ""
++
++ try:
++ self.pyfile.size = re.search(r'<size>(\d+)</size>', self.html).group(1)
++
++ except AttributeError:
++ self.pyfile.size = 0
++
++ self.link = re.search(r'<download>([^<]+)</download>', self.html).group(1)
++
++
++getInfo = create_getInfo(HighWayMe)