+script for quick generation of puzzles from filenames

This commit is contained in:
anon
2022-11-07 13:19:12 +01:00
parent 6547915b78
commit c1506ecc97

21
Scripts/puzzle_seed_from_img.sh Executable file

@ -0,0 +1,21 @@
#!/bin/bash
DIR=$1
[ -z "$DIR" ] && DIR="."
for i in "$DIR"/*; do
ANS=${i/${DIR}/}
ANS=${ANS//\//}
ANS=${ANS%.*}
ANS=$(echo "$ANS" | tr [:upper:] [:lower:])
ANS=${ANS//_/ }
ANS=${ANS//:/}
printf "
Puzzle::create([
'picture' => \"images/puzzles/${i}\",
'answer' => \"${ANS}\",
'user_added' => 1,
'numberOfGames' => 0,
'numberOfHits' => 0,
]);\n"
done