diff options
Diffstat (limited to 'flashot-make.sh')
| -rwxr-xr-x | flashot-make.sh | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/flashot-make.sh b/flashot-make.sh index 34c921f..f601a94 100755 --- a/flashot-make.sh +++ b/flashot-make.sh @@ -1,16 +1,12 @@ #!/bin/sh combine() { - for name in $(ls | cut -d- -f1-2 | uniq); do + for name in $(ls | cut -d- -f1-2 | uniq | sed 's/final//'); do magick "$name"-q* -append final/"$name"-0.png magick "$name"-a* -append final/"$name"-1.png done } cards_txt() { - if [ $(ls cards.txt) ]; then - rm cards.txt - fi - for name in $(ls *.png | cut -d- -f1 | uniq); do old_card=-1 for file in "$name"*; do @@ -29,19 +25,20 @@ cards_txt() { if [ -z "$FLASHOT_ANKI_USER" ]; then FLASHOT_ANKI_USER=Main; fi +# main action=$(printf "make flashcards\nreset" | dmenu -i -p "action?") if [ "$action" = "make flashcards" ]; then confirm=$(printf "no\nyes" | dmenu -i -p "are you sure? screenshot names can overwrite others in media folder") if [ "$confirm" = "yes" ]; then + if [ -d /tmp/flashot/final ]; then rm -rf /tmp/flashot/final; fi cd /tmp/flashot mkdir -p final combine cd final cards_txt cp *.png ~/.local/share/Anki2/"$FLASHOT_ANKI_USER"/collection.media/ - anki /tmp/flashot/final/cards.txt + anki /tmp/flashot/final/cards.txt & fi - elif [ "$action" = "reset" ]; then confirm=$(printf "no\nyes" | dmenu -i -p "are you sure? this action cannot be undone") if [ "$confirm" = "yes" ]; then |
