summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorOliwerix <oliwerix@gmail.com>2022-11-22 21:30:34 +0100
committerOliwerix <oliwerix@gmail.com>2022-11-22 21:30:34 +0100
commit3d2e46c8ed0a5163c2844a281ba1edf4aedd8384 (patch)
treeaeca322702b8e49da7622e99ec1ceeaa6e4134d7 /utils
parentgromka: štirje bendi 2022-11-20 (diff)
downloadluč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.tar
luč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.tar.gz
luč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.tar.bz2
luč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.tar.lz
luč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.tar.xz
luč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.tar.zst
luč-3d2e46c8ed0a5163c2844a281ba1edf4aedd8384.zip
Diffstat (limited to 'utils')
-rw-r--r--utils/README.md3
-rwxr-xr-xutils/patchlist.py42
2 files changed, 45 insertions, 0 deletions
diff --git a/utils/README.md b/utils/README.md
new file mode 100644
index 0000000..0d3eb50
--- /dev/null
+++ b/utils/README.md
@@ -0,0 +1,3 @@
+# Useful utilities for manipulating and extracting data from qlcplus showfiles and fixture definitions
+## patchlist.py
+Generates a patchlist in tsv format from given showfile \ No newline at end of file
diff --git a/utils/patchlist.py b/utils/patchlist.py
new file mode 100755
index 0000000..ba9042b
--- /dev/null
+++ b/utils/patchlist.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python3
+######################################################
+## ##
+## Outputs patch listing for given showfile ##
+## Output is in tsv format ##
+## v0.1 ##
+## ##
+## TODO: ##
+## - add options for selecting output params ##
+## ##
+######################################################
+
+
+import xml.etree.ElementTree as ET
+import sys
+
+namespaces = {"qlc" : "http://www.qlcplus.org/Workspace"}
+
+def parseXML(xml_file):
+ tree = ET.ElementTree(file=xml_file)
+ ET.register_namespace("qlc", namespaces["qlc"])
+ root = tree.getroot()
+ fixtures = root.findall('.//qlc:Engine/qlc:Fixture', namespaces)
+
+ print("Address", "Mfctr", "Model", "Mode", "CNAME", sep="\t")
+ for fixture in fixtures:
+ fixture_Name = fixture.find('.//qlc:Name').text
+ fixture_Universe = int(fixture.find('.//qlc:Universe', namespaces).text)+1
+ fixture_Address = int(fixture.find('.//qlc:Address', namespaces).text)+1
+ fixture_Manufacturer = fixture.find('.//qlc:Manufacturer', namespaces).text
+ fixture_Model = fixture.find('.//qlc:Model', namespaces).text
+ fixture_Mode = fixture.find('.//qlc:Mode', namespaces).text
+ fixture_Dip = '{0:010b}'.format(fixture_Address)[::-1] # can show dip switch position, unused
+ print(f"{fixture_Universe}.{fixture_Address}",fixture_Manufacturer, fixture_Model, fixture_Mode, fixture_Name, sep="\t")
+
+if __name__ == "__main__":
+ if len(sys.argv) >= 2:
+ filename = sys.argv[1]
+ parseXML(filename)
+ else:
+ print("Please specify a patch file to read", file=sys.stderr)
+ exit(1) \ No newline at end of file