Somewhat rewrite install cepstral to be cleaner and more easily maintainable.

This commit is contained in:
Michael Taboada 2021-05-12 00:51:03 -07:00
parent b268683c01
commit fe642e96fa

View File

@ -10,11 +10,15 @@
export DIALOGOPTS='--no-lines --visit-items' export DIALOGOPTS='--no-lines --visit-items'
# Make sure display is set in case installed from console. # Make sure display is set in case installed from console.
export DISPLAY="${DISPLAY:-:0}" export DISPLAY="${DISPLAY:-:0}"
# Version number, to easily keep script up-to-date.
version="6.2.3.801"
# Msi or exe? Some are different.
msiexe="exe"
# Beginning part of url, for making things easier.
prefix="https://www.cepstral.com/downloads/installers/windows/"
register() { register() {
local v="${1##*Cepstral_}" local v="$1"
v="${v%%_*}"
company="$(dialog --clear --inputbox "Company name (leave empty if none)" -1 -1 --stdout)" || exit $? company="$(dialog --clear --inputbox "Company name (leave empty if none)" -1 -1 --stdout)" || exit $?
customer="$(dialog --clear --inputbox "Customer name" -1 -1 --stdout)" || exit $? customer="$(dialog --clear --inputbox "Customer name" -1 -1 --stdout)" || exit $?
key="$(dialog --clear --inputbox "License key" -1 -1 --stdout)" || exit $? key="$(dialog --clear --inputbox "License key" -1 -1 --stdout)" || exit $?
@ -25,48 +29,48 @@ register() {
action="install" action="install"
declare -a voices=( declare -a voices=(
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Allison_windows_6.2.3.801.exe"
"Allison" "Allison"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Amy_windows_6.2.3.801.exe" "Allison"
"Amy"
"Amy" "Amy"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Belle_windows_6.2.3.801.exe"
"Belle" "Belle"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Callie_windows_6.2.3.801.exe" "Belle"
"Callie"
"Callie" "Callie"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Charlie_windows_6.2.3.801.exe"
"Charlie" "Charlie"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Dallas_windows_6.2.3.801.exe" "Charlie"
"Dallas"
"Dallas" "Dallas"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Damien_windows_6.2.3.801.exe"
"Damien" "Damien"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_David_windows_6.2.3.801.exe" "Damien"
"David"
"David" "David"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Diane_windows_6.2.3.801.exe"
"Diane" "Diane"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Duchess_windows_6.2.3.801.exe" "Diane"
"Duchess"
"Duchess" "Duchess"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Duncan_windows_6.2.3.801.exe"
"Duncan" "Duncan"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Emily_windows_6.2.3.801.exe" "Duncan"
"Emily"
"Emily" "Emily"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Linda_windows_6.2.3.801.exe"
"Linda" "Linda"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Robin_windows_6.2.3.801.exe" "Linda"
"Robin"
"Robin" "Robin"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Shouty_windows_6.2.3.801.exe"
"Shouty" "Shouty"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Walter_windows_6.2.3.801.exe" "Shouty"
"Walter"
"Walter" "Walter"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_Whispery_windows_6.2.3.801.exe"
"Whispery" "Whispery"
"https://www.cepstral.com/downloads/installers/windows/Cepstral_William_windows_6.2.3.801.exe" "Whispery"
"William"
"William" "William"
) )
# Get the desired wine bottle # Get the desired wine bottle
declare -a bottle declare -a bottle
for i in $(find ~/.local/wine -maxdepth 1 -type d -not -name 'wine' | sort) ; do for i in $(find ~/.local/wine/ -maxdepth 1 -type d -not -name 'wine' | sort) ; do
bottle+=("$i" "${i##*/}") bottle+=("$i" "${i##*/}")
done done
export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \ export WINEPREFIX="$(dialog --backtitle "Use the up and down arrow keys to find the option you want, then press enter to select it." \
@ -89,20 +93,25 @@ voice="$(dialog --backtitle "Use the up and down arrow keys to find the option y
--no-tags \ --no-tags \
--menu "Select A voice to $action" 0 0 0 "${voices[@]}" --stdout)" --menu "Select A voice to $action" 0 0 0 "${voices[@]}" --stdout)"
if [[ "$1" == "-r" || "$1" == "--register" ]]; then if [[ "$action" == "register" ]]; then
register $voice register $voice
fi fi
# make sure the ~/Downloads directory exists. # make sure the ~/Downloads directory exists.
mkdir -p ~/Downloads mkdir -p ~/Downloads
if ! [[ -e ~/Downloads/${voice##*/} ]]; then if ! [[ -e ~/Downloads/Cepstral_${voice}_windows_${version}.${msiexe} ]]; then
wget -O ~/Downloads/${voice##*/} "$voice" | dialog --progressbox "Download voice..." -1 -1 wget -P ~/Downloads/ "${prefix}Cepstral_${voice}_windows_${version}.${msiexe}" | dialog --progressbox "Downloading voice..." -1 -1
fi fi
# Get the install command.
cmd="wine"
[ "$msiexe" = "msi" ] && cmd="${cmd} msiexec /i"
cmd="${cmd} ~/Downloads/Cepstral_${voice}_windows_${version}.${msiexe}"
[ "$msiexe" = "msi" ] && cmd="${cmd} /q"
# Install the voice # Install the voice
(wine ~/Downloads/${voice##*/} & (eval "$cmd" &
xdotool sleep 20 key --delay 75 alt+n key --delay 75 alt+a key --delay 75 alt+n key --delay 75 alt+o key --delay 75 alt+i sleep 20 key --delay 75 alt+f [ "$msiexe" = "exe" ] && xdotool sleep 20 key --delay 75 alt+n key --delay 75 alt+a key --delay 75 alt+n key --delay 75 alt+o key --delay 75 alt+i sleep 20 key --delay 75 alt+f
find "${WINEPREFIX}/drive_c/Program Files/Cepstral/voices" -type d -not -name voices -exec bash -c 'for d ; do echo "GAIN 2.5" > "$d/default.sfx";done' _ {} \;) | dialog --progressbox "installing voice..." -1 -1 find "${WINEPREFIX}/drive_c/Program Files/Cepstral/voices" -type d -not -name voices -exec bash -c 'for d ; do echo "GAIN 2.5" > "$d/default.sfx";done' _ {} \;) | dialog --progressbox "installing voice..." -1 -1
exit 0 exit 0