summaryrefslogtreecommitdiffstats
path: root/module/plugins/addon/ClickAndLoad.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 21:59:10 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 21:59:10 +0100
commit8e7d14bae4d3c836f029a1235eb227380acc3f75 (patch)
treeebd0679642cccb994e70a89a106b394189cb28bc /module/plugins/addon/ClickAndLoad.py
parentMerge branch 'stable' into 0.4.10 (diff)
downloadpyload-8e7d14bae4d3c836f029a1235eb227380acc3f75.tar.xz
Fix plugins to work on 0.4.10
Diffstat (limited to 'module/plugins/addon/ClickAndLoad.py')
-rw-r--r--module/plugins/addon/ClickAndLoad.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/module/plugins/addon/ClickAndLoad.py b/module/plugins/addon/ClickAndLoad.py
deleted file mode 100644
index 5fe6e4bec..000000000
--- a/module/plugins/addon/ClickAndLoad.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from socket import socket, error
-from threading import Thread
-
-from pyload.plugin.Addon import Addon
-
-
-def forward(source, destination):
- string = ' '
- while string:
- string = source.recv(1024)
- if string:
- destination.sendall(string)
- else:
- #source.shutdown(socket.SHUT_RD)
- destination.shutdown(socket.SHUT_WR)
-
-
-class ClickAndLoad(Addon):
- __name__ = "ClickAndLoad"
- __type__ = "addon"
- __version__ = "0.23"
-
- __config__ = [("activated", "bool", "Activated" , True ),
- ("port" , "int" , "Port" , 9666 ),
- ("extern" , "bool", "Allow external link adding", False)]
-
- __description__ = """Click'N'Load hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("RaNaN", "RaNaN@pyload.de"),
- ("mkaay", "mkaay@mkaay.de"),
- ("Walter Purcaro", "vuolter@gmail.com")]
-
-
- def setup(self):
- self.interval = 300
-
-
- def activate(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']
- cnlport = self.getConfig("port"))
-
- try:
- s = socket()
- s.bind((webip, cnlport))
- s.listen(5)
-
- client = s.accept()[0]
- server = socket()
-
- server.connect(("127.0.0.1", webport))
-
- except error, e:
- if hasattr(e, "errno"):
- errno = e.errno
- else:
- errno = e.args[0]
-
- if errno == 98:
- self.logWarning(_("Port %d already in use") % cnlport)
- else:
- self.logDebug(e)
-
- else:
- self.core.scheduler.removeJob(self.cb)
- t = Thread(target=forward, args=[client, server])
- t.setDaemon(True)
- t.start()