Updated set fvoice script to work with ggrep on mac.

This commit is contained in:
Storm Dragon 2020-12-12 02:38:43 -05:00
parent 0403da6b0e
commit 3bdd559ae8

View File

@ -138,13 +138,21 @@ trap restore_voice SIGINT
# Create an array of available voices. # Create an array of available voices.
ifs="$IFS" ifs="$IFS"
IFS=$'\n' IFS=$'\n'
voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g')) if [[ "$(uname)" == "Darwin" ]]; then
voiceListFullName=($(ggrep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
else
voiceListFullName=($(grep -P '\[Software\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^\\]+\].*' "${WINEPREFIX}/system.reg" | sed -E -e 's/\[([^]]+)\].*/\1/g'))
fi
IFS="$ifs" IFS="$ifs"
voiceList=() voiceList=()
for x in "${voiceListFullName[@]}" ; do for x in "${voiceListFullName[@]}" ; do
voiceList+=("$(echo "$x" | rev | cut -d\\ -f1 | rev)") voiceList+=("$(echo "$x" | rev | cut -d\\ -f1 | rev)")
done done
oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')" if [[ "$(uname)" == "Darwin" ]]; then
oldVoice="$(ggrep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
else
oldVoice="$(grep -P '"DefaultTokenId"="HKEY_LOCAL_MACHINE\\\\(SOFTWARE|Software)\\\\(Wow6432Node\\\\|)Microsoft\\\\Speech\\\\Voices\\\\Tokens\\\\[^"]+"' "${WINEPREFIX}/user.reg" | sed -E -e 's/"DefaultTokenId"="([^"]+)"/\1/g')"
fi
echo "oldVoice: ${oldVoice}" echo "oldVoice: ${oldVoice}"
echo "voiceList: ${voiceList[@]}" echo "voiceList: ${voiceList[@]}"
echo "voiceListFullName: ${voiceListFullName[@]}" echo "voiceListFullName: ${voiceListFullName[@]}"