From eb3be803653849f3efae6193794ee3c9e1531b25 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 1 Mar 2026 23:56:46 -0500 Subject: [PATCH] Update script for Android added. A few more dictionary fixes added. --- English/namefix.txt | 1 + English/wordfix.txt | 1 + README.md | 34 +++++++++-- update_android.sh | 104 ++++++++++++++++++++++++++++++++++ install.sh => update_linux.sh | 8 +-- 5 files changed, 139 insertions(+), 9 deletions(-) create mode 100755 update_android.sh rename install.sh => update_linux.sh (80%) diff --git a/English/namefix.txt b/English/namefix.txt index 8633cac..d316091 100644 --- a/English/namefix.txt +++ b/English/namefix.txt @@ -1,3 +1,4 @@ +alicia=aleesha bifrost=buyfraust cthulhu=kthoolu danestange=dainstanggey diff --git a/English/wordfix.txt b/English/wordfix.txt index 66da71e..81c1e90 100644 --- a/English/wordfix.txt +++ b/English/wordfix.txt @@ -6,6 +6,7 @@ disconnects=disconects douche=doosh* espeak=easpeak* firepit=fiarpit +foliage=foalyage freenginx=freeenginex git=ghit* github=ghittehub diff --git a/README.md b/README.md index c1d3363..a4b2b21 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,41 @@ This repository contains pronunciation dictionaries for RHVoice's English voices - `English/namefix.txt` - Pronunciation corrections for proper names - `English/wordfix.txt` - Pronunciation corrections for common words -## Installation +## Update Scripts -### Automatic Installation +### Linux -Run the installation script: +Run the Linux update script: ```bash -sudo ./install.sh +sudo ./update_linux.sh ``` -### Manual Installation +This copies the `English` directory to `/etc/RHVoice/dicts/`. + +### Android + +Run the Android update script with your device connected over `adb`: + +```bash +./update_android.sh +``` + +The Android script checks for `adb`, verifies that `com.github.olga_yakovleva.rhvoice.android` is installed, creates the RHVoice dictionary directory if needed, and pushes the dictionary files to: + +```text +/sdcard/Android/data/com.github.olga_yakovleva.rhvoice.android/files/dicts/English +``` + +RHVoice also keeps its config under the same external app files directory, for example: + +```text +/sdcard/Android/data/com.github.olga_yakovleva.rhvoice.android/files/RHVoice.conf +``` + +Android private app data also exists under `/data/user/0/com.github.olga_yakovleva.rhvoice.android`, but that area is not readable over normal `adb` on a non-debuggable Play Store build. + +### Manual Linux Installation Copy the English directory to the RHVoice dictionaries location: diff --git a/update_android.sh b/update_android.sh new file mode 100755 index 0000000..31f4b99 --- /dev/null +++ b/update_android.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash + +# Update RHVoice English pronunciation fixes on Android via adb + +set -euo pipefail + +packageName="com.github.olga_yakovleva.rhvoice.android" +sourceDir="English" +remoteBaseDir="/sdcard/Android/data/${packageName}/files" +remoteDictDir="${remoteBaseDir}/dicts/English" +adbArgs=() + +check_command() { + local commandName="$1" + + if ! command -v "$commandName" >/dev/null 2>&1; then + echo "Error: Required command '$commandName' is not installed" >&2 + exit 1 + fi +} + +run_adb() { + adb "${adbArgs[@]}" "$@" +} + +select_device() { + local deviceCount + + if [[ -n "${ADB_SERIAL:-}" ]]; then + adbArgs=(-s "$ADB_SERIAL") + return + fi + + deviceCount="$(adb devices | awk 'NR > 1 && $2 == "device" { count++ } END { print count + 0 }')" + + if [[ "$deviceCount" -eq 0 ]]; then + echo "Error: No Android device in 'device' state found" >&2 + exit 1 + fi + + if [[ "$deviceCount" -gt 1 ]]; then + echo "Error: Multiple Android devices detected. Set ADB_SERIAL to choose one." >&2 + exit 1 + fi +} + +check_source_dir() { + if [[ ! -d "$sourceDir" ]]; then + echo "Error: Source directory '$sourceDir' not found" >&2 + exit 1 + fi +} + +check_package() { + if ! run_adb shell pm list packages "$packageName" | tr -d '\r' | grep -Fxq "package:${packageName}"; then + echo "Error: RHVoice package '$packageName' is not installed on the connected device" >&2 + exit 1 + fi +} + +push_dict_files() { + local dictFiles=() + local sourcePath + local fileName + + shopt -s nullglob + dictFiles=("$sourceDir"/*.txt) + shopt -u nullglob + + if [[ "${#dictFiles[@]}" -eq 0 ]]; then + echo "Error: No dictionary files found in '$sourceDir'" >&2 + exit 1 + fi + + echo "Ensuring RHVoice dictionary directory exists at ${remoteDictDir}..." + run_adb shell mkdir -p "$remoteDictDir" + + for sourcePath in "${dictFiles[@]}"; do + fileName="$(basename "$sourcePath")" + echo "Pushing ${sourcePath} to ${remoteDictDir}/${fileName}..." + run_adb push "$sourcePath" "${remoteDictDir}/${fileName}" >/dev/null + done +} + +show_remote_dir() { + echo "Remote dictionary files:" + run_adb shell ls -l "$remoteDictDir" | tr -d '\r' +} + +main() { + check_command adb + check_source_dir + select_device + check_package + push_dict_files + show_remote_dir + + echo "Android update complete!" + echo "RHVoice dictionaries on Android are stored in ${remoteDictDir}." + echo "RHVoice config on Android is stored under ${remoteBaseDir}, for example ${remoteBaseDir}/RHVoice.conf." + echo "You may need to restart RHVoice or apps using it for changes to take effect." +} + +main "$@" diff --git a/install.sh b/update_linux.sh similarity index 80% rename from install.sh rename to update_linux.sh index c22bbf7..e94e4eb 100755 --- a/install.sh +++ b/update_linux.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# Install RHVoice English pronunciation fixes +# Update RHVoice English pronunciation fixes on Linux -set -e +set -euo pipefail # Check if running as root if [[ $EUID -ne 0 ]]; then @@ -24,10 +24,10 @@ fi mkdir -p "$dictDir" # Copy English pronunciation fixes -echo "Installing English pronunciation fixes to $dictDir..." +echo "Updating English pronunciation fixes in $dictDir..." cp -rv "$sourceDir" "$dictDir/" -echo "Installation complete!" +echo "Linux update complete!" echo "You may need to restart applications using RHVoice for changes to take effect." echo "For example:" echo "sudo killall speech-dispatcher"