summaryrefslogtreecommitdiffstats
path: root/gromka
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-11-03 23:18:19 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-11-03 23:18:19 +0100
commitcc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f (patch)
treefb21c51b2d3964a6e3c82897a21e6af91ee7dccd /gromka
parent31. 10. 2022 - danova noč čarovnic (diff)
downloadluč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.tar
luč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.tar.gz
luč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.tar.bz2
luč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.tar.lz
luč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.tar.xz
luč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.tar.zst
luč-cc2ab2ab7b817e5c7aa80cd2a96355fd97a8f86f.zip
Diffstat (limited to '')
-rwxr-xr-xgromka/keyboard.py47
-rw-r--r--gromka/keyboard.txt3
2 files changed, 50 insertions, 0 deletions
diff --git a/gromka/keyboard.py b/gromka/keyboard.py
new file mode 100755
index 0000000..14276cc
--- /dev/null
+++ b/gromka/keyboard.py
@@ -0,0 +1,47 @@
+#!/usr/bin/python3
+import sys
+try:
+ from bs4 import BeautifulSoup
+except ModuleNotFoundError:
+ raise ModuleNotFoundError("beautifulsoup4 not found. emerge --ask dev-python/beautifulsoup4")
+
+if len(sys.argv) != 2:
+ raise ValueError("specify showfile in 1st argument")
+
+with open(sys.argv[1], "r") as f:
+ data = f.read();
+
+show = BeautifulSoup(data, "xml")
+
+buttons = "F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Pause Ins".split(" ") + "/ 1 2 3 4 5 6 7 8 9 0 ' +".split(" ") + "Q W E R T Z U I O P Š }".split(" ") + "A S D F G H J K L Č { Ž".split(" ") + "< Y X C V B N M , . -".split(" ")
+keys = {}
+for button in buttons:
+ keys[button] = ""
+
+for key in show.find_all("Key") + show.find_all("MultKey") + show.find_all("DivKey"):
+ keys[key.string] = ""
+ for parent in key.parents:
+ if parent.has_attr("Caption"):
+ keys[key.string] += parent["Caption"] + " (" + parent.name + ")"
+ break
+
+for key in keys:
+ print(key + ": " + keys[key])
+
+print("\nmidi botex:")
+
+midi = []
+for x in range(0, 24):
+ midi.append("")
+
+for key in show.find_all("Input"):
+ if key.has_attr("Universe") and key["Universe"] == "0" and key.has_attr("Channel") and int(key["Channel"]) >= 198 and int(key["Channel"]) <= 198 + 24:
+ if midi[int(key["Channel"]) - 198] != "":
+ midi[int(key["Channel"]) - 198] += ", "
+ midi[int(key["Channel"]) - 198] += key.parent["Caption"] + " (" + key.parent.name + ")"
+
+for key in range(0, 24):
+ kje = " zgoraj"
+ if (key >= 12):
+ kje = " spodaj"
+ print(str(key % 12 + 1) + kje + ": " + midi[key])
diff --git a/gromka/keyboard.txt b/gromka/keyboard.txt
index 442172a..da85cd9 100644
--- a/gromka/keyboard.txt
+++ b/gromka/keyboard.txt
@@ -1,3 +1,6 @@
+keyboard.txt JE DEPRECATED, uporabi keyboard.py.
+
+
F1 front led cyan
F2 front led magenta
F3 front led plava