summaryrefslogtreecommitdiff
path: root/espanso/update_from_assets.py
diff options
context:
space:
mode:
authorkkard2 <[email protected]>2023-07-10 19:16:04 +0200
committerkkard2 <[email protected]>2023-07-10 19:16:04 +0200
commit371cac99ca01b74cfe7b164c6d39c7ab626a1e48 (patch)
tree6f2eb33a298ecd16fdf7da4431393eff01987320 /espanso/update_from_assets.py
parent94ca8ceedef0e27f7b9314d2aa042c6d7df8f753 (diff)
update_from_assets.py
Diffstat (limited to 'espanso/update_from_assets.py')
-rw-r--r--espanso/update_from_assets.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/espanso/update_from_assets.py b/espanso/update_from_assets.py
new file mode 100644
index 0000000..e2b76d5
--- /dev/null
+++ b/espanso/update_from_assets.py
@@ -0,0 +1,20 @@
+import os
+
+
+def generate(path, output_file, prefix):
+ files = [
+ f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))
+ ]
+
+ with open(output_file, 'w') as f:
+ f.write('matches:\n')
+
+ for file in files:
+ path_wo_ext = os.path.splitext(file)[0]
+ f.write(' - trigger: ;;' + prefix + path_wo_ext + '\n')
+ f.write(
+ ' image_path: $CONFIG/' + path + '/' + file + '\n')
+
+
+if __name__ == '__main__':
+ generate('assets/img', 'match/img.yml', 'i')