Compare commits

...

3 commits

Author SHA1 Message Date
bigMouthCommie 3b67804334 Merge pull request 'Change shebangs, add missing extension to check-dependencies' (#2) from judy/storytime:shebang into main
Reviewed-on: #2

lgtm
2024-04-13 01:31:58 +02:00
Clinton Judy b6a02d14db Use #!/usr/bin/env shebang instead
Using `#!/usr/bin/env bash` instead of `#!/bin/bash` makes scripts more
portable. bash isn't guaranteed to be in /bin/ on every system.
/usr/bin/env uses the users's path, which should always find bash for
us.

(Technically we could make it even *more* portable via
2024-04-12 14:08:37 -04:00
Clinton Judy 3ac8ba51ab Fix dependency script regression 2024-04-12 14:02:57 -04:00
5 changed files with 16 additions and 54 deletions

View file

@ -1,20 +1,25 @@
#!/bin/bash
#!/usr/bin/env bash
# Abort if any command fails.
set -e
# Set up some colors for output
red=$(tput setaf 1)
green=$(tput setaf 2)
normal=$(tput sgr0)
# 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... "
printf "%-28s" "Checking for $1..."
if eval $2 &> /dev/null ; then
echo ✔︎
printf "%1s\n" "${green}✔︎${normal}"
false
else
echo ✗
printf "%1s\n" "${red}${normal}"
storytime_ready=false
true
fi

View file

@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
feed2exec \
parse \
https://www.nasa.gov/rss/dyn/breaking_news.rss \

View file

@ -1,51 +1,5 @@
#!/bin/bash
# Abort if any command fails.
set -e
#!/usr/bin/env bash
# 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
figlet "Fetching feed items."
figlet "Reading into an audio file."
figlet "Mixing video."

View file

@ -1,3 +1,4 @@
#!/bin/bash
#!/usr/bin/env 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

View file

@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
ffmpeg -loop 1 -i ../media-assets/sample_pic.png \
-i /tmp/output.mp3 \
-shortest \