summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/ConfigParser.py18
-rw-r--r--module/cli/printer.py1
-rw-r--r--module/common/JsEngine.py6
-rw-r--r--module/common/__init__.py1
-rw-r--r--module/common/packagetools.py17
-rw-r--r--module/database/DatabaseBackend.py45
-rw-r--r--module/database/FileDatabase.py49
-rw-r--r--module/forwarder.py10
-rw-r--r--module/network/Browser.py12
-rw-r--r--module/network/HTTPDownload.py14
-rw-r--r--module/network/HTTPRequest.py5
-rw-r--r--module/plugins/OCR.py11
-rw-r--r--module/plugins/PluginManager.py19
-rw-r--r--module/remote/socketbackend/__init__.py1
-rw-r--r--module/remote/socketbackend/create_ttypes.py3
-rw-r--r--module/remote/thriftbackend/ThriftClient.py22
-rw-r--r--module/setup.py5
-rw-r--r--module/utils.py5
-rw-r--r--module/web/webinterface.py4
19 files changed, 0 insertions, 248 deletions
diff --git a/module/ConfigParser.py b/module/ConfigParser.py
index 88e9055c6..9de405a3d 100644
--- a/module/ConfigParser.py
+++ b/module/ConfigParser.py
@@ -371,21 +371,3 @@ class Section:
def __setitem__(self, item, value):
"""setitem"""
self.parser.set(self.section, item, value)
-
-
-if __name__ == "__main__":
- pypath = ""
-
- from time import time
-
- a = time()
-
- c = ConfigParser()
-
- b = time()
-
- print "sec", b - a
-
- print c.config
-
- c.saveConfig(c.config, "user.conf")
diff --git a/module/cli/printer.py b/module/cli/printer.py
index 5ded53140..0b2f5a0e3 100644
--- a/module/cli/printer.py
+++ b/module/cli/printer.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# -*- coding: utf-8 -*-
def blue(string):
diff --git a/module/common/JsEngine.py b/module/common/JsEngine.py
index 45c9a50a5..46789f64d 100644
--- a/module/common/JsEngine.py
+++ b/module/common/JsEngine.py
@@ -153,9 +153,3 @@ class JsEngine:
def error(self):
return _("No js engine detected, please install either Spidermonkey, ossp-js, pyv8 or rhino")
-
-if __name__ == "__main__":
- js = JsEngine()
-
- test = u'"ü"+"ä"'
- js.eval(test)
diff --git a/module/common/__init__.py b/module/common/__init__.py
index 4b31e848b..e69de29bb 100644
--- a/module/common/__init__.py
+++ b/module/common/__init__.py
@@ -1 +0,0 @@
-__author__ = 'christian'
diff --git a/module/common/packagetools.py b/module/common/packagetools.py
index 6fd2d4a38..d5ab4d182 100644
--- a/module/common/packagetools.py
+++ b/module/common/packagetools.py
@@ -134,20 +134,3 @@ def parseNames(files):
packs[name] = [url]
return packs
-
-
-if __name__ == "__main__":
- from os.path import join
- from pprint import pprint
-
- f = open(join("..", "..", "testlinks2.txt"), "rb")
- urls = [(x.strip(), x.strip()) for x in f.readlines() if x.strip()]
- f.close()
-
- print "Having %d urls." % len(urls)
-
- packs = parseNames(urls)
-
- pprint(packs)
-
- print "Got %d urls." % sum([len(x) for x in packs.itervalues()])
diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py
index 15d45e784..df2660063 100644
--- a/module/database/DatabaseBackend.py
+++ b/module/database/DatabaseBackend.py
@@ -303,48 +303,3 @@ class DatabaseBackend(Thread):
for sub in DatabaseBackend.subs:
if hasattr(sub, attr):
return getattr(sub, attr)
-
-if __name__ == "__main__":
- db = DatabaseBackend()
- db.setup()
-
- class Test:
- @style.queue
- def insert(db):
- c = db.createCursor()
- for i in range(1000):
- c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", ("foo", i, "bar"))
- @style.async
- def insert2(db):
- c = db.createCursor()
- for i in range(1000*1000):
- c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", ("foo", i, "bar"))
-
- @style.queue
- def select(db):
- c = db.createCursor()
- for i in range(10):
- res = c.execute("SELECT value FROM storage WHERE identifier=? AND key=?", ("foo", i))
- print res.fetchone()
-
- @style.queue
- def error(db):
- c = db.createCursor()
- print "a"
- c.execute("SELECT myerror FROM storage WHERE identifier=? AND key=?", ("foo", i))
- print "e"
-
- db.registerSub(Test)
- from time import time
- start = time()
- for i in range(100):
- db.insert()
- end = time()
- print end-start
-
- start = time()
- db.insert2()
- end = time()
- print end-start
-
- db.error()
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py
index 4a5e7c0ef..f01d02769 100644
--- a/module/database/FileDatabase.py
+++ b/module/database/FileDatabase.py
@@ -889,52 +889,3 @@ class FileMethods:
self.c.execute("DELETE FROM packages;")
DatabaseBackend.registerSub(FileMethods)
-
-if __name__ == "__main__":
-
- pypath = "."
- _ = lambda x: x
-
- db = FileHandler(None)
-
- #p = PyFile(db, 5)
- #sleep(0.1)
-
- a = time()
-
- #print db.addPackage("package", "folder" , 1)
-
- pack = db.db.addPackage("package", "folder", 1)
-
- updates = []
-
- for x in range(0, 200):
- x = str(x)
- db.db.addLink("http://somehost.com/hoster/file/download?file_id=" + x, x, "BasePlugin", pack)
- updates.append(("new name" + x, 0, 3, "http://somehost.com/hoster/file/download?file_id=" + x))
-
-
- for x in range(0, 100):
- updates.append(("unimportant%s" % x, 0, 3, "a really long non existent url%s" % x))
-
- db.db.commit()
-
- b = time()
- print "adding 200 links, single sql execs, no commit", b-a
-
- print db.getCompleteData(1)
-
- c = time()
-
-
- db.db.updateLinkInfo(updates)
-
- d = time()
-
- print "updates", d-c
-
- print db.getCompleteData(1)
-
- e = time()
-
- print "complete data", e-d
diff --git a/module/forwarder.py b/module/forwarder.py
index 52d2afd71..3cb3a7748 100644
--- a/module/forwarder.py
+++ b/module/forwarder.py
@@ -59,13 +59,3 @@ def forward(source, destination):
else:
#source.shutdown(socket.SHUT_RD)
destination.shutdown(socket.SHUT_WR)
-
-if __name__ == "__main__":
- args = argv[1:]
- if not args:
- print "Usage: forwarder.py <remote ip> <remote port>"
- exit()
- if len(args) == 1:
- args.append(9666)
-
- f = Forwarder(args[0], int(args[1]))
diff --git a/module/network/Browser.py b/module/network/Browser.py
index 3146d7f71..e78d24688 100644
--- a/module/network/Browser.py
+++ b/module/network/Browser.py
@@ -130,15 +130,3 @@ class Browser(object):
del self.dl
if hasattr(self, "cj"):
del self.cj
-
-if __name__ == "__main__":
- browser = Browser()#proxies={"socks5": "localhost:5000"})
- ip = "http://www.whatismyip.com/automation/n09230945.asp"
- #browser.getPage("http://google.com/search?q=bar")
- #browser.getPage("https://encrypted.google.com/")
- #print browser.getPage(ip)
- #print browser.getRedirectLocation("http://google.com/")
- #browser.getPage("https://encrypted.google.com/")
- #browser.getPage("http://google.com/search?q=bar")
-
- browser.httpDownload("http://speedtest.netcologne.de/test_10mb.bin", "test_10mb.bin")
diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py
index 9b613b684..20ac00e48 100644
--- a/module/network/HTTPDownload.py
+++ b/module/network/HTTPDownload.py
@@ -323,17 +323,3 @@ class HTTPDownload:
del self.cj
if hasattr(self, "info"):
del self.info
-
-if __name__ == "__main__":
- url = "http://speedtest.netcologne.de/test_100mb.bin"
-
- from Bucket import Bucket
-
- bucket = Bucket()
- bucket.setRate(200 * 1024)
- bucket = None
-
- print "starting"
-
- dwnld = HTTPDownload(url, "test_100mb.bin", bucket=bucket)
- dwnld.download(chunks=3, resume=True)
diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py
index f61069b60..67635f944 100644
--- a/module/network/HTTPRequest.py
+++ b/module/network/HTTPRequest.py
@@ -301,8 +301,3 @@ class HTTPRequest:
if hasattr(self, "c"):
self.c.close()
del self.c
-
-if __name__ == "__main__":
- url = "http://pyload.org"
- c = HTTPRequest()
- print c.load(url)
diff --git a/module/plugins/OCR.py b/module/plugins/OCR.py
index 919739ad6..eb4456fc0 100644
--- a/module/plugins/OCR.py
+++ b/module/plugins/OCR.py
@@ -305,14 +305,3 @@ class OCR(object):
return result
else:
self.result_captcha = result
-
-
-if __name__ == '__main__':
- ocr = OCR()
- ocr.load_image("B.jpg")
- ocr.to_greyscale()
- ocr.eval_black_white(140)
- ocr.derotate_by_average()
- ocr.run_tesser()
- print "Tesseract", ocr.result_captcha
- ocr.image.save("derotated.jpg")
diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py
index 4aa5ad575..1e1656ce8 100644
--- a/module/plugins/PluginManager.py
+++ b/module/plugins/PluginManager.py
@@ -369,22 +369,3 @@ class PluginManager:
def reloadPlugin(self, type_plugin):
""" reload and reindex ONE plugin """
return True if self.reloadPlugins(type_plugin) else False
-
-
-
-if __name__ == "__main__":
- _ = lambda x: x
- pypath = "/home/christian/Projekte/pyload-0.4/module/plugins"
-
- from time import time
-
- p = PluginManager(None)
-
- a = time()
-
- test = ["http://www.youtube.com/watch?v=%s" % x for x in xrange(0, 100)]
- print p.parseUrls(test)
-
- b = time()
-
- print b - a, "s"
diff --git a/module/remote/socketbackend/__init__.py b/module/remote/socketbackend/__init__.py
index 4b31e848b..e69de29bb 100644
--- a/module/remote/socketbackend/__init__.py
+++ b/module/remote/socketbackend/__init__.py
@@ -1 +0,0 @@
-__author__ = 'christian'
diff --git a/module/remote/socketbackend/create_ttypes.py b/module/remote/socketbackend/create_ttypes.py
index 65bd11dbe..64398c3e7 100644
--- a/module/remote/socketbackend/create_ttypes.py
+++ b/module/remote/socketbackend/create_ttypes.py
@@ -84,6 +84,3 @@ class BaseObject(object):
f.write("\n")
f.close()
-
-if __name__ == "__main__":
- main()
diff --git a/module/remote/thriftbackend/ThriftClient.py b/module/remote/thriftbackend/ThriftClient.py
index 4e11fdc0d..913719ed9 100644
--- a/module/remote/thriftbackend/ThriftClient.py
+++ b/module/remote/thriftbackend/ThriftClient.py
@@ -85,25 +85,3 @@ class ThriftClient:
def __getattr__(self, item):
return getattr(self.client, item)
-
-if __name__ == "__main__":
-
- client = ThriftClient(user="User", password="pwhere")
-
- print client.getServerVersion()
- print client.statusServer()
- print client.statusDownloads()
- q = client.getQueue()
-
-# for p in q:
-# data = client.getPackageData(p.pid)
-# print data
-# print "Package Name: ", data.name
-
-
- print client.getServices()
- print client.call(Pyload.ServiceCall("UpdateManager", "recheckForUpdates"))
-
- print client.getConfigValue("download", "limit_speed", "core")
-
- client.close()
diff --git a/module/setup.py b/module/setup.py
index 515b92d1a..9d18f0374 100644
--- a/module/setup.py
+++ b/module/setup.py
@@ -510,8 +510,3 @@ class Setup:
return input
else:
print _("Invalid Input")
-
-
-if __name__ == "__main__":
- test = Setup(join(abspath(dirname(__file__)), ".."), None)
- test.start()
diff --git a/module/utils.py b/module/utils.py
index fa6b84095..93ff14a46 100644
--- a/module/utils.py
+++ b/module/utils.py
@@ -213,8 +213,3 @@ def fixup(m):
def html_unescape(text):
"""Removes HTML or XML character references and entities from a text string"""
return re.sub("&#?\w+;", fixup, text)
-
-if __name__ == "__main__":
- print freeSpace(".")
-
- print remove_chars("ab'cdgdsf''ds'", "'ghd")
diff --git a/module/web/webinterface.py b/module/web/webinterface.py
index 00618870c..13edd8a5e 100644
--- a/module/web/webinterface.py
+++ b/module/web/webinterface.py
@@ -150,7 +150,3 @@ def run_fcgi(host="0.0.0.0", port="8000"):
from bottle import FlupFCGIServer
run(app=web, host=host, port=port, server=FlupFCGIServer, quiet=True)
-
-
-if __name__ == "__main__":
- run(app=web, port=8001)