summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-17 01:21:41 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-17 01:21:41 +0200
commit20226f8cc5889efbefa61209e1adf6184d42cd00 (patch)
tree8f01af2c23465432f83481b656ed8c2743cb872a
parentSpare code cosmetics (2) (diff)
downloadpyload-20226f8cc5889efbefa61209e1adf6184d42cd00.tar.xz
Spare code cosmetics (3)
-rwxr-xr-xpyload/Core.py2
-rw-r--r--pyload/api/__init__.py84
-rw-r--r--pyload/cli/Cli.py44
-rw-r--r--pyload/config/Parser.py22
-rw-r--r--pyload/database/File.py38
-rw-r--r--pyload/manager/Plugin.py2
-rw-r--r--pyload/manager/thread/Addon.py4
-rw-r--r--pyload/manager/thread/Info.py2
-rw-r--r--pyload/network/Browser.py4
-rw-r--r--pyload/network/CookieJar.py8
-rw-r--r--pyload/network/HTTPRequest.py18
-rw-r--r--pyload/network/XDCCRequest.py4
-rw-r--r--pyload/plugin/Account.py2
-rw-r--r--pyload/plugin/account/NoPremiumPl.py12
-rw-r--r--pyload/plugin/account/RapideoPl.py12
-rw-r--r--pyload/plugin/account/SmoozedCom.py8
-rw-r--r--pyload/plugin/account/UploadableCh.py2
-rw-r--r--pyload/plugin/account/WebshareCz.py2
-rw-r--r--pyload/plugin/extractor/SevenZip.py4
-rw-r--r--pyload/plugin/hook/Captcha9Kw.py4
-rw-r--r--pyload/plugin/hook/NoPremiumPl.py2
-rw-r--r--pyload/plugin/hook/RapideoPl.py2
-rw-r--r--pyload/plugin/hook/XFileSharingPro.py4
-rw-r--r--pyload/plugin/hoster/NoPremiumPl.py22
-rw-r--r--pyload/plugin/hoster/RapideoPl.py22
-rw-r--r--pyload/plugin/hoster/SmoozedCom.py16
-rw-r--r--pyload/plugin/hoster/WebshareCz.py2
-rw-r--r--pyload/plugin/hoster/ZippyshareCom.py2
-rw-r--r--pyload/remote/thriftbackend/Socket.py14
-rw-r--r--pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py140
-rw-r--r--pyload/webui/__init__.py22
-rw-r--r--pyload/webui/app/api.py4
-rw-r--r--pyload/webui/app/cnl.py4
-rw-r--r--pyload/webui/app/json.py62
-rw-r--r--pyload/webui/app/pyloadweb.py52
-rw-r--r--pyload/webui/app/utils.py16
-rw-r--r--pyload/webui/middlewares.py2
-rw-r--r--pyload/webui/servers/lighttpd_default.conf2
-rw-r--r--tests/test_json.py2
39 files changed, 335 insertions, 335 deletions
diff --git a/pyload/Core.py b/pyload/Core.py
index 47cd715d3..dd31b95e4 100755
--- a/pyload/Core.py
+++ b/pyload/Core.py
@@ -353,7 +353,7 @@ class Core(object):
self.setupDB()
if self.config.oldRemoteData:
self.log.info(_("Moving old user config to DB"))
- self.db.addUser(self.config.oldRemoteData["username"], self.config.oldRemoteData["password"])
+ self.db.addUser(self.config.oldRemoteData['username'], self.config.oldRemoteData['password'])
self.log.info(_("Please check your logindata with ./pyload.py -u"))
diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py
index 9338b5337..62af70cf8 100644
--- a/pyload/api/__init__.py
+++ b/pyload/api/__init__.py
@@ -92,30 +92,30 @@ class Api(Iface):
def _convertPyFile(self, p):
- fdata = FileData(p["id"], p["url"], p["name"], p["plugin"], p["size"],
- p["format_size"], p["status"], p["statusmsg"],
- p["package"], p["error"], p["order"])
+ fdata = FileData(p['id'], p['url'], p['name'], p['plugin'], p['size'],
+ p['format_size'], p['status'], p['statusmsg'],
+ p['package'], p['error'], p['order'])
return fdata
def _convertConfigFormat(self, c):
sections = {}
for sectionName, sub in c.iteritems():
- section = ConfigSection(sectionName, sub["desc"])
+ section = ConfigSection(sectionName, sub['desc'])
items = []
for key, data in sub.iteritems():
if key in ("desc", "outline"):
continue
item = ConfigItem()
item.name = key
- item.description = data["desc"]
+ item.description = data['desc']
item.value = str(data['value']) if not isinstance(data['value'], basestring) else data['value']
item.type = data['type']
items.append(item)
section.items = items
sections[sectionName] = section
if "outline" in sub:
- section.outline = sub["outline"]
+ section.outline = sub['outline']
return sections
@@ -424,7 +424,7 @@ class Api(Iface):
"""
result = self.core.threadManager.getInfoResult(rid)
if "ALL_INFO_FETCHED" in result:
- del result["ALL_INFO_FETCHED"]
+ del result['ALL_INFO_FETCHED']
return OnlineCheck(-1, result)
else:
return OnlineCheck(rid, result)
@@ -475,9 +475,9 @@ class Api(Iface):
data = self.core.files.getPackageData(int(pid))
if not data:
raise PackageDoesNotExists(pid)
- return PackageData(data["id"], data["name"], data["folder"], data["site"], data["password"],
- data["queue"], data["order"],
- links=[self._convertPyFile(x) for x in data["links"].itervalues()])
+ return PackageData(data['id'], data['name'], data['folder'], data['site'], data['password'],
+ data['queue'], data['order'],
+ links=[self._convertPyFile(x) for x in data['links'].itervalues()])
@permission(PERMS.LIST)
@@ -491,9 +491,9 @@ class Api(Iface):
if not data:
raise PackageDoesNotExists(pid)
- return PackageData(data["id"], data["name"], data["folder"], data["site"], data["password"],
- data["queue"], data["order"],
- fids=[int(x) for x in data["links"]])
+ return PackageData(data['id'], data['name'], data['folder'], data['site'], data['password'],
+ data['queue'], data['order'],
+ fids=[int(x) for x in data['links']])
@permission(PERMS.LIST)
@@ -538,10 +538,10 @@ class Api(Iface):
:return: list of `PackageInfo`
"""
- return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"],
- pack["password"], pack["queue"], pack["order"],
- pack["linksdone"], pack["sizedone"], pack["sizetotal"],
- pack["linkstotal"])
+ return [PackageData(pack['id'], pack['name'], pack['folder'], pack['site'],
+ pack['password'], pack['queue'], pack['order'],
+ pack['linksdone'], pack['sizedone'], pack['sizetotal'],
+ pack['linkstotal'])
for pack in self.core.files.getInfoData(Destination.Queue).itervalues()]
@@ -552,10 +552,10 @@ class Api(Iface):
:return: list of `PackageData`
"""
- return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"],
- pack["password"], pack["queue"], pack["order"],
- pack["linksdone"], pack["sizedone"], pack["sizetotal"],
- links=[self._convertPyFile(x) for x in pack["links"].itervalues()])
+ return [PackageData(pack['id'], pack['name'], pack['folder'], pack['site'],
+ pack['password'], pack['queue'], pack['order'],
+ pack['linksdone'], pack['sizedone'], pack['sizetotal'],
+ links=[self._convertPyFile(x) for x in pack['links'].itervalues()])
for pack in self.core.files.getCompleteData(Destination.Queue).itervalues()]
@@ -565,10 +565,10 @@ class Api(Iface):
:return: list of `PackageInfo`
"""
- return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"],
- pack["password"], pack["queue"], pack["order"],
- pack["linksdone"], pack["sizedone"], pack["sizetotal"],
- pack["linkstotal"])
+ return [PackageData(pack['id'], pack['name'], pack['folder'], pack['site'],
+ pack['password'], pack['queue'], pack['order'],
+ pack['linksdone'], pack['sizedone'], pack['sizetotal'],
+ pack['linkstotal'])
for pack in self.core.files.getInfoData(Destination.Collector).itervalues()]
@@ -578,10 +578,10 @@ class Api(Iface):
:return: list of `PackageInfo`
"""
- return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"],
- pack["password"], pack["queue"], pack["order"],
- pack["linksdone"], pack["sizedone"], pack["sizetotal"],
- links=[self._convertPyFile(x) for x in pack["links"].itervalues()])
+ return [PackageData(pack['id'], pack['name'], pack['folder'], pack['site'],
+ pack['password'], pack['queue'], pack['order'],
+ pack['linksdone'], pack['sizedone'], pack['sizetotal'],
+ links=[self._convertPyFile(x) for x in pack['links'].itervalues()])
for pack in self.core.files.getCompleteData(Destination.Collector).itervalues()]
@@ -777,9 +777,9 @@ class Api(Iface):
order = {}
for pid in packs:
pack = self.core.files.getPackageData(int(pid))
- while pack["order"] in order.keys(): # just in case
- pack["order"] += 1
- order[pack["order"]] = pack["id"]
+ while pack['order'] in order.keys(): # just in case
+ pack['order'] += 1
+ order[pack['order']] = pack['id']
return order
@@ -792,10 +792,10 @@ class Api(Iface):
"""
rawdata = self.core.files.getPackageData(int(pid))
order = {}
- for id, pyfile in rawdata["links"].iteritems():
- while pyfile["order"] in order.keys(): # just in case
- pyfile["order"] += 1
- order[pyfile["order"]] = pyfile["id"]
+ for id, pyfile in rawdata['links'].iteritems():
+ while pyfile['order'] in order.keys(): # just in case
+ pyfile['order'] += 1
+ order[pyfile['order']] = pyfile['id']
return order
@@ -894,8 +894,8 @@ class Api(Iface):
"""
accs = self.core.accountManager.getAccountInfos(False, refresh)
for group in accs.values():
- accounts = [AccountInfo(acc["validuntil"], acc["login"], acc["options"], acc["valid"],
- acc["trafficleft"], acc["maxtraffic"], acc["premium"], acc['type'])
+ accounts = [AccountInfo(acc['validuntil'], acc['login'], acc['options'], acc['valid'],
+ acc['trafficleft'], acc['maxtraffic'], acc['premium'], acc['type'])
for acc in group]
return accounts or []
@@ -958,9 +958,9 @@ class Api(Iface):
:param userdata: dictionary of user data
:return: boolean
"""
- if userdata == "local" or userdata["role"] == ROLE.ADMIN:
+ if userdata == "local" or userdata['role'] == ROLE.ADMIN:
return True
- elif func in permMap and has_permission(userdata["permission"], permMap[func]):
+ elif func in permMap and has_permission(userdata['permission'], permMap[func]):
return True
else:
return False
@@ -971,14 +971,14 @@ class Api(Iface):
"""similar to `checkAuth` but returns UserData thrift type """
user = self.checkAuth(username, password)
if user:
- return UserData(user["name"], user["email"], user["role"], user["permission"], user["template"])
+ return UserData(user['name'], user['email'], user['role'], user['permission'], user['template'])
else:
return UserData()
def getAllUserData(self):
"""returns all known user and info"""
- return dict((user, UserData(user, data["email"], data["role"], data["permission"], data["template"])) for user, data
+ return dict((user, UserData(user, data['email'], data['role'], data['permission'], data['template'])) for user, data
in self.core.db.getAllUserData().iteritems())
diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py
index 4d6c3160d..fba6dc3da 100644
--- a/pyload/cli/Cli.py
+++ b/pyload/cli/Cli.py
@@ -402,10 +402,10 @@ def print_help(config):
print
print " -u, --username=", " " * 2, "Specify Username"
print " --pw=<password>", " " * 2, "Password"
- print " -a, --address=", " " * 3, "Specify address (current=%s)" % config["addr"]
- print " -p, --port", " " * 7, "Specify port (current=%s)" % config["port"]
+ print " -a, --address=", " " * 3, "Specify address (current=%s)" % config['addr']
+ print " -p, --port", " " * 7, "Specify port (current=%s)" % config['port']
print
- print " -l, --language", " " * 3, "Set user interface language (current=%s)" % config["language"]
+ print " -l, --language", " " * 3, "Set user interface language (current=%s)" % config['language']
print " -h, --help", " " * 7, "Display this help screen"
print " -c, --commands", " " * 3, "List all available commands"
print
@@ -474,12 +474,12 @@ def writeConfig(opts):
def main():
config = {"addr": "127.0.0.1", "port": "7227", "language": "en"}
try:
- config["language"] = os.environ["LANG"][0:2]
+ config['language'] = os.environ['LANG'][0:2]
except Exception:
pass
- if (not exists(join(pypath, "locale", config["language"]))) or config["language"] == "":
- config["language"] = "en"
+ if (not exists(join(pypath, "locale", config['language']))) or config['language'] == "":
+ config['language'] = "en"
configFile = ConfigParser.ConfigParser()
configFile.read(join(homedir, ".pyload-cli"))
@@ -490,7 +490,7 @@ def main():
gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None])
translation = gettext.translation("Cli", join(pypath, "locale"),
- languages=[config["language"], "en"], fallback=True)
+ languages=[config['language'], "en"], fallback=True)
translation.install(unicode=True)
interactive = False
@@ -509,14 +509,14 @@ def main():
elif option in ("-u", "--username"):
username = params
elif option in ("-a", "--address"):
- config["addr"] = params
+ config['addr'] = params
elif option in ("-p", "--port"):
- config["port"] = params
+ config['port'] = params
elif option in ("-l", "--language"):
- config["language"] = params
+ config['language'] = params
gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None])
translation = gettext.translation("Cli", join(pypath, "locale"),
- languages=[config["language"], "en"], fallback=True)
+ languages=[config['language'], "en"], fallback=True)
translation.install(unicode=True)
elif option in ("-h", "--help"):
print_help(config)
@@ -539,19 +539,19 @@ def main():
if interactive:
try:
- client = ThriftClient(config["addr"], int(config["port"]), username, password)
+ client = ThriftClient(config['addr'], int(config['port']), username, password)
except WrongLogin:
pass
except NoSSL:
print _("You need py-openssl to connect to this pyLoad Core.")
exit()
except NoConnection:
- config["addr"] = False
- config["port"] = False
+ config['addr'] = False
+ config['port'] = False
if not client:
- if not config["addr"]: config["addr"] = raw_input(_("Address: "))
- if not config["port"]: config["port"] = raw_input(_("Port: "))
+ if not config['addr']: config['addr'] = raw_input(_("Address: "))
+ if not config['port']: config['port'] = raw_input(_("Port: "))
if not username: username = raw_input(_("Username: "))
if not password:
from getpass import getpass
@@ -559,21 +559,21 @@ def main():
password = getpass(_("Password: "))
try:
- client = ThriftClient(config["addr"], int(config["port"]), username, password)
+ client = ThriftClient(config['addr'], int(config['port']), username, password)
except WrongLogin:
print _("Login data is wrong.")
except NoConnection:
- print _("Could not establish connection to %(addr)s:%(port)s." % {"addr": config["addr"],
- "port": config["port"]})
+ print _("Could not establish connection to %(addr)s:%(port)s." % {"addr": config['addr'],
+ "port": config['port']})
else:
try:
- client = ThriftClient(config["addr"], int(config["port"]), username, password)
+ client = ThriftClient(config['addr'], int(config['port']), username, password)
except WrongLogin:
print _("Login data is wrong.")
except NoConnection:
- print _("Could not establish connection to %(addr)s:%(port)s." % {"addr": config["addr"],
- "port": config["port"]})
+ print _("Could not establish connection to %(addr)s:%(port)s." % {"addr": config['addr'],
+ "port": config['port']})
except NoSSL:
print _("You need py-openssl to connect to this pyLoad core.")
diff --git a/pyload/config/Parser.py b/pyload/config/Parser.py
index ed81d041c..d2ec9bde2 100644
--- a/pyload/config/Parser.py
+++ b/pyload/config/Parser.py
@@ -89,12 +89,12 @@ class ConfigParser(object):
try:
homeconf = self.parseConfig("pyload.conf")
- if "username" in homeconf["remote"]:
- if "password" in homeconf["remote"]:
- self.oldRemoteData = {"username": homeconf["remote"]["username"]['value'],
- "password": homeconf["remote"]["username"]['value']}
- del homeconf["remote"]["password"]
- del homeconf["remote"]["username"]
+ if "username" in homeconf['remote']:
+ if "password" in homeconf['remote']:
+ self.oldRemoteData = {"username": homeconf['remote']['username']['value'],
+ "password": homeconf['remote']['username']['value']}
+ del homeconf['remote']['password']
+ del homeconf['remote']['username']
self.updateValues(homeconf, self.config)
except Exception:
print "Config Warning"
@@ -211,7 +211,7 @@ class ConfigParser(object):
chmod(filename, 0600)
f.write("version: %i \n" % CONF_VERSION)
for section in config.iterkeys():
- f.write('\n%s - "%s":\n' % (section, config[section]["desc"]))
+ f.write('\n%s - "%s":\n' % (section, config[section]['desc']))
for option, data in config[section].iteritems():
if option in ("desc", "outline"): continue
@@ -227,9 +227,9 @@ class ConfigParser(object):
else:
value = str(data['value']) + "\n"
try:
- f.write('\t%s %s : "%s" = %s' % (data['type'], option, data["desc"], value))
+ f.write('\t%s %s : "%s" = %s' % (data['type'], option, data['desc'], value))
except UnicodeEncodeError:
- f.write('\t%s %s : "%s" = %s' % (data['type'], option, data["desc"], encode(value)))
+ f.write('\t%s %s : "%s" = %s' % (data['type'], option, data['desc'], encode(value)))
def cast(self, typ, value):
@@ -313,12 +313,12 @@ class ConfigParser(object):
self.plugin[name] = conf
else:
conf = self.plugin[name]
- conf["outline"] = outline
+ conf['outline'] = outline
for item in config:
if item[0] in conf:
conf[item[0]]['type'] = item[1]
- conf[item[0]]["desc"] = item[2]
+ conf[item[0]]['desc'] = item[2]
else:
conf[item[0]] = {
"desc": item[2],
diff --git a/pyload/database/File.py b/pyload/database/File.py
index 205cbba1a..faf68b246 100644
--- a/pyload/database/File.py
+++ b/pyload/database/File.py
@@ -91,8 +91,8 @@ class FileHandler(object):
packs[x.id].update(x.toDict()[x.id])
for key, value in data.iteritems():
- if value["package"] in packs:
- packs[value["package"]]["links"][key] = value
+ if value['package'] in packs:
+ packs[value['package']]['links'][key] = value
return packs
@@ -277,11 +277,11 @@ class FileHandler(object):
cache = self.cache.values()
for x in cache:
- if int(x.toDbDict()[x.id]["package"]) == int(id):
+ if int(x.toDbDict()[x.id]['package']) == int(id):
tmplist.append((x.id, x.toDbDict()[x.id]))
data.update(tmplist)
- pack["links"] = data
+ pack['links'] = data
return pack
@@ -364,7 +364,7 @@ class FileHandler(object):
if jobs:
return self.getFile(jobs[0])
else:
- self.jobCache["decrypt"] = "empty"
+ self.jobCache['decrypt'] = "empty"
return None
@@ -516,20 +516,20 @@ class FileHandler(object):
f = self.getFileData(id)
f = f[id]
- e = RemoveEvent("file", id, "collector" if not self.getPackage(f["package"]).queue else "queue")
+ e = RemoveEvent("file", id, "collector" if not self.getPackage(f['package']).queue else "queue")
self.core.pullManager.addEvent(e)
self.db.reorderLink(f, position)
pyfiles = self.cache.values()
for pyfile in pyfiles:
- if pyfile.packageid != f["package"] or pyfile.order < 0: continue
- if f["order"] > position:
- if pyfile.order >= position and pyfile.order < f["order"]:
+ if pyfile.packageid != f['package'] or pyfile.order < 0: continue
+ if f['order'] > position:
+ if pyfile.order >= position and pyfile.order < f['order']:
pyfile.order += 1
pyfile.notifyChange()
- elif f["order"] < position:
- if pyfile.order <= position and pyfile.order > f["order"]:
+ elif f['order'] < position:
+ if pyfile.order <= position and pyfile.order > f['order']:
pyfile.order -= 1
pyfile.notifyChange()
@@ -538,7 +538,7 @@ class FileHandler(object):
self.db.commit()
- e = InsertEvent("file", id, position, "collector" if not self.getPackage(f["package"]).queue else "queue")
+ e = InsertEvent("file", id, position, "collector" if not self.getPackage(f['package']).queue else "queue")
self.core.pullManager.addEvent(e)
@@ -568,8 +568,8 @@ class FileHandler(object):
urls = []
for pyfile in data.itervalues():
- if pyfile["status"] not in (0, 12, 13):
- urls.append((pyfile["url"], pyfile["plugin"]))
+ if pyfile['status'] not in (0, 12, 13):
+ urls.append((pyfile['url'], pyfile['plugin']))
self.core.threadManager.createInfoThread(urls, pid)
@@ -842,12 +842,12 @@ class FileMethods(object):
@style.queue
def reorderLink(self, f, position):
""" reorder link with f as dict for pyfile """
- if f["order"] > position:
- self.c.execute('UPDATE links SET linkorder=linkorder+1 WHERE linkorder >= ? AND linkorder < ? AND package=?', (position, f["order"], f["package"]))
- elif f["order"] < position:
- self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder <= ? AND linkorder > ? AND package=?', (position, f["order"], f["package"]))
+ if f['order'] > position:
+ self.c.execute('UPDATE links SET linkorder=linkorder+1 WHERE linkorder >= ? AND linkorder < ? AND package=?', (position, f['order'], f['package']))
+ elif f['order'] < position:
+ self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder <= ? AND linkorder > ? AND package=?', (position, f['order'], f['package']))
- self.c.execute('UPDATE links SET linkorder=? WHERE id=?', (position, f["id"]))
+ self.c.execute('UPDATE links SET linkorder=? WHERE id=?', (position, f['id']))
@style.queue
diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py
index 69a77fdf8..e99b1cea6 100644
--- a/pyload/manager/Plugin.py
+++ b/pyload/manager/Plugin.py
@@ -230,7 +230,7 @@ class PluginManager(object):
elif name not in self.plugins[type]:
self.core.log.warning(_("Plugin [%(type)s] %(name)s not found | Using plugin: [internal] BasePlugin")
% {'name': name, 'type': type})
- return self.internalPlugins["BasePlugin"]
+ return self.internalPlugins['BasePlugin']
else:
return self.plugins[type][name]
diff --git a/pyload/manager/thread/Addon.py b/pyload/manager/thread/Addon.py
index f3d219989..1da164543 100644
--- a/pyload/manager/thread/Addon.py
+++ b/pyload/manager/thread/Addon.py
@@ -55,14 +55,14 @@ class AddonThread(PluginThread):
def run(self):
try:
try:
- self.kwargs["thread"] = self
+ self.kwargs['thread'] = self
self.f(*self.args, **self.kwargs)
except TypeError, e:
#dirty method to filter out exceptions
if "unexpected keyword argument 'thread'" not in e.args[0]:
raise
- del self.kwargs["thread"]
+ del self.kwargs['thread']
self.f(*self.args, **self.kwargs)
finally:
local = copy(self.active)
diff --git a/pyload/manager/thread/Info.py b/pyload/manager/thread/Info.py
index 487c3b924..28a2e8e91 100644
--- a/pyload/manager/thread/Info.py
+++ b/pyload/manager/thread/Info.py
@@ -117,7 +117,7 @@ class InfoThread(PluginThread):
self.updateResult(pluginname, result, True)
- self.m.infoResults[self.rid]["ALL_INFO_FETCHED"] = {}
+ self.m.infoResults[self.rid]['ALL_INFO_FETCHED'] = {}
self.m.timestamp = time() + 5 * 60
diff --git a/pyload/network/Browser.py b/pyload/network/Browser.py
index fab7454f3..59cc9dcb0 100644
--- a/pyload/network/Browser.py
+++ b/pyload/network/Browser.py
@@ -118,12 +118,12 @@ class Browser(object):
:param pwd: string, user:password
"""
- self.options["auth"] = pwd
+ self.options['auth'] = pwd
self.renewHTTPRequest() #: we need a new request
def removeAuth(self):
- if "auth" in self.options: del self.options["auth"]
+ if "auth" in self.options: del self.options['auth']
self.renewHTTPRequest()
diff --git a/pyload/network/CookieJar.py b/pyload/network/CookieJar.py
index 35d7fa6ef..a970a08e5 100644
--- a/pyload/network/CookieJar.py
+++ b/pyload/network/CookieJar.py
@@ -24,8 +24,8 @@ class CookieJar(Cookie.SimpleCookie):
def setCookie(self, domain, name, value, path="/", exp=None, secure="FALSE"):
self[name] = value
- self[name]["domain"] = domain
- self[name]["path"] = path
+ self[name]['domain'] = domain
+ self[name]['path'] = path
# Value of expires should be integer if possible
# otherwise the cookie won't be used
@@ -37,7 +37,7 @@ class CookieJar(Cookie.SimpleCookie):
except ValueError:
expires = exp
- self[name]["expires"] = expires
+ self[name]['expires'] = expires
if secure == "TRUE":
- self[name]["secure"] = secure
+ self[name]['secure'] = secure
diff --git a/pyload/network/HTTPRequest.py b/pyload/network/HTTPRequest.py
index 3e5903df3..62c0ef72b 100644
--- a/pyload/network/HTTPRequest.py
+++ b/pyload/network/HTTPRequest.py
@@ -93,24 +93,24 @@ class HTTPRequest(object):
def setInterface(self, options):
- interface, proxy, ipv6 = options["interface"], options["proxies"], options["ipv6"]
+ interface, proxy, ipv6 = options['interface'], options['proxies'], options['ipv6']
if interface and interface.lower() != "none":
self.c.setopt(pycurl.INTERFACE, str(interface))
if proxy:
- if proxy["type"] == "socks4":
+ if proxy['type'] == "socks4":
self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS4)
- elif proxy["type"] == "socks5":
+ elif proxy['type'] == "socks5":
self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
else:
self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
- self.c.setopt(pycurl.PROXY, str(proxy["address"]))
- self.c.setopt(pycurl.PROXYPORT, proxy["port"])
+ self.c.setopt(pycurl.PROXY, str(proxy['address']))
+ self.c.setopt(pycurl.PROXYPORT, proxy['port'])
- if proxy["username"]:
- self.c.setopt(pycurl.PROXYUSERPWD, str("%s:%s" % (proxy["username"], proxy["password"])))
+ if proxy['username']:
+ self.c.setopt(pycurl.PROXYUSERPWD, str("%s:%s" % (proxy['username'], proxy['password'])))
if ipv6:
self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_WHATEVER)
@@ -118,10 +118,10 @@ class HTTPRequest(object):
self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4)
if "auth" in options:
- self.c.setopt(pycurl.USERPWD, str(options["auth"]))
+ self.c.setopt(pycurl.USERPWD, str(options['auth']))
if "timeout" in options:
- self.c.setopt(pycurl.LOW_SPEED_TIME, options["timeout"])
+ self.c.setopt(pycurl.LOW_SPEED_TIME, options['timeout'])
def addCookies(self):
diff --git a/pyload/network/XDCCRequest.py b/pyload/network/XDCCRequest.py
index 01fc2ea78..ccaeebe5f 100644
--- a/pyload/network/XDCCRequest.py
+++ b/pyload/network/XDCCRequest.py
@@ -34,10 +34,10 @@ class XDCCRequest(object):
# proxy = None
# if self.proxies.has_key("socks5"):
# proxytype = socks.PROXY_TYPE_SOCKS5
- # proxy = self.proxies["socks5"]
+ # proxy = self.proxies['socks5']
# elif self.proxies.has_key("socks4"):
# proxytype = socks.PROXY_TYPE_SOCKS4
- # proxy = self.proxies["socks4"]
+ # proxy = self.proxies['socks4']
# if proxytype:
# sock = socks.socksocket()
# t = _parse_proxy(proxy)
diff --git a/pyload/plugin/Account.py b/pyload/plugin/Account.py
index 23f15e8fd..bc13c0497 100644
--- a/pyload/plugin/Account.py
+++ b/pyload/plugin/Account.py
@@ -166,7 +166,7 @@ class Account(Base):
infos['timestamp'] = time()
self.infos[name] = infos
- elif "timestamp" in self.infos[name] and self.infos[name]["timestamp"] + self.info_threshold * 60 < time():
+ elif "timestamp" in self.infos[name] and self.infos[name]['timestamp'] + self.info_threshold * 60 < time():
self.logDebug("Reached timeout for account data")
self.scheduleRefresh(name)
diff --git a/pyload/plugin/account/NoPremiumPl.py b/pyload/plugin/account/NoPremiumPl.py
index d825b38ed..98f472848 100644
--- a/pyload/plugin/account/NoPremiumPl.py
+++ b/pyload/plugin/account/NoPremiumPl.py
@@ -43,10 +43,10 @@ class NoPremiumPl(Account):
premium = False
valid_untill = -1
- if "expire" in result.keys() and result["expire"]:
+ if "expire" in result.keys() and result['expire']:
premium = True
- valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple())
- traffic_left = result["balance"] * 2 ** 20
+ valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple())
+ traffic_left = result['balance'] * 2 ** 20
return ({
"validuntil": valid_untill,
@@ -57,7 +57,7 @@ class NoPremiumPl(Account):
def login(self, user, data, req):
self._usr = user
- self._pwd = hashlib.sha1(hashlib.md5(data["password"]).hexdigest()).hexdigest()
+ self._pwd = hashlib.sha1(hashlib.md5(data['password']).hexdigest()).hexdigest()
self._req = req
try:
@@ -73,8 +73,8 @@ class NoPremiumPl(Account):
def createAuthQuery(self):
query = self._api_query
- query["username"] = self._usr
- query["password"] = self._pwd
+ query['username'] = self._usr
+ query['password'] = self._pwd
return query
diff --git a/pyload/plugin/account/RapideoPl.py b/pyload/plugin/account/RapideoPl.py
index d40c76cb5..d1cb47826 100644
--- a/pyload/plugin/account/RapideoPl.py
+++ b/pyload/plugin/account/RapideoPl.py
@@ -42,11 +42,11 @@ class RapideoPl(Account):
premium = False
valid_untill = -1
- if "expire" in result.keys() and result["expire"]:
+ if "expire" in result.keys() and result['expire']:
premium = True
- valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple())
+ valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple())
- traffic_left = result["balance"]
+ traffic_left = result['balance']
return ({
"validuntil": valid_untill,
@@ -57,7 +57,7 @@ class RapideoPl(Account):
def login(self, user, data, req):
self._usr = user
- self._pwd = hashlib.md5(data["password"]).hexdigest()
+ self._pwd = hashlib.md5(data['password']).hexdigest()
self._req = req
try:
response = json_loads(self.runAuthQuery())
@@ -72,8 +72,8 @@ class RapideoPl(Account):
def createAuthQuery(self):
query = self._api_query
- query["username"] = self._usr
- query["password"] = self._pwd
+ query['username'] = self._usr
+ query['password'] = self._pwd
return query
diff --git a/pyload/plugin/account/SmoozedCom.py b/pyload/plugin/account/SmoozedCom.py
index 7f4beb7d9..ae247b2b0 100644
--- a/pyload/plugin/account/SmoozedCom.py
+++ b/pyload/plugin/account/SmoozedCom.py
@@ -46,10 +46,10 @@ class SmoozedCom(Account):
'premium' : False}
else:
# Parse account info
- info = {'validuntil' : float(status["data"]["user"]["user_premium"]),
- 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]),
- 'session' : status["data"]["session_key"],
- 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]}
+ info = {'validuntil' : float(status['data']['user']['user_premium']),
+ 'trafficleft': max(0, status['data']['traffic'][1] - status['data']['traffic'][0]),
+ 'session' : status['data']['session_key'],
+ 'hosters' : [hoster['name'] for hoster in status['data']['hoster']]}
if info['validuntil'] < time.time():
info['premium'] = False
diff --git a/pyload/plugin/account/UploadableCh.py b/pyload/plugin/account/UploadableCh.py
index 15717db44..c95fe7f0b 100644
--- a/pyload/plugin/account/UploadableCh.py
+++ b/pyload/plugin/account/UploadableCh.py
@@ -25,7 +25,7 @@ class UploadableCh(Account):
def login(self, user, data, req):
html = req.load("http://www.uploadable.ch/login.php",
post={'userName' : user,
- 'userPassword' : data["password"],
+ 'userPassword' : data['password'],
'autoLogin' : "1",
'action__login': "normalLogin"},
decode=True)
diff --git a/pyload/plugin/account/WebshareCz.py b/pyload/plugin/account/WebshareCz.py
index 47dfed255..5cbe6b1b8 100644
--- a/pyload/plugin/account/WebshareCz.py
+++ b/pyload/plugin/account/WebshareCz.py
@@ -51,7 +51,7 @@ class WebshareCz(Account):
self.wrongPassword()
salt = re.search('<salt>(.+)</salt>', salt).group(1)
- password = sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest()
+ password = sha1(md5_crypt.encrypt(data['password'], salt=salt)).hexdigest()
digest = md5(user + ":Webshare:" + password).hexdigest()
login = req.load("https://webshare.cz/api/login/",
diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py
index b6d86adab..9d01965e0 100644
--- a/pyload/plugin/extractor/SevenZip.py
+++ b/pyload/plugin/extractor/SevenZip.py
@@ -139,8 +139,8 @@ class SevenZip(UnRar):
args.append("-y")
#set a password
- if "password" in kwargs and kwargs["password"]:
- args.append("-p%s" % kwargs["password"])
+ if "password" in kwargs and kwargs['password']:
+ args.append("-p%s" % kwargs['password'])
else:
args.append("-p-")
diff --git a/pyload/plugin/hook/Captcha9Kw.py b/pyload/plugin/hook/Captcha9Kw.py
index 9cb8e7928..bbf283623 100644
--- a/pyload/plugin/hook/Captcha9Kw.py
+++ b/pyload/plugin/hook/Captcha9Kw.py
@@ -138,7 +138,7 @@ class Captcha9kw(Hook):
self.logDebug(_("NewCaptchaID ticket: %s") % res, task.captchaFile)
- task.data["ticket"] = res
+ task.data['ticket'] = res
for _i in xrange(int(self.getConfig('timeout') / 5)):
result = getURL(self.API_URL,
@@ -231,7 +231,7 @@ class Captcha9kw(Hook):
'correct': "1" if correct else "2",
'pyload' : "1",
'source' : "pyload",
- 'id' : task.data["ticket"]})
+ 'id' : task.data['ticket']})
self.logDebug("Request %s: %s" % (type, res))
diff --git a/pyload/plugin/hook/NoPremiumPl.py b/pyload/plugin/hook/NoPremiumPl.py
index 05bd6c0ba..527413a88 100644
--- a/pyload/plugin/hook/NoPremiumPl.py
+++ b/pyload/plugin/hook/NoPremiumPl.py
@@ -22,7 +22,7 @@ class NoPremiumPl(MultiHook):
def getHosters(self):
hostings = json_loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip())
- hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"]
+ hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
self.logDebug(hostings_domains)
diff --git a/pyload/plugin/hook/RapideoPl.py b/pyload/plugin/hook/RapideoPl.py
index a850c7710..1761659db 100644
--- a/pyload/plugin/hook/RapideoPl.py
+++ b/pyload/plugin/hook/RapideoPl.py
@@ -22,7 +22,7 @@ class RapideoPl(MultiHook):
def getHosters(self):
hostings = json_loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip())
- hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"]
+ hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
self.logDebug(hostings_domains)
diff --git a/pyload/plugin/hook/XFileSharingPro.py b/pyload/plugin/hook/XFileSharingPro.py
index 1f3a27fd5..3c16c618a 100644
--- a/pyload/plugin/hook/XFileSharingPro.py
+++ b/pyload/plugin/hook/XFileSharingPro.py
@@ -82,7 +82,7 @@ class XFileSharingPro(Hook):
pattern = self.regexp[type][1] % match_list.replace('.', '\.')
- dict = self.core.pluginManager.plugins[type]["XFileSharingPro"]
+ dict = self.core.pluginManager.plugins[type]['XFileSharingPro']
dict['pattern'] = pattern
dict['re'] = re.compile(pattern)
@@ -90,7 +90,7 @@ class XFileSharingPro(Hook):
def _unload(self, type):
- dict = self.core.pluginManager.plugins[type]["XFileSharingPro"]
+ dict = self.core.pluginManager.plugins[type]['XFileSharingPro']
dict['pattern'] = r'^unmatchable$'
dict['re'] = re.compile(dict['pattern'])
diff --git a/pyload/plugin/hoster/NoPremiumPl.py b/pyload/plugin/hoster/NoPremiumPl.py
index 109932721..8921afe1c 100644
--- a/pyload/plugin/hoster/NoPremiumPl.py
+++ b/pyload/plugin/hoster/NoPremiumPl.py
@@ -46,9 +46,9 @@ class NoPremiumPl(MultiHoster):
def runFileQuery(self, url, mode=None):
query = self.API_QUERY.copy()
- query["username"] = self.usr
- query["password"] = self.pwd
- query["url"] = url
+ query['username'] = self.usr
+ query['password'] = self.pwd
+ query['url'] = url
if mode == "fileinfo":
query['check'] = 2
@@ -77,24 +77,24 @@ class NoPremiumPl(MultiHoster):
self.logDebug(parsed)
if "errno" in parsed.keys():
- if parsed["errno"] in self.ERROR_CODES:
+ if parsed['errno'] in self.ERROR_CODES:
# error code in known
- self.fail(self.ERROR_CODES[parsed["errno"]] % self.__class__.__name__)
+ self.fail(self.ERROR_CODES[parsed['errno']] % self.__class__.__name__)
else:
# error code isn't yet added to plugin
self.fail(
- parsed["errstring"]
- or _("Unknown error (code: %s)") % parsed["errno"]
+ parsed['errstring']
+ or _("Unknown error (code: %s)") % parsed['errno']
)
if "sdownload" in parsed:
- if parsed["sdownload"] == "1":
+ if parsed['sdownload'] == "1":
self.fail(
_("Download from %s is possible only using NoPremium.pl website \
- directly") % parsed["hosting"])
+ directly") % parsed['hosting'])
- pyfile.name = parsed["filename"]
- pyfile.size = parsed["filesize"]
+ pyfile.name = parsed['filename']
+ pyfile.size = parsed['filesize']
try:
self.link = self.runFileQuery(pyfile.url, 'filedownload')
diff --git a/pyload/plugin/hoster/RapideoPl.py b/pyload/plugin/hoster/RapideoPl.py
index 70e3fd853..e19ccc45b 100644
--- a/pyload/plugin/hoster/RapideoPl.py
+++ b/pyload/plugin/hoster/RapideoPl.py
@@ -46,9 +46,9 @@ class RapideoPl(MultiHoster):
def runFileQuery(self, url, mode=None):
query = self.API_QUERY.copy()
- query["username"] = self.usr
- query["password"] = self.pwd
- query["url"] = url
+ query['username'] = self.usr
+ query['password'] = self.pwd
+ query['url'] = url
if mode == "fileinfo":
query['check'] = 2
@@ -77,24 +77,24 @@ class RapideoPl(MultiHoster):
self.logDebug(parsed)
if "errno" in parsed.keys():
- if parsed["errno"] in self.ERROR_CODES:
+ if parsed['errno'] in self.ERROR_CODES:
# error code in known
- self.fail(self.ERROR_CODES[parsed["errno"]] % self.__class__.__name__)
+ self.fail(self.ERROR_CODES[parsed['errno']] % self.__class__.__name__)
else:
# error code isn't yet added to plugin
self.fail(
- parsed["errstring"]
- or _("Unknown error (code: %s)") % parsed["errno"]
+ parsed['errstring']
+ or _("Unknown error (code: %s)") % parsed['errno']
)
if "sdownload" in parsed:
- if parsed["sdownload"] == "1":
+ if parsed['sdownload'] == "1":
self.fail(
_("Download from %s is possible only using Rapideo.pl website \
- directly") % parsed["hosting"])
+ directly") % parsed['hosting'])
- pyfile.name = parsed["filename"]
- pyfile.size = parsed["filesize"]
+ pyfile.name = parsed['filename']
+ pyfile.size = parsed['filesize']
try:
self.link = self.runFileQuery(pyfile.url, 'filedownload')
diff --git a/pyload/plugin/hoster/SmoozedCom.py b/pyload/plugin/hoster/SmoozedCom.py
index 6d62cef23..1ed3a539d 100644
--- a/pyload/plugin/hoster/SmoozedCom.py
+++ b/pyload/plugin/hoster/SmoozedCom.py
@@ -35,17 +35,17 @@ class SmoozedCom(MultiHoster):
data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data))
- if data["state"] != "ok":
- self.fail(data["message"])
+ if data['state'] != "ok":
+ self.fail(data['message'])
- if data["data"].get("state", "ok") != "ok":
- if data["data"] == "Offline":
+ if data['data'].get("state", "ok") != "ok":
+ if data['data'] == "Offline":
self.offline()
else:
- self.fail(data["data"]["message"])
+ self.fail(data['data']['message'])
- pyfile.name = data["data"]["name"]
- pyfile.size = int(data["data"]["size"])
+ pyfile.name = data['data']['name']
+ pyfile.size = int(data['data']['size'])
# Start the download
header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True)
@@ -53,7 +53,7 @@ class SmoozedCom(MultiHoster):
if not "location" in header:
self.fail(_("Unable to initialize download"))
else:
- self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"]
+ self.link = header['location'][-1] if isinstance(header['location'], list) else header['location']
def checkFile(self, rules={}):
diff --git a/pyload/plugin/hoster/WebshareCz.py b/pyload/plugin/hoster/WebshareCz.py
index 11b7b37b0..49a8da89f 100644
--- a/pyload/plugin/hoster/WebshareCz.py
+++ b/pyload/plugin/hoster/WebshareCz.py
@@ -34,7 +34,7 @@ class WebshareCz(SimpleHoster):
if 'File not found' in api_data:
info['status'] = 1
else:
- info["status"] = 2
+ info['status'] = 2
info['name'] = re.search('<name>(.+)</name>', api_data).group(1) or info['name']
info['size'] = re.search('<size>(.+)</size>', api_data).group(1) or info['size']
diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py
index a062df458..dd78071c9 100644
--- a/pyload/plugin/hoster/ZippyshareCom.py
+++ b/pyload/plugin/hoster/ZippyshareCom.py
@@ -88,5 +88,5 @@ class ZippyshareCom(SimpleHoster):
scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts]
# get the file's url by evaluating all the scripts
- scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]']
+ scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']']
return self.js.eval('\n'.join(scripts))
diff --git a/pyload/remote/thriftbackend/Socket.py b/pyload/remote/thriftbackend/Socket.py
index 7d078ab93..4dd66e368 100644
--- a/pyload/remote/thriftbackend/Socket.py
+++ b/pyload/remote/thriftbackend/Socket.py
@@ -13,29 +13,29 @@ WantReadError = Exception #: overwritten when ssl is used
class SecureSocketConnection(object):
def __init__(self, connection):
- self.__dict__["connection"] = connection
+ self.__dict__['connection'] = connection
def __getattr__(self, name):
- return getattr(self.__dict__["connection"], name)
+ return getattr(self.__dict__['connection'], name)
def __setattr__(self, name, value):
- setattr(self.__dict__["connection"], name, value)
+ setattr(self.__dict__['connection'], name, value)
def shutdown(self, how=1):
- self.__dict__["connection"].shutdown()
+ self.__dict__['connection'].shutdown()
def accept(self):
- connection, address = self.__dict__["connection"].accept()
+ connection, address = self.__dict__['connection'].accept()
return SecureSocketConnection(connection), address
def send(self, buff):
try:
- return self.__dict__["connection"].send(buff)
+ return self.__dict__['connection'].send(buff)
except WantReadError:
sleep(0.1)
return self.send(buff)
@@ -43,7 +43,7 @@ class SecureSocketConnection(object):
def recv(self, buff):
try:
- return self.__dict__["connection"].recv(buff)
+ return self.__dict__['connection'].recv(buff)
except WantReadError:
sleep(0.1)
return self.recv(buff)
diff --git a/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py b/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py
index a5e730c35..350fe4bc7 100644
--- a/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py
+++ b/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py
@@ -2705,76 +2705,76 @@ class Processor(Iface, TProcessor):
def __init__(self, handler):
self._handler = handler
self._processMap = {}
- self._processMap["getConfigValue"] = Processor.process_getConfigValue
- self._processMap["setConfigValue"] = Processor.process_setConfigValue
- self._processMap["getConfig"] = Processor.process_getConfig
- self._processMap["getPluginConfig"] = Processor.process_getPluginConfig
- self._processMap["pauseServer"] = Processor.process_pauseServer
- self._processMap["unpauseServer"] = Processor.process_unpauseServer
- self._processMap["togglePause"] = Processor.process_togglePause
- self._processMap["statusServer"] = Processor.process_statusServer
- self._processMap["freeSpace"] = Processor.process_freeSpace
- self._processMap["getServerVersion"] = Processor.process_getServerVersion
- self._processMap["kill"] = Processor.process_kill
- self._processMap["restart"] = Processor.process_restart
- self._processMap["getLog"] = Processor.process_getLog
- self._processMap["isTimeDownload"] = Processor.process_isTimeDownload
- self._processMap["isTimeReconnect"] = Processor.process_isTimeReconnect
- self._processMap["toggleReconnect"] = Processor.process_toggleReconnect
- self._processMap["generatePackages"] = Processor.process_generatePackages
- self._processMap["checkURLs"] = Processor.process_checkURLs
- self._processMap["parseURLs"] = Processor.process_parseURLs
- self._processMap["checkOnlineStatus"] = Processor.process_checkOnlineStatus
- self._processMap["checkOnlineStatusContainer"] = Processor.process_checkOnlineStatusContainer
- self._processMap["pollResults"] = Processor.process_pollResults
- self._processMap["statusDownloads"] = Processor.process_statusDownloads
- self._processMap["getPackageData"] = Processor.process_getPackageData
- self._processMap["getPackageInfo"] = Processor.process_getPackageInfo
- self._processMap["getFileData"] = Processor.process_getFileData
- self._processMap["getQueue"] = Processor.process_getQueue
- self._processMap["getCollector"] = Processor.process_getCollector
- self._processMap["getQueueData"] = Processor.process_getQueueData
- self._processMap["getCollectorData"] = Processor.process_getCollectorData
- self._processMap["getPackageOrder"] = Processor.process_getPackageOrder
- self._processMap["getFileOrder"] = Processor.process_getFileOrder
- self._processMap["generateAndAddPackages"] = Processor.process_generateAndAddPackages
- self._processMap["addPackage"] = Processor.process_addPackage
- self._processMap["addFiles"] = Processor.process_addFiles
- self._processMap["uploadContainer"] = Processor.process_uploadContainer
- self._processMap["deleteFiles"] = Processor.process_deleteFiles
- self._processMap["deletePackages"] = Processor.process_deletePackages
- self._processMap["pushToQueue"] = Processor.process_pushToQueue
- self._processMap["pullFromQueue"] = Processor.process_pullFromQueue
- self._processMap["restartPackage"] = Processor.process_restartPackage
- self._processMap["restartFile"] = Processor.process_restartFile
- self._processMap["recheckPackage"] = Processor.process_recheckPackage
- self._processMap["stopAllDownloads"] = Processor.process_stopAllDownloads
- self._processMap["stopDownloads"] = Processor.process_stopDownloads
- self._processMap["setPackageName"] = Processor.process_setPackageName
- self._processMap["movePackage"] = Processor.process_movePackage
- self._processMap["moveFiles"] = Processor.process_moveFiles
- self._processMap["orderPackage"] = Processor.process_orderPackage
- self._processMap["orderFile"] = Processor.process_orderFile
- self._processMap["setPackageData"] = Processor.process_setPackageData
- self._processMap["deleteFinished"] = Processor.process_deleteFinished
- self._processMap["restartFailed"] = Processor.process_restartFailed
- self._processMap["getEvents"] = Processor.process_getEvents
- self._processMap["getAccounts"] = Processor.process_getAccounts
- self._processMap["getAccountTypes"] = Processor.process_getAccountTypes
- self._processMap["updateAccount"] = Processor.process_updateAccount
- self._processMap["removeAccount"] = Processor.process_removeAccount
- self._processMap["login"] = Processor.process_login
- self._processMap["getUserData"] = Processor.process_getUserData
- self._processMap["getAllUserData"] = Processor.process_getAllUserData
- self._processMap["getServices"] = Processor.process_getServices
- self._processMap["hasService"] = Processor.process_hasService
- self._processMap["call"] = Processor.process_call
- self._processMap["getAllInfo"] = Processor.process_getAllInfo
- self._processMap["getInfoByPlugin"] = Processor.process_getInfoByPlugin
- self._processMap["isCaptchaWaiting"] = Processor.process_isCaptchaWaiting
- self._processMap["getCaptchaTask"] = Processor.process_getCaptchaTask
- self._processMap["getCaptchaTaskStatus"] = Processor.process_getCaptchaTaskStatus
- self._processMap["setCaptchaResult"] = Processor.process_setCaptchaResult
+ self._processMap['getConfigValue'] = Processor.process_getConfigValue
+ self._processMap['setConfigValue'] = Processor.process_setConfigValue
+ self._processMap['getConfig'] = Processor.process_getConfig
+ self._processMap['getPluginConfig'] = Processor.process_getPluginConfig
+ self._processMap['pauseServer'] = Processor.process_pauseServer
+ self._processMap['unpauseServer'] = Processor.process_unpauseServer
+ self._processMap['togglePause'] = Processor.process_togglePause
+ self._processMap['statusServer'] = Processor.process_statusServer
+ self._processMap['freeSpace'] = Processor.process_freeSpace
+ self._processMap['getServerVersion'] = Processor.process_getServerVersion
+ self._processMap['kill'] = Processor.process_kill
+ self._processMap['restart'] = Processor.process_restart
+ self._processMap['getLog'] = Processor.process_getLog
+ self._processMap['isTimeDownload'] = Processor.process_isTimeDownload
+ self._processMap['isTimeReconnect'] = Processor.process_isTimeReconnect
+ self._processMap['toggleReconnect'] = Processor.process_toggleReconnect
+ self._processMap['generatePackages'] = Processor.process_generatePackages
+ self._processMap['checkURLs'] = Processor.process_checkURLs
+ self._processMap['parseURLs'] = Processor.process_parseURLs
+ self._processMap['checkOnlineStatus'] = Processor.process_checkOnlineStatus
+ self._processMap['checkOnlineStatusContainer'] = Processor.process_checkOnlineStatusContainer
+ self._processMap['pollResults'] = Processor.process_pollResults
+ self._processMap['statusDownloads'] = Processor.process_statusDownloads
+ self._processMap['getPackageData'] = Processor.process_getPackageData
+ self._processMap['getPackageInfo'] = Processor.process_getPackageInfo
+ self._processMap['getFileData'] = Processor.process_getFileData
+ self._processMap['getQueue'] = Processor.process_getQueue
+ self._processMap['getCollector'] = Processor.process_getCollector
+ self._processMap['getQueueData'] = Processor.process_getQueueData
+ self._processMap['getCollectorData'] = Processor.process_getCollectorData
+ self._processMap['getPackageOrder'] = Processor.process_getPackageOrder
+ self._processMap['getFileOrder'] = Processor.process_getFileOrder
+ self._processMap['generateAndAddPackages'] = Processor.process_generateAndAddPackages
+ self._processMap['addPackage'] = Processor.process_addPackage
+ self._processMap['addFiles'] = Processor.process_addFiles
+ self._processMap['uploadContainer'] = Processor.process_uploadContainer
+ self._processMap['deleteFiles'] = Processor.process_deleteFiles
+ self._processMap['deletePackages'] = Processor.process_deletePackages
+ self._processMap['pushToQueue'] = Processor.process_pushToQueue
+ self._processMap['pullFromQueue'] = Processor.process_pullFromQueue
+ self._processMap['restartPackage'] = Processor.process_restartPackage
+ self._processMap['restartFile'] = Processor.process_restartFile
+ self._processMap['recheckPackage'] = Processor.process_recheckPackage
+ self._processMap['stopAllDownloads'] = Processor.process_stopAllDownloads
+ self._processMap['stopDownloads'] = Processor.process_stopDownloads
+ self._processMap['setPackageName'] = Processor.process_setPackageName
+ self._processMap['movePackage'] = Processor.process_movePackage
+ self._processMap['moveFiles'] = Processor.process_moveFiles
+ self._processMap['orderPackage'] = Processor.process_orderPackage
+ self._processMap['orderFile'] = Processor.process_orderFile
+ self._processMap['setPackageData'] = Processor.process_setPackageData
+ self._processMap['deleteFinished'] = Processor.process_deleteFinished
+ self._processMap['restartFailed'] = Processor.process_restartFailed
+ self._processMap['getEvents'] = Processor.process_getEvents
+ self._processMap['getAccounts'] = Processor.process_getAccounts
+ self._processMap['getAccountTypes'] = Processor.process_getAccountTypes
+ self._processMap['updateAccount'] = Processor.process_updateAccount
+ self._processMap['removeAccount'] = Processor.process_removeAccount
+ self._processMap['login'] = Processor.process_login
+ self._processMap['getUserData'] = Processor.process_getUserData
+ self._processMap['getAllUserData'] = Processor.process_getAllUserData
+ self._processMap['getServices'] = Processor.process_getServices
+ self._processMap['hasService'] = Processor.process_hasService
+ self._processMap['call'] = Processor.process_call
+ self._processMap['getAllInfo'] = Processor.process_getAllInfo
+ self._processMap['getInfoByPlugin'] = Processor.process_getInfoByPlugin
+ self._processMap['isCaptchaWaiting'] = Processor.process_isCaptchaWaiting
+ self._processMap['getCaptchaTask'] = Processor.process_getCaptchaTask
+ self._processMap['getCaptchaTaskStatus'] = Processor.process_getCaptchaTaskStatus
+ self._processMap['setCaptchaResult'] = Processor.process_setCaptchaResult
def process(self, iprot, oprot):
diff --git a/pyload/webui/__init__.py b/pyload/webui/__init__.py
index d965db3a0..2035bea90 100644
--- a/pyload/webui/__init__.py
+++ b/pyload/webui/__init__.py
@@ -65,19 +65,19 @@ env = Environment(loader=loader, extensions=['jinja2.ext.i18n', 'jinja2.ext.auto
from filters import quotepath, path_make_relative, path_make_absolute, truncate, date
-env.filters["quotepath"] = quotepath
-env.filters["truncate"] = truncate
-env.filters["date"] = date
-env.filters["path_make_relative"] = path_make_relative
-env.filters["path_make_absolute"] = path_make_absolute
-env.filters["decode"] = decode
-env.filters["type"] = lambda x: str(type(x))
-env.filters["formatsize"] = formatSize
-env.filters["getitem"] = lambda x, y: x.__getitem__(y)
+env.filters['quotepath'] = quotepath
+env.filters['truncate'] = truncate
+env.filters['date'] = date
+env.filters['path_make_relative'] = path_make_relative
+env.filters['path_make_absolute'] = path_make_absolute
+env.filters['decode'] = decode
+env.filters['type'] = lambda x: str(type(x))
+env.filters['formatsize'] = formatSize
+env.filters['getitem'] = lambda x, y: x.__getitem__(y)
if PREFIX:
- env.filters["url"] = lambda x: x
+ env.filters['url'] = lambda x: x
else:
- env.filters["url"] = lambda x: PREFIX + x if x.startswith("/") else x
+ env.filters['url'] = lambda x: PREFIX + x if x.startswith("/") else x
gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None])
translation = gettext.translation("django", join(PYLOAD_DIR, "locale"),
diff --git a/pyload/webui/app/api.py b/pyload/webui/app/api.py
index dd8521a07..2ec342fe2 100644
--- a/pyload/webui/app/api.py
+++ b/pyload/webui/app/api.py
@@ -37,7 +37,7 @@ def call_api(func, args=""):
if not s or not s.get("authenticated", False):
return HTTPError(403, json.dumps("Forbidden"))
- if not PYLOAD.isAuthorized(func, {"role": s["role"], "permission": s["perms"]}):
+ if not PYLOAD.isAuthorized(func, {"role": s['role'], "permission": s['perms']}):
return HTTPError(401, json.dumps("Unauthorized"))
args = args.split("/")[1:]
@@ -86,7 +86,7 @@ def login():
# get the session id by dirty way, documentations seems wrong
try:
- sid = s._headers["cookie_out"].split("=")[1].split(";")[0]
+ sid = s._headers['cookie_out'].split("=")[1].split(";")[0]
return json.dumps(sid)
except Exception:
return json.dumps(True)
diff --git a/pyload/webui/app/cnl.py b/pyload/webui/app/cnl.py
index 51767033f..73087ad2d 100644
--- a/pyload/webui/app/cnl.py
+++ b/pyload/webui/app/cnl.py
@@ -73,8 +73,8 @@ def addcrypted():
@local_check
def addcrypted2():
package = request.forms.get("source", None)
- crypted = request.forms["crypted"]
- jk = request.forms["jk"]
+ crypted = request.forms['crypted']
+ jk = request.forms['jk']
crypted = standard_b64decode(unquote(crypted.replace(" ", "+")))
if JS:
diff --git a/pyload/webui/app/json.py b/pyload/webui/app/json.py
index 700b310a0..51159ddf3 100644
--- a/pyload/webui/app/json.py
+++ b/pyload/webui/app/json.py
@@ -22,7 +22,7 @@ def format_time(seconds):
def get_sort_key(item):
- return item["order"]
+ return item['order']
@route('/json/status')
@@ -87,29 +87,29 @@ def packages():
def package(id):
try:
data = toDict(PYLOAD.getPackageData(id))
- data["links"] = [toDict(x) for x in data["links"]]
-
- for pyfile in data["links"]:
- if pyfile["status"] == 0:
- pyfile["icon"] = "status_finished.png"
- elif pyfile["status"] in (2, 3):
- pyfile["icon"] = "status_queue.png"
- elif pyfile["status"] in (9, 1):
- pyfile["icon"] = "status_offline.png"
- elif pyfile["status"] == 5:
- pyfile["icon"] = "status_waiting.png"
- elif pyfile["status"] == 8:
- pyfile["icon"] = "status_failed.png"
- elif pyfile["status"] == 4:
- pyfile["icon"] = "arrow_right.png"
- elif pyfile["status"] in (11, 13):
- pyfile["icon"] = "status_proc.png"
+ data['links'] = [toDict(x) for x in data['links']]
+
+ for pyfile in data['links']:
+ if pyfile['status'] == 0:
+ pyfile['icon'] = "status_finished.png"
+ elif pyfile['status'] in (2, 3):
+ pyfile['icon'] = "status_queue.png"
+ elif pyfile['status'] in (9, 1):
+ pyfile['icon'] = "status_offline.png"
+ elif pyfile['status'] == 5:
+ pyfile['icon'] = "status_waiting.png"
+ elif pyfile['status'] == 8:
+ pyfile['icon'] = "status_failed.png"
+ elif pyfile['status'] == 4:
+ pyfile['icon'] = "arrow_right.png"
+ elif pyfile['status'] in (11, 13):
+ pyfile['icon'] = "status_proc.png"
else:
- pyfile["icon"] = "status_downloading.png"
+ pyfile['icon'] = "status_downloading.png"
- tmp = data["links"]
+ tmp = data['links']
tmp.sort(key=get_sort_key)
- data["links"] = tmp
+ data['links'] = tmp
return data
except Exception:
@@ -217,7 +217,7 @@ def edit_package():
def set_captcha():
if request.environ.get('REQUEST_METHOD', "GET") == "POST":
try:
- PYLOAD.setCaptchaResult(request.forms["cap_id"], request.forms["cap_result"])
+ PYLOAD.setCaptchaResult(request.forms['cap_id'], request.forms['cap_result'])
except Exception:
pass
@@ -243,10 +243,10 @@ def load_config(category, section):
for key, option in conf[section].iteritems():
if key in ("desc", "outline"): continue
- if ";" in option["type"]:
- option["list"] = option["type"].split(";")
+ if ";" in option['type']:
+ option['list'] = option['type'].split(";")
- option["value"] = decode(option["value"])
+ option['value'] = decode(option['value'])
return render_to_response("settings_item.html", {"skey": section, "section": conf[section]})
@@ -268,9 +268,9 @@ def save_config(category):
@route('/json/add_account', method='POST')
@login_required("ACCOUNTS")
def add_account():
- login = request.POST["account_login"]
- password = request.POST["account_password"]
- type = request.POST["account_type"]
+ login = request.POST['account_login']
+ password = request.POST['account_password']
+ type = request.POST['account_type']
PYLOAD.updateAccount(type, login, password)
@@ -302,9 +302,9 @@ def update_accounts():
@route('/json/change_password', method='POST')
def change_password():
- user = request.POST["user_login"]
- oldpw = request.POST["login_current_password"]
- newpw = request.POST["login_new_password"]
+ user = request.POST['user_login']
+ oldpw = request.POST['login_current_password']
+ newpw = request.POST['login_new_password']
if not PYLOAD.changePassword(user, oldpw, newpw):
print "Wrong password"
diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py
index cc2185fd4..1604bd576 100644
--- a/pyload/webui/app/pyloadweb.py
+++ b/pyload/webui/app/pyloadweb.py
@@ -34,16 +34,16 @@ def pre_processor():
captcha = False
update = False
plugins = False
- if user["is_authenticated"]:
+ if user['is_authenticated']:
status = PYLOAD.statusServer()
info = PYLOAD.getInfoByPlugin("UpdateManager")
captcha = PYLOAD.isCaptchaWaiting()
# check if update check is available
if info:
- if info["pyload"] == "True":
- update = info["version"]
- if info["plugins"] == "True":
+ if info['pyload'] == "True":
+ update = info['version']
+ if info['plugins'] == "True":
plugins = True
return {"user": user,
@@ -165,8 +165,8 @@ def home():
return redirect("/login")
for link in res:
- if link["status"] == 12:
- link["information"] = "%s kB @ %s kB/s" % (link["size"] - link["bleft"], link["speed"])
+ if link['status'] == 12:
+ link['information'] = "%s kB @ %s kB/s" % (link['size'] - link['bleft'], link['speed'])
return render_to_response("home.html", {"res": res}, [pre_processor])
@@ -282,14 +282,14 @@ def config():
data.validuntil = time.strftime("%d.%m.%Y - %H:%M:%S", t)
try:
- data.options["time"] = data.options["time"][0]
+ data.options['time'] = data.options['time'][0]
except Exception:
- data.options["time"] = "0:00-0:00"
+ data.options['time'] = "0:00-0:00"
if "limitDL" in data.options:
- data.options["limitdl"] = data.options["limitDL"][0]
+ data.options['limitdl'] = data.options['limitDL'][0]
else:
- data.options["limitdl"] = "0"
+ data.options['limitdl'] = "0"
return render_to_response('settings.html',
{'conf': {'plugin': plugin_menu, 'general': conf_menu, 'accs': accs}, 'types': PYLOAD.getAccountTypes()},
@@ -482,30 +482,30 @@ def admin():
perms = permlist()
for data in user.itervalues():
- data["perms"] = {}
- get_permission(data["perms"], data["permission"])
- data["perms"]["admin"] = True if data["role"] is 0 else False
+ data['perms'] = {}
+ get_permission(data['perms'], data['permission'])
+ data['perms']['admin'] = True if data['role'] is 0 else False
s = request.environ.get('beaker.session')
if request.environ.get('REQUEST_METHOD', "GET") == "POST":
for name in user:
if request.POST.get("%s|admin" % name, False):
- user[name]["role"] = 0
- user[name]["perms"]["admin"] = True
- elif name != s["name"]:
- user[name]["role"] = 1
- user[name]["perms"]["admin"] = False
+ user[name]['role'] = 0
+ user[name]['perms']['admin'] = True
+ elif name != s['name']:
+ user[name]['role'] = 1
+ user[name]['perms']['admin'] = False
# set all perms to false
for perm in perms:
- user[name]["perms"][perm] = False
+ user[name]['perms'][perm] = False
for perm in request.POST.getall("%s|perms" % name):
- user[name]["perms"][perm] = True
+ user[name]['perms'][perm] = True
- user[name]["permission"] = set_permission(user[name]["perms"])
+ user[name]['permission'] = set_permission(user[name]['perms'])
- PYLOAD.setUserPermission(name, user[name]["permission"], user[name]["role"])
+ PYLOAD.setUserPermission(name, user[name]['permission'], user[name]['role'])
return render_to_response("admin.html", {"users": user, "permlist": perms}, [pre_processor])
@@ -528,10 +528,10 @@ def info():
"os" : " ".join((os.name, sys.platform) + extra),
"version" : PYLOAD.getServerVersion(),
"folder" : abspath(PYLOAD_DIR), "config": abspath(""),
- "download" : abspath(conf["general"]["download_folder"]["value"]),
+ "download" : abspath(conf['general']['download_folder']['value']),
"freespace": formatSize(PYLOAD.freeSpace()),
- "remote" : conf["remote"]["port"]["value"],
- "webif" : conf["webui"]["port"]["value"],
- "language" : conf["general"]["language"]["value"]}
+ "remote" : conf['remote']['port']['value'],
+ "webif" : conf['webui']['port']['value'],
+ "language" : conf['general']['language']['value']}
return render_to_response("info.html", data, [pre_processor])
diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py
index ac7fa84fb..f9931f531 100644
--- a/pyload/webui/app/utils.py
+++ b/pyload/webui/app/utils.py
@@ -18,8 +18,8 @@ def render_to_response(file, args={}, proc=[]):
def parse_permissions(session):
perms = dict((x, False) for x in dir(PERMS) if not x.startswith("_"))
- perms["ADMIN"] = False
- perms["is_admin"] = False
+ perms['ADMIN'] = False
+ perms['is_admin'] = False
if not session.get("authenticated", False):
return perms
@@ -66,12 +66,12 @@ def set_permission(perms):
def set_session(request, info):
s = request.environ.get('beaker.session')
- s["authenticated"] = True
- s["user_id"] = info["id"]
- s["name"] = info["name"]
- s["role"] = info["role"]
- s["perms"] = info["permission"]
- s["template"] = info["template"]
+ s['authenticated'] = True
+ s['user_id'] = info['id']
+ s['name'] = info['name']
+ s['role'] = info['role']
+ s['perms'] = info['permission']
+ s['template'] = info['template']
s.save()
return s
diff --git a/pyload/webui/middlewares.py b/pyload/webui/middlewares.py
index f6a2d8a32..c3f4952db 100644
--- a/pyload/webui/middlewares.py
+++ b/pyload/webui/middlewares.py
@@ -27,7 +27,7 @@ class PrefixMiddleware(object):
def __call__(self, e, h):
- path = e["PATH_INFO"]
+ path = e['PATH_INFO']
if path.startswith(self.prefix):
e['PATH_INFO'] = path.replace(self.prefix, "", 1)
return self.app(e, h)
diff --git a/pyload/webui/servers/lighttpd_default.conf b/pyload/webui/servers/lighttpd_default.conf
index a821096c6..444ef39c5 100644
--- a/pyload/webui/servers/lighttpd_default.conf
+++ b/pyload/webui/servers/lighttpd_default.conf
@@ -115,7 +115,7 @@ accesslog.filename = "%(path)/access.log"
url.access-deny = ( "~", ".inc" )
-$HTTP["url"] =~ "\.pdf$" {
+$HTTP['url'] =~ "\.pdf$" {
server.range-requests = "disable"
}
diff --git a/tests/test_json.py b/tests/test_json.py
index f87a32139..a83ef0a24 100644
--- a/tests/test_json.py
+++ b/tests/test_json.py
@@ -14,7 +14,7 @@ class TestJson(object):
def call(self, name, post=None):
if not post: post = {}
- post["session"] = self.key
+ post['session'] = self.key
u = urlopen(url % name, data=urlencode(post))
return loads(u.read())