summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-07 18:48:27 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-07 18:48:27 +0200
commitcec2250f13753ea37312a56871cd6acf8d1d09dc (patch)
tree08fed65e3024ca8820a352ebda37c6e6f0079beb
parent[FiredriveCom] Fixed download link recognition + added TEMP_OFFLINE_PATTERN (diff)
downloadpyload-cec2250f13753ea37312a56871cd6acf8d1d09dc.tar.xz
[RestartFailed] Fixed bad interval checking
-rw-r--r--module/plugins/hooks/RestartFailed.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py
index 89bbcb19e..3ee2aeed4 100644
--- a/module/plugins/hooks/RestartFailed.py
+++ b/module/plugins/hooks/RestartFailed.py
@@ -1,5 +1,5 @@
# -*- 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
@@ -12,14 +12,14 @@
#
# 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.Hook import Hook
class RestartFailed(Hook):
__name__ = "RestartFailed"
- __version__ = "1.54"
+ __version__ = "1.55"
__description__ = """Periodically restart all failed downloads in queue"""
__config__ = [("activated", "bool", "Activated", False),
("interval", "int", "Check interval in minutes", 90)]
@@ -31,21 +31,22 @@ class RestartFailed(Hook):
event_list = ["pluginConfigChanged"]
- def periodical(self):
- self.logInfo("Restart failed downloads")
- self.core.api.restartFailed()
-
def pluginConfigChanged(self, plugin, name, value):
- if name != "interval":
+ if name == "interval":
interval = value * 60
if self.MIN_INTERVAL <= interval != self.interval:
self.core.scheduler.removeJob(self.cb)
self.interval = interval
self.initPeriodical()
else:
- self.logWarning("Invalid interval value, kept current")
+ self.logDebug("Invalid interval value, kept current")
+
+ def periodical(self):
+ self.logInfo("Restart failed downloads")
+ self.api.restartFailed()
def setup(self):
+ self.api = self.core.api
self.interval = self.MIN_INTERVAL
def coreReady(self):