edge-tts/easy-playback.sh

9 lines
358 B
Bash
Raw Normal View History

2021-05-11 13:03:42 +00:00
#!/usr/bin/env bash
## To use this script you need to install
## edge-tts.py to a directory in your $PATH
2021-05-11 13:29:47 +00:00
## as executable and give it the name edge-tts.
2021-05-11 13:03:42 +00:00
trap 'kill -- $(jobs -p) 2>/dev/null' EXIT
2021-05-11 13:35:28 +00:00
[ "$1" == "stdin" ] && { stdin=$(cat); shift 1; set -- "$@" '--file=/dev/stdin'; } || stdin=""
2021-05-11 13:29:47 +00:00
exec {fd}< <(edge-tts "${@}" <<<"$stdin")
2021-05-11 13:03:42 +00:00
mpg123 -C "/dev/fd/$fd"