+script for quick generation of puzzles from filenames
This commit is contained in:
21
Scripts/puzzle_seed_from_img.sh
Executable file
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
|
Reference in New Issue
Block a user