summaryrefslogtreecommitdiffstats
path: root/module/remote/create_jstypes.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-28 20:20:01 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-28 20:20:01 +0100
commit6b84b9c69ed75baee9c2cdfa758eddcec10b8b23 (patch)
treebd753ec5a8988c798356a4f94de2034fb568b439 /module/remote/create_jstypes.py
parentprepared dashboard actionbar (diff)
downloadpyload-6b84b9c69ed75baee9c2cdfa758eddcec10b8b23.tar.xz
generate js_apitypes, updated lodash, working type filters on webui
Diffstat (limited to 'module/remote/create_jstypes.py')
-rw-r--r--module/remote/create_jstypes.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/module/remote/create_jstypes.py b/module/remote/create_jstypes.py
new file mode 100644
index 000000000..ad05ec9a8
--- /dev/null
+++ b/module/remote/create_jstypes.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from os.path import abspath, dirname, join
+
+path = dirname(abspath(__file__))
+module = join(path, "..")
+
+import apitypes
+from apitypes_debug import enums
+
+# generate js enums
+def main():
+
+ print "generating apitypes.js"
+
+ f = open(join(module, 'web', 'static', 'js', 'utils', 'apitypes.js'), 'wb')
+ f.write("""// Autogenerated, do not edit!
+define([], function() {
+\treturn {
+""")
+
+ for name in enums:
+ enum = getattr(apitypes, name)
+ values = dict([(attr, getattr(enum, attr)) for attr in dir(enum) if not attr.startswith("_")])
+
+ f.write("\t\t%s: %s,\n" % (name, str(values)))
+
+ f.write("\t};\n});")
+ f.close()
+
+
+if __name__ == "__main__":
+ main()