-
Notifications
You must be signed in to change notification settings - Fork 0
/
learn.sh
executable file
·74 lines (64 loc) · 1.44 KB
/
learn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$DIR/leoDict.sh"
source "$DIR/oxfordDict.sh"
source "$DIR/settings-funct.sh"
function ask()
{
STEM=$1
echo -e "\e[1;32;1;40;2m$STEM\e[0m"
quoteBook $STEM
OPS=( 'next' 'ask leo' 'ask oxford' )
if [ "$device" == "kindle" ]; then
OPS+=( 'archive' )
fi
select OPERATION in "${OPS[@]}"; do
case $OPERATION in
"ask leo")
echo "asking leo for meaning of: ${STEM}"
search ${STEM} ${dictLang}
;;
"ask oxford")
echo "asking oxford for meaning of: $STEM"
oxford ${STEM}
;;
"archive")
archive $STEM
break ;;
"next")
break ;;
*)
#rephrase the quest
echo -e "\e[1;32;1;40;2m$STEM\e[0m"
quoteBook $STEM
;;
esac
done
}
function installDeps()
{
if ! [ -x "$(command -v sqlite3)" ]; then
sudo apt install -y sqlite3
fi
}
function main()
{
initSettings
installDeps
if [ "$device" == "kindle" ]; then
. kindleVoc.sh "${db}"
echo "Which words do you want to train?"
MODE=$(askMode)
else
. kobo/koboVoc.sh "${db}" "${kMount}"
MODE="${dictLang}"
fi
WORD_RAW=$(selectWords $MODE)
read -r -a WORDS <<< "$WORD_RAW"
COUNT=${#WORDS[@]}
echo "started training of ${COUNT} words"
for WORD in ${WORDS[@]}; do
ask $WORD
done
}
main