Files
tetosong/tetosong

27 lines
1.2 KiB
Bash

#!/usr/bin/bash
# check if the config file exists, if not download it
if [ ! -f ~/.local/share/tetosong/tetosong.config ]; then
echo "Config file not found, downloading default..."
curl -sLo ~/.local/share/tetosong/tetosong.config https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetosong.config
fi
# check if the user wants to play audio
AUDIO="$(. ~/.local/share/tetosong/tetosong.config; echo $AUDIO)"
# check which fortune command is installed if any and then run it
if ! [ -x "$(command -v fortune)" ]; then
if ! [ -x "$(command -v misfortune)" ]; then
echo 'No fortune commmand is installed, exiting!'
exit 1
else
if [ "$AUDIO" = "YES" ]; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/sv2SOTD.wav 2>/dev/null >/dev/null &
fi
misfortune ~/.local/share/tetosong/* # fortune doesnt care if you give it a directory, apparently misfortune does. watch this be a problem when i go to add SynthV Teto in a separate file.
fi
else
if [ "$AUDIO" = "YES" ]; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/sv2SOTD.wav 2>/dev/null >/dev/null &
fi
fortune ~/.local/share/tetosong
fi