summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-04-14 01:49:49 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-04-14 01:49:49 +0200
commit20d88924fd6a3a5d15b521441a414aa3f8121e79 (patch)
tree2477c8c150048bdc580a6fe6000eb62d6db89b6f /module/plugins/hooks
parentUpdate DepositfilesCom.py (diff)
parent[UnSkipOnFail] Typo (diff)
downloadpyload-20d88924fd6a3a5d15b521441a414aa3f8121e79.tar.xz
Merge pull request #1 from pyload/stable
Sync
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/RestartSlow.py58
-rw-r--r--module/plugins/hooks/UnSkipOnFail.py4
2 files changed, 2 insertions, 60 deletions
diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py
deleted file mode 100644
index db535b3d1..000000000
--- a/module/plugins/hooks/RestartSlow.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import pycurl
-
-from module.plugins.Hook import Hook
-
-
-class RestartSlow(Hook):
- __name__ = "RestartSlow"
- __type__ = "hook"
- __version__ = "0.04"
-
- __config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ),
- ("free_time" , "int" , "Sample interval in minutes" , 5 ),
- ("premium_limit", "int" , "Transfer speed threshold for premium download in kilobytes", 300 ),
- ("premium_time" , "int" , "Sample interval for premium download in minutes" , 2 ),
- ("safe_mode" , "bool", "Don't restart if download is not resumable" , True)]
-
- __description__ = """Restart slow downloads"""
- __license__ = "GPLv3"
- __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
-
-
- event_list = ["downloadStarts"]
- interval = 0 #@TODO: Remove in 0.4.10
-
-
- def setup(self):
- self.info = {'chunk': {}}
-
-
- def periodical(self):
- if not self.pyfile.plugin.req.dl:
- return
-
- if self.getConfig('safe_mode') and not self.pyfile.plugin.resumeDownload:
- time = 30
- limit = 5
- else:
- type = "premium" if self.pyfile.plugin.premium else "free"
- time = max(30, self.getConfig("%s_time" % type) * 60)
- limit = max(5, self.getConfig("%s_limit" % type) * 1024)
-
- chunks = [chunk for chunk in self.pyfile.plugin.req.dl.chunks \
- if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] is not (time, limit)]
-
- for chunk in chunks:
- chunk.c.setopt(pycurl.LOW_SPEED_TIME , time)
- chunk.c.setopt(pycurl.LOW_SPEED_LIMIT, limit)
-
- self.info['chunk'][chunk.id] = (time, limit)
-
-
- def downloadStarts(self, pyfile, url, filename):
- if self.cb or (self.getConfig('safe_mode') and not pyfile.plugin.resumeDownload):
- return
- self.pyfile = pyfile
- super(RestartSlow, self).initPeriodical()
diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py
index ebd370a0f..6cd742c91 100644
--- a/module/plugins/hooks/UnSkipOnFail.py
+++ b/module/plugins/hooks/UnSkipOnFail.py
@@ -7,7 +7,7 @@ from module.plugins.Hook import Hook
class UnSkipOnFail(Hook):
__name__ = "UnSkipOnFail"
__type__ = "hook"
- __version__ = "0.05"
+ __version__ = "0.06"
__config__ = [("activated", "bool", "Activated", True)]
@@ -43,7 +43,7 @@ class UnSkipOnFail(Hook):
# It creates a temporary PyFile object using
# "link" data, changes its status, and tells
# the core.files-manager to save its data.
- pylink = _pyfile(link)
+ pylink = self._pyfile(link)
pylink.setCustomStatus(_("unskipped"), "queued")