summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
authorGravatar Christopher <4Christopher@gmx.de> 2013-04-13 21:06:34 +0200
committerGravatar Christopher <4Christopher@gmx.de> 2013-04-13 21:06:34 +0200
commit0b2e9ddcafed94fb780ea8d07ea23f6f14612830 (patch)
tree36f60fb82cc61cf17947cbe7dcbbc719994e234c /module/plugins/hooks
parentCleanup. (diff)
parentMBLinkInfo: updated pattern (diff)
downloadpyload-0b2e9ddcafed94fb780ea8d07ea23f6f14612830.tar.xz
Merge branch 'stable' of git://github.com/pyload/pyload into stable
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/DebridItaliaCom.py20
-rw-r--r--module/plugins/hooks/DownloadScheduler.py72
-rw-r--r--module/plugins/hooks/LinkdecrypterCom.py4
-rw-r--r--module/plugins/hooks/MultiDebridCom.py42
4 files changed, 102 insertions, 36 deletions
diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py
index 8cd997f4d..d570eebe3 100644
--- a/module/plugins/hooks/DebridItaliaCom.py
+++ b/module/plugins/hooks/DebridItaliaCom.py
@@ -1,11 +1,26 @@
# -*- coding: utf-8 -*-
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
from module.plugins.internal.MultiHoster import MultiHoster
class DebridItaliaCom(MultiHoster):
__name__ = "DebridItaliaCom"
- __version__ = "0.01"
+ __version__ = "0.03"
__type__ = "hook"
__config__ = [("activated", "bool", "Activated", "False"),
("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
@@ -22,4 +37,5 @@ class DebridItaliaCom(MultiHoster):
"uploading.com", "megashares.com", "crocko.com", "filepost.com",
"bitshare.com", "share-links.biz", "putlocker.com", "uploaded.to",
"speedload.org", "rapidgator.net", "likeupload.net", "cyberlocker.ch",
- "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co"]
+ "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co",
+ "ryushare.com", "tusfiles.net", "nowvideo.co"]
diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py
index 7cadede38..4049d71c5 100644
--- a/module/plugins/hooks/DownloadScheduler.py
+++ b/module/plugins/hooks/DownloadScheduler.py
@@ -18,61 +18,69 @@
import re
from time import localtime
+
from module.plugins.Hook import Hook
+
class DownloadScheduler(Hook):
__name__ = "DownloadScheduler"
- __version__ = "0.20"
+ __version__ = "0.21"
__description__ = """Download Scheduler"""
- __config__ = [("activated", "bool", "Activated", "False"),
- ("timetable", "str", "List time periods as hh:mm full or number(kB/s)", "0:00 full, 7:00 250, 10:00 0, 17:00 150")]
- __author_name__ = ("zoidberg")
- __author_mail__ = ("zoidberg@mujmail.cz")
-
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("timetable", "str", "List time periods as hh:mm full or number(kB/s)",
+ "0:00 full, 7:00 250, 10:00 0, 17:00 150"),
+ ("abort", "bool", "Abort active downloads when start period with speed 0", "False")]
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
def setup(self):
- self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded
-
+ self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded
+
def coreReady(self):
self.updateSchedule()
-
- def updateSchedule(self, schedule = None):
- if schedule is None:
- schedule = self.getConfig("timetable")
-
- schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)", schedule.lower().replace("full", "-1").replace("none", "0"))
+
+ def updateSchedule(self, schedule=None):
+ if schedule is None:
+ schedule = self.getConfig("timetable")
+
+ schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)",
+ schedule.lower().replace("full", "-1").replace("none", "0"))
if not schedule:
self.logError("Invalid schedule")
return
-
+
t0 = localtime()
now = (t0.tm_hour, t0.tm_min, t0.tm_sec, "X")
schedule = sorted([(int(x[0]), int(x[1]), 0, int(x[2])) for x in schedule] + [now])
-
- self.logDebug("Schedule", schedule)
-
+
+ self.logDebug("Schedule", schedule)
+
for i, v in enumerate(schedule):
if v[3] == "X":
- last, next = schedule[i-1], schedule[(i+1) % len(schedule)]
+ last, next = schedule[i - 1], schedule[(i + 1) % len(schedule)]
self.logDebug("Now/Last/Next", now, last, next)
-
- self.setDownloadSpeed(last[3])
-
- next_time = (((24 + next[0] - now[0])* 60 + next[1] - now[1]) * 60 + next[2] - now[2]) % 86400
+
+ self.setDownloadSpeed(last[3])
+
+ next_time = (((24 + next[0] - now[0]) * 60 + next[1] - now[1]) * 60 + next[2] - now[2]) % 86400
self.core.scheduler.removeJob(self.cb)
- self.cb = self.core.scheduler.addJob(next_time, self.updateSchedule, threaded=False)
-
- def setDownloadSpeed(self, speed):
+ self.cb = self.core.scheduler.addJob(next_time, self.updateSchedule, threaded=False)
+
+ def setDownloadSpeed(self, speed):
if speed == 0:
- self.logInfo("Stopping download server. (Running downloads will not be aborted.)")
+ abort = self.getConfig("abort")
+ self.logInfo("Stopping download server. (Running downloads will %sbe aborted.)" % ('' if abort else 'not '))
self.core.api.pauseServer()
+ if abort:
+ self.core.api.stopAllDownloads()
else:
self.core.api.unpauseServer()
-
+
if speed > 0:
self.logInfo("Setting download speed to %d kB/s" % speed)
- self.core.api.setConfigValue("download","limit_speed",1)
- self.core.api.setConfigValue("download","max_speed",speed)
+ self.core.api.setConfigValue("download", "limit_speed", 1)
+ self.core.api.setConfigValue("download", "max_speed", speed)
else:
self.logInfo("Setting download speed to FULL")
- self.core.api.setConfigValue("download","limit_speed",0)
- self.core.api.setConfigValue("download","max_speed",-1) \ No newline at end of file
+ self.core.api.setConfigValue("download", "limit_speed", 0)
+ self.core.api.setConfigValue("download", "max_speed", -1)
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py
index 2cb91d120..d3d6bce68 100644
--- a/module/plugins/hooks/LinkdecrypterCom.py
+++ b/module/plugins/hooks/LinkdecrypterCom.py
@@ -24,7 +24,7 @@ from module.utils import remove_chars
class LinkdecrypterCom(Hook):
__name__ = "LinkdecrypterCom"
- __version__ = "0.16"
+ __version__ = "0.17"
__description__ = """linkdecrypter.com - regexp loader"""
__config__ = [ ("activated", "bool", "Activated" , "True") ]
__author_name__ = ("zoidberg")
@@ -50,7 +50,7 @@ class LinkdecrypterCom(Hook):
self.logError(_("Crypter list is empty"))
return
- regexp = r"http://([^.]+\.)*?(%s)/.*" % "|".join(online)
+ regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online)
dict = self.core.pluginManager.crypterPlugins[self.__name__]
dict["pattern"] = regexp
diff --git a/module/plugins/hooks/MultiDebridCom.py b/module/plugins/hooks/MultiDebridCom.py
new file mode 100644
index 000000000..c95138648
--- /dev/null
+++ b/module/plugins/hooks/MultiDebridCom.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.MultiHoster import MultiHoster
+from module.network.RequestFactory import getURL
+from module.common.json_layer import json_loads
+
+
+class MultiDebridCom(MultiHoster):
+ __name__ = "MultiDebridCom"
+ __version__ = "0.01"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to standard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+
+ __description__ = """Multi-debrid.com hook plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def getHoster(self):
+ json_data = getURL('http://multi-debrid.com/api.php?hosts', decode=True)
+ self.logDebug('JSON data: ' + json_data)
+ json_data = json_loads(json_data)
+
+ return json_data['hosts']