diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-10 18:24:25 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-10 18:24:25 +0100 |
commit | 10afb4ce9d155bdb05016b0661be3c4c3aa6b4f1 (patch) | |
tree | 1590669c02be79d11a0a3b68bdce3d2cb29fe992 /pyload/plugins/addon | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
download | pyload-10afb4ce9d155bdb05016b0661be3c4c3aa6b4f1.tar.xz |
Fix previous merge
Diffstat (limited to 'pyload/plugins/addon')
-rw-r--r-- | pyload/plugins/addon/Checksum.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/ClickAndLoad.py | 9 | ||||
-rw-r--r-- | pyload/plugins/addon/DeleteFinished.py | 4 | ||||
-rw-r--r-- | pyload/plugins/addon/DownloadScheduler.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/ExternalScripts.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/ExtractArchive.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/HotFolder.py | 4 | ||||
-rw-r--r-- | pyload/plugins/addon/IRCInterface.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/MergeFiles.py | 6 | ||||
-rw-r--r-- | pyload/plugins/addon/MultiHome.py | 7 | ||||
-rw-r--r-- | pyload/plugins/addon/RestartFailed.py | 2 | ||||
-rw-r--r-- | pyload/plugins/addon/RestartSlow.py | 57 | ||||
-rw-r--r-- | pyload/plugins/addon/SkipRev.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/UnSkipOnFail.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/UpdateManager.py | 2 | ||||
-rw-r--r-- | pyload/plugins/addon/WindowsPhoneToastNotify.py | 5 | ||||
-rw-r--r-- | pyload/plugins/addon/XMPPInterface.py | 3 |
17 files changed, 73 insertions, 61 deletions
diff --git a/pyload/plugins/addon/Checksum.py b/pyload/plugins/addon/Checksum.py index 11154ac0f..ce50d1b28 100644 --- a/pyload/plugins/addon/Checksum.py +++ b/pyload/plugins/addon/Checksum.py @@ -63,11 +63,6 @@ class Checksum(Addon): 'default': r'^(?P<hash>[0-9A-Fa-f]+)\s+\*?(?P<name>.+)$'} - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def coreReady(self): if not self.getConfig("check_checksum"): self.logInfo(_("Checksum validation is disabled in plugin configuration")) diff --git a/pyload/plugins/addon/ClickAndLoad.py b/pyload/plugins/addon/ClickAndLoad.py index cad6e5c13..1f55b15dd 100644 --- a/pyload/plugins/addon/ClickAndLoad.py +++ b/pyload/plugins/addon/ClickAndLoad.py @@ -33,10 +33,14 @@ class ClickAndLoad(Addon): ("Walter Purcaro", "vuolter@gmail.com")] - def coreReady(self): + def setup(self): self.interval = 300 + def coreReady(self): + self.initPeriodical() + + def periodical(self): webip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" webport = self.config['webinterface']['port'] @@ -64,8 +68,7 @@ class ClickAndLoad(Addon): self.logDebug(e) else: + self.core.scheduler.removeJob(self.cb) t = Thread(target=forward, args=[client, server]) t.setDaemon(True) t.start() - self.interval = -1 - diff --git a/pyload/plugins/addon/DeleteFinished.py b/pyload/plugins/addon/DeleteFinished.py index 6c2ba38d8..43908b9a3 100644 --- a/pyload/plugins/addon/DeleteFinished.py +++ b/pyload/plugins/addon/DeleteFinished.py @@ -9,8 +9,7 @@ class DeleteFinished(Addon): __type__ = "addon" __version__ = "1.11" - __config__ = [("activated" , "bool", "Activated" , False ), - ('interval' , 'int' , 'Delete every (hours)' , '72' ), + __config__ = [('interval' , 'int' , 'Delete every (hours)' , '72' ), ('deloffline', 'bool', 'Delete packages with offline links', 'False')] __description__ = """Automatically delete all finished packages from queue""" @@ -75,5 +74,6 @@ class DeleteFinished(Addon): def setup(self): + self.interval = 0 self.m = self.manager self.removeEvent = self.m.removeEvent diff --git a/pyload/plugins/addon/DownloadScheduler.py b/pyload/plugins/addon/DownloadScheduler.py index ba7b14467..c1f1fca11 100644 --- a/pyload/plugins/addon/DownloadScheduler.py +++ b/pyload/plugins/addon/DownloadScheduler.py @@ -21,11 +21,6 @@ class DownloadScheduler(Addon): ("stickell", "l.stickell@yahoo.it")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): self.cb = None #: callback to scheduler job; will be by removed AddonManager when addon unloaded diff --git a/pyload/plugins/addon/ExternalScripts.py b/pyload/plugins/addon/ExternalScripts.py index 1360e52de..af863abb0 100644 --- a/pyload/plugins/addon/ExternalScripts.py +++ b/pyload/plugins/addon/ExternalScripts.py @@ -29,11 +29,6 @@ class ExternalScripts(Addon): "allDownloadsFinished", "allDownloadsProcessed"] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): self.scripts = {} diff --git a/pyload/plugins/addon/ExtractArchive.py b/pyload/plugins/addon/ExtractArchive.py index 938de0447..60b66740c 100644 --- a/pyload/plugins/addon/ExtractArchive.py +++ b/pyload/plugins/addon/ExtractArchive.py @@ -83,11 +83,6 @@ class ExtractArchive(Addon): event_list = ["allDownloadsProcessed"] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): self.plugins = [] self.passwords = [] diff --git a/pyload/plugins/addon/HotFolder.py b/pyload/plugins/addon/HotFolder.py index b16c02cf8..ff714d69e 100644 --- a/pyload/plugins/addon/HotFolder.py +++ b/pyload/plugins/addon/HotFolder.py @@ -31,6 +31,10 @@ class HotFolder(Addon): self.interval = 10 + def coreReady(self): + self.initPeriodical() + + def periodical(self): folder = fs_encode(self.getConfig("folder")) diff --git a/pyload/plugins/addon/IRCInterface.py b/pyload/plugins/addon/IRCInterface.py index 5392b01a8..bba8f86d8 100644 --- a/pyload/plugins/addon/IRCInterface.py +++ b/pyload/plugins/addon/IRCInterface.py @@ -44,11 +44,6 @@ class IRCInterface(Thread, Addon): self.setDaemon(True) - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def coreReady(self): self.abort = False self.more = [] diff --git a/pyload/plugins/addon/MergeFiles.py b/pyload/plugins/addon/MergeFiles.py index 2efc221dc..0c9b05283 100644 --- a/pyload/plugins/addon/MergeFiles.py +++ b/pyload/plugins/addon/MergeFiles.py @@ -26,13 +26,7 @@ class MergeFiles(Addon): BUFFER_SIZE = 4096 - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): - # nothing to do pass diff --git a/pyload/plugins/addon/MultiHome.py b/pyload/plugins/addon/MultiHome.py index bcb51254d..3450cab27 100644 --- a/pyload/plugins/addon/MultiHome.py +++ b/pyload/plugins/addon/MultiHome.py @@ -10,18 +10,13 @@ class MultiHome(Addon): __type__ = "addon" __version__ = "0.12" - __config__ = [("interfaces", "str" , "Interfaces", "None")] + __config__ = [("interfaces", "str", "Interfaces", "None")] __description__ = """Ip address changer""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): self.register = {} self.interfaces = [] diff --git a/pyload/plugins/addon/RestartFailed.py b/pyload/plugins/addon/RestartFailed.py index 861223f3d..f8d9da9cc 100644 --- a/pyload/plugins/addon/RestartFailed.py +++ b/pyload/plugins/addon/RestartFailed.py @@ -38,7 +38,7 @@ class RestartFailed(Addon): def setup(self): - self.interval = self.MIN_INTERVAL + self.interval = 0 def coreReady(self): diff --git a/pyload/plugins/addon/RestartSlow.py b/pyload/plugins/addon/RestartSlow.py new file mode 100644 index 000000000..f3c98c461 --- /dev/null +++ b/pyload/plugins/addon/RestartSlow.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import pycurl + +from module.plugins.Addon import Addon + + +class RestartSlow(Addon): + __name__ = "RestartSlow" + __type__ = "addon" + __version__ = "0.02" + + __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"] + + + def setup(self): + self.info = {'chunk': {}} + + + def periodical(self): + if not self.pyfile.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.req.dl.chunks \ + if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] not is (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.initPeriodical() diff --git a/pyload/plugins/addon/SkipRev.py b/pyload/plugins/addon/SkipRev.py index 66ddc89d2..cf716c509 100644 --- a/pyload/plugins/addon/SkipRev.py +++ b/pyload/plugins/addon/SkipRev.py @@ -19,11 +19,6 @@ class SkipRev(Adoon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def _setup(self): super(self.pyfile.plugin, self).setup() if self.pyfile.hasStatus("skipped"): diff --git a/pyload/plugins/addon/UnSkipOnFail.py b/pyload/plugins/addon/UnSkipOnFail.py index a0b3ec540..aade5a91e 100644 --- a/pyload/plugins/addon/UnSkipOnFail.py +++ b/pyload/plugins/addon/UnSkipOnFail.py @@ -19,11 +19,6 @@ class UnSkipOnFail(Addon): __authors__ = [("hagg", None)] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def downloadFailed(self, pyfile): pyfile_name = basename(pyfile.name) pid = pyfile.package().id diff --git a/pyload/plugins/addon/UpdateManager.py b/pyload/plugins/addon/UpdateManager.py index 97fa4a399..577345d69 100644 --- a/pyload/plugins/addon/UpdateManager.py +++ b/pyload/plugins/addon/UpdateManager.py @@ -66,7 +66,7 @@ class UpdateManager(Addon): def setup(self): self.cb2 = None - self.interval = self.MIN_INTERVAL + self.interval = 0 self.updating = False self.info = {'pyload': False, 'version': None, 'plugins': False} self.mtimes = {} #: store modification time for each plugin diff --git a/pyload/plugins/addon/WindowsPhoneToastNotify.py b/pyload/plugins/addon/WindowsPhoneToastNotify.py index fbaa89ea4..dc618d2d4 100644 --- a/pyload/plugins/addon/WindowsPhoneToastNotify.py +++ b/pyload/plugins/addon/WindowsPhoneToastNotify.py @@ -21,11 +21,6 @@ class WindowsPhoneToastNotify(Addon): __authors__ = [("Andy Voigt", "phone-support@hotmail.de")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def getXmlData(self): myxml = ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " "<wp:Toast> <wp:Text1>Pyload Mobile</wp:Text1> <wp:Text2>Captcha waiting!</wp:Text2> " diff --git a/pyload/plugins/addon/XMPPInterface.py b/pyload/plugins/addon/XMPPInterface.py index 5bbff8915..7f91befd3 100644 --- a/pyload/plugins/addon/XMPPInterface.py +++ b/pyload/plugins/addon/XMPPInterface.py @@ -14,8 +14,7 @@ class XMPPInterface(IRCInterface, JabberClient): __type__ = "addon" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated" , False ), - ("jid" , "str" , "Jabber ID" , "user@exmaple-jabber-server.org" ), + __config__ = [("jid" , "str" , "Jabber ID" , "user@exmaple-jabber-server.org" ), ("pw" , "str" , "Password" , "" ), ("tls" , "bool", "Use TLS" , False ), ("owners" , "str" , "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"), |