updated the master script section with the contents of storytime.sh
This commit is contained in:
parent
b3870ce9b7
commit
07223f92be
|
@ -102,62 +102,55 @@ i already know that to build the spectrometer is out of the scope of what i can
|
|||
fi
|
||||
#+end_src
|
||||
* one big ole rube goldberg spaghetti mess
|
||||
surely this can actually be written as one script.
|
||||
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
|
||||
|
||||
#+begin_src shell :tangle storytime.sh
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env 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
|
||||
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 ""
|
||||
}
|
||||
|
||||
# assume ready until proven otherwise
|
||||
storytime_ready=true
|
||||
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 check "cron" "crontab -l"; then
|
||||
echo " Please install cron."
|
||||
# if no arguments are passed, print usage and exit
|
||||
if [[ $# -ne 1 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if check "mimic3" "mimic3 --version"; then
|
||||
echo " Please install mimic3."
|
||||
echo " Via pip: pip3 install mycroft-mimic3-tts[all]"
|
||||
fi
|
||||
main() {
|
||||
local feed_url=$1
|
||||
|
||||
if check "ffmpeg 7" "ffmpeg -version | grep \"ffmpeg version 7\""; then
|
||||
echo " Please install ffmpeg ~7."
|
||||
fi
|
||||
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}
|
||||
}
|
||||
|
||||
if check "feed2exec" "feed2exec"; then
|
||||
echo " Please install feed2exec."
|
||||
echo " Via pip: pip3 install feed2exec"
|
||||
fi
|
||||
main $1
|
||||
|
||||
# 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
|
||||
figlet "Fetching feed items."
|
||||
figlet "Reading into an audio file."
|
||||
figlet "Mixing video."
|
||||
figlet "Uploading."
|
||||
figlet "DONE!"
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
|
|
Loading…
Reference in a new issue