45 lines
870 B
Bash
Executable File
45 lines
870 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Abort if any command fails.
|
|
set -e
|
|
|
|
usage() {
|
|
echo "Storytime - Convert your RSS feeds into personalized podcasts"
|
|
echo ""
|
|
echo "Usage:"
|
|
echo "${0} [-v] [-o output.mp3] feed_url"
|
|
echo " -v: verbose"
|
|
echo " -o: path of output file"
|
|
echo ""
|
|
}
|
|
|
|
verbose=false
|
|
output="output.mp3"
|
|
while getopts ":vo:h" opt; do
|
|
case ${opt} in
|
|
v) verbose="true" ;;
|
|
o) output="${OPTARG}" ;;
|
|
h) usage ;;
|
|
*) usage ;; # default
|
|
esac
|
|
done
|
|
shift $((OPTIND-1))
|
|
readonly verbose
|
|
readonly output
|
|
|
|
# if no arguments are passed, print usage and exit
|
|
if [[ $# -ne 1 ]]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
main() {
|
|
local feed_url=$1
|
|
|
|
feed2exec parse ${feed_url} --output echo --args '{item.summary}' | \
|
|
mimic3 --voice en_US/hifi-tts_low#92 --stdout | \
|
|
ffmpeg -y -i pipe:.wav -acodec pcm_s16le -ar 22050 -c:a libmp3lame ${output}
|
|
}
|
|
|
|
main $1
|
|
|