commie
62dc5b4e0e
storytime.sh to get item summary instead of item title. created python dir and started readme there |
||
---|---|---|
.. | ||
check-dependencies.sh | ||
feed-reader.sh | ||
readme.org | ||
storytime.sh | ||
tts-to-file.sh | ||
video-builder.sh |
readme.org
____ _ _____ _ / ___|| |_ ___ _ __ _ |_ _(_)_ __ ___ ___ \___ \| __/ _ \| '__| | | || | | | '_ ` _ \ / _ \ ___) | || (_) | | | |_| || | | | | | | | | __/ |____/ \__\___/|_| \__, ||_| |_|_| |_| |_|\___| |___/ _ __ ___ ________(_)__ / /____ (_-</ __/ __/ / _ \/ __(_-< /___/\__/_/ /_/ .__/\__/___/ /_/
Independent application snippets
mimic3
this uses one of my favorite mimic3 voices and generates an mp3 in /tmp/output.mp3
#!/bin/bash
mimic3 --voice en_US/hifi-tts_low#92 --length-scale .95 "$1" > /tmp/stage.wav
ffmpeg -y -i /tmp/stage.wav -f s16le -acodec pcm_s16le -ar 22050 -c:a libmp3lame /tmp/output.mp3
feed2exec
this application will take any rss feed and run an arbitrary command against it. it does have a default config file, so we should probably specify it when we call it.
these lines are taken straight out of the man page and made a bit more readable
#!/bin/bash
feed2exec \
parse \
https://www.nasa.gov/rss/dyn/breaking_news.rss \
--output echo \
--args '{item.title}'
ffmpeg
this is the hardest bit, honestly. once i figure out how to build the video file from the pieces, gathering the pieces and upping them to youtube etc will be cake.
i already know that to build the spectrometer is out of the scope of what i can build in one evening, but i am sure i can put together the ffmpeg command to build from a single image file and a single audio file
#!/bin/bash
ffmpeg -loop 1 -i ../media-assets/sample_pic.png \
-i /tmp/output.mp3 \
-shortest \
-c:v libx264 \
-c:a copy \
output.mp4
check dependencies
#!/bin/bash
# Abort if any command fails.
set -e
# Check for presence of a command.
# $1 is name of dependency
# $2 is command that gets run to check for it
# eg. check "disroot.org reachable?" "ping disroot.org"
check() {
echo -n "Checking for $1... "
if eval $2 &> /dev/null ; then
echo ✔︎
false
else
echo ✗
storytime_ready=false
true
fi
}
# assume ready until proven otherwise
storytime_ready=true
if check "cron" "crontab -l"; then
echo " Please install cron."
fi
if check "mimic3" "mimic3 --version"; then
echo " Please install mimic3."
echo " Via pip: pip3 install mycroft-mimic3-tts[all]"
fi
if check "ffmpeg 7" "ffmpeg -version | grep \"ffmpeg version 7\""; then
echo " Please install ffmpeg ~7."
fi
if check "feed2exec" "feed2exec"; then
echo " Please install feed2exec."
echo " Via pip: pip3 install feed2exec"
fi
# final check for readiness
if $storytime_ready; then
echo -e "\nReady for Storytime!"
else
echo -e "\nStorytime is not ready to go. Please install the missing dependencies."
fi
one big ole rube goldberg spaghetti mess
i'm going to say that it is good enough that it pulls the summary for now.
i'm going to try to get the ffmpeg to actually build the
#!/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}
feed2exec parse ${feed_url} --output echo --args '{item.summary}'
}
main $1
#+RESULTS: