mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-18 13:44:20 +01:00
* added customtts and default assistants * Added ES assistant and customtts updates * Added ES assistant and customtts updates * Added customtts and new assistants * Added customtts and new assistants * Update config.json * Added customtts and new assistants * Added some quotes * Added some quotes * Added some quotes * Remove binaries and install from pkg * Remove binaries and install from pkg * Update Dockerfile * Update config.json * test * updated version * Update config.json * Update config.json * Update Dockerfile * Update config.json * Update customtts.sh * Update CHANGELOG.md * Update run.sh * Update run.sh * Update config.json * Update build.json * Update CHANGELOG.md * Update build.json
31 lines
654 B
Bash
31 lines
654 B
Bash
#!/bin/sh
|
|
|
|
#set -x
|
|
API_KEY=$HASSIO_TOKEN
|
|
PLATFORM=$1
|
|
FILE=$2
|
|
LANG=$3
|
|
TEXT=$4
|
|
|
|
MESSAGE="\"{\\\"message\\\": \\\"$TEXT\\\", \\\"platform\\\": \\\"$PLATFORM\\\"}\""
|
|
echo "$MESSAGE"
|
|
|
|
RESPONSE=$(eval curl -s -H \"x-ha-access: "$API_KEY"\" -H \"Type: application/json\" http://hassio/homeassistant/api/tts_get_url -d "$MESSAGE")
|
|
if [ "$RESPONSE" = "" ]; then
|
|
exit 1
|
|
fi
|
|
echo "$RESPONSE"
|
|
|
|
URL=$(echo "$RESPONSE" | jq --raw-output '.url')
|
|
if [ "$URL" = "" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
rm /tmpfs/temp.mp3
|
|
curl -s -H "x-ha-access: $API_KEY" "$URL" -o /tmpfs/temp.mp3
|
|
if [ -f /tmpfs/temp.mp3 ]; then
|
|
/usr/bin/mpg123 -w "$FILE" /tmpfs/temp.mp3
|
|
fi
|
|
rm /tmpfs/temp.mp3
|
|
|