diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-05-30 09:48:59 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-05-30 09:48:59 +0200 |
commit | 1d205674bfd62ed9ea62196cf10d98913f31aa80 (patch) | |
tree | 4b43e66fef330632f29126236b2bcb3c566d72f8 /bulk-audio/get | |
parent | 7a9949a15eb8e9ac572fdd0743b15b2680081b1d (diff) |
normalize kana for local audio server (for katakana only cards)
Diffstat (limited to 'bulk-audio/get')
-rwxr-xr-x | bulk-audio/get | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bulk-audio/get b/bulk-audio/get index 5a0b3c4..196a5d5 100755 --- a/bulk-audio/get +++ b/bulk-audio/get @@ -9,9 +9,13 @@ urlencode() { printf '%s' "$1" | od -An -tx1 | tr ' ' '%' | tr '[:lower:]' '[:upper:]' } +normalize_kana() { + sed 'y/テデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅ/てでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづ/' +} + local_audio() { URL="http://localhost:5050/" - res="$(curl -sLGo - "$URL" --data-urlencode "term=$KANJI" --data-urlencode "reading=$KANA")" + res="$(curl -sLGo - "$URL" --data-urlencode "term=$KANJI" --data-urlencode "reading=$(echo "$KANA" | normalize_kana)")" [ $? -ne 0 ] && return URL="$(echo "$res" | jq --raw-output '.audioSources[0].url // empty')" [ -z "$URL" ] && return |