summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/hooks/ClickAndLoad.py30
-rw-r--r--module/plugins/internal/Plugin.py2
2 files changed, 23 insertions, 9 deletions
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py
index 591be8b59..bc691bf7c 100644
--- a/module/plugins/hooks/ClickAndLoad.py
+++ b/module/plugins/hooks/ClickAndLoad.py
@@ -29,12 +29,13 @@ def forward(source, destination):
class ClickAndLoad(Addon):
__name__ = "ClickAndLoad"
__type__ = "hook"
- __version__ = "0.45"
+ __version__ = "0.46"
__status__ = "testing"
- __config__ = [("activated", "bool", "Activated" , True),
- ("port" , "int" , "Port" , 9666),
- ("extern" , "bool", "Listen on the public network interface", True)]
+ __config__ = [("activated", "bool", "Activated" , True ),
+ ("port" , "int" , "Port" , 9666 ),
+ ("extern" , "bool", "Listen on the public network interface", True ),
+ ("queue" , "bool", "Add packages to queue" , False)]
__description__ = """Click'n'Load hook plugin"""
__license__ = "GPLv3"
@@ -54,6 +55,19 @@ class ClickAndLoad(Addon):
@threaded
+ def forward(source, destination, queue=False):
+ if queue:
+ old_ids = set(id for pack.id in self.pyload.api.getCollector())
+
+ forward(source, destination)
+
+ if queue:
+ new_ids = set(id for pack.id in self.pyload.api.getCollector())
+ for id in new_ids - old_ids:
+ self.pyload.api.pushToQueue(id)
+
+
+ @threaded
def proxy(self, ip, webport, cnlport):
time.sleep(10) #@TODO: Remove in 0.4.10 (implement addon delay on startup)
@@ -85,18 +99,18 @@ class ClickAndLoad(Addon):
except NameError:
self.log_error(_("Missing SSL lib"), _("Please disable HTTPS in pyLoad settings"))
- client_socket.close() #: Reset the connection.
+ client_socket.close()
continue
except Exception, e:
self.log_error(_("SSL error: %s") % e.message)
- client_socket.close() #: Reset the connection.
+ client_socket.close()
continue
server_socket.connect(("127.0.0.1", webport))
- self.manager.startThread(forward, client_socket, server_socket)
- self.manager.startThread(forward, server_socket, client_socket)
+ self.forward(client_socket, server_socket, self.get_config('queue'))
+ self.forward(server_socket, client_socket)
except socket.timeout:
self.log_debug("Connection timed out, retrying...")
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 3b1f3575f..4ab330975 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -337,7 +337,7 @@ class Plugin(object):
:param value:
:return:
"""
- self.pyload.config.setPlugin(plugin or self.__name__, option, value)
+ self.pyload.api.setConfigValue(plugin or self.__name__, option, value, section="plugin")
def get_config(self, option, default="", plugin=None):