add anki import scripts, download missing audio

This commit is contained in:
Alexander Bocken 2021-11-02 15:36:48 +01:00
parent f5bc166276
commit 1ee725d0a6
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8
17 changed files with 28 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#!/bin/sh
for file in json/*.json
do
#echo "file:$file"
no="$(echo "$file" | cut -d'_' -f1 | sed 's|json/||')"
word="$(echo "$file" | cut -d'_' --complement -f1 | sed 's/\.json$//')"
sounds="$(for audio in audio/"$no"_$word*
do
file="$(echo "$audio" | sed 's/audio\///')"
printf '[sound:%s]' "$file"
done)"
printf '%s\t%s\n' "$no" "$sounds"
done

15
oxford_api/get_pronunciation Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
for file in json/*.json
do
#echo "file:$file"
no="$(echo "$file" | cut -d'_' -f1 | sed 's|json/||')"
word="$(echo "$file" | cut -d'_' --complement -f1 | sed 's/\.json$//')"
spellings="$(jq -r '.results[].lexicalEntries[].entries[].pronunciations[] | .phoneticSpelling' "$file" | awk '!seen[$0]++')"
if [ -z "$spellings" ]; then
echo "ERROR: no spelling for $word found!"
continue
fi
formatted="$(echo "$spellings" | sed 's/^/\//; s/$/\//' | sed 's/$/<br>/' | tr -d '\n' | sed 's/<br>$//')"
printf '%s\t%s\n' "$no" "$formatted"
done