big update

made my own script to choose a song: vocafortune.

fixed issue where some songs would be duplicated, gave up on trying to check the date of the last song to know when to stop, changed it to the current date at midnight and added duplicate removal instead.

moved things around, should be easier to add other singers in the future if i choose to.

changed links to testing.
This commit is contained in:
2026-05-02 00:24:21 -04:00
parent 478877475b
commit a7cb1db0bc
11 changed files with 221073 additions and 220515 deletions

View File

@@ -8,10 +8,10 @@ CHILDREN="true" # If we want child voicebanks, we do so we can get all songs fro
START=0 # Start at the beginning of the recordset. if i wanted to make the file in chunks to use the api less i would use this and max to get the songs in chunks. They say dont use it "thousands of times a day", getting every teto song is 280 times. I think I'm ok. maybe. START=0 # Start at the beginning of the recordset. if i wanted to make the file in chunks to use the api less i would use this and max to get the songs in chunks. They say dont use it "thousands of times a day", getting every teto song is 280 times. I think I'm ok. maybe.
RESULTS=100 # Max results. Limit is 100. RESULTS=100 # Max results. Limit is 100.
MAX=30000 # when to stop, there's as of 4-23-26 over 28,000 songs featuring Kasane Teto in the recordset i have selected. MAX=30000 # when to stop, there's as of 4-23-26 over 28,000 songs featuring Kasane Teto in the recordset i have selected.
if [ ! -f var.json ]; then # var.json has our latest date, we use it to know where to stop going back, past it the songs already exist in the fortune file. if [ ! -f dates/${ARTIST}var.json ]; then # var.json has our latest date, we use it to know where to stop going back, past it the songs already exist in the fortune file.
echo '{"lastDate": "2000-04-21T00:00:00Z"}' > var.json # if it doesn't exist, we create it with a default date back in 2000. echo '{"lastDate": "2000-04-21T00:00:00Z"}' > dates/${ARTIST}var.json # if it doesn't exist, we create it with a default date back in 2000.
fi fi
PREVDATE=$(jq -r '.lastDate' var.json) PREVDATE=$(jq -r '.lastDate' dates/${ARTIST}var.json)
AFTERDATE=$(date -u -d "$PREVDATE + 1 Second" +"%Y-%m-%dT%H:%M:%SZ") AFTERDATE=$(date -u -d "$PREVDATE + 1 Second" +"%Y-%m-%dT%H:%M:%SZ")
echo "Result: $AFTERDATE" echo "Result: $AFTERDATE"
#rm tetofortunes var.json tetofortunes.dat # during testing we will remove everything, or if we want to regenerate the fortune file from scratch. #rm tetofortunes var.json tetofortunes.dat # during testing we will remove everything, or if we want to regenerate the fortune file from scratch.
@@ -27,9 +27,9 @@ if [ "$SONGS" -eq 0 ]; then
echo "Result is empty. No more songs." echo "Result is empty. No more songs."
exit 0 exit 0
fi fi
DATE=$(echo "$DATA" | jq -r '.items[0].publishDate') DATE=$(date -u +%Y-%m-%dT00:00:00Z)
echo "DATE: $DATE" echo "DATE: $DATE"
echo "{\"lastDate\": \"$DATE\"}" > var.json echo "{\"lastDate\": \"$DATE\"}" > dates/${ARTIST}var.json
# looping the api to get all songs we need. # looping the api to get all songs we need.
while true; do while true; do
CURLURL="https://vocadb.net/api/songs?songTypes=Original&afterDate=${AFTERDATE}&&artistId%5B%5D=${ARTIST}&childVoicebanks=${CHILDREN}&onlyWithPvs=true&status=Finished&start=${START}&maxResults=${RESULTS}&sort=PublishDate&fields=PVs" CURLURL="https://vocadb.net/api/songs?songTypes=Original&afterDate=${AFTERDATE}&&artistId%5B%5D=${ARTIST}&childVoicebanks=${CHILDREN}&onlyWithPvs=true&status=Finished&start=${START}&maxResults=${RESULTS}&sort=PublishDate&fields=PVs"
@@ -51,8 +51,8 @@ while true; do
echo "$url" echo "$url"
echo "" echo ""
echo "▼・ᴗ・▼" echo "▼・ᴗ・▼"
echo "%" echo "\`"
done >> fortunes/tetosotd/tetofortunes done >> vocafortunes/vocadb/$ARTIST
if [ "$START" -ge "$MAX" ]; then if [ "$START" -ge "$MAX" ]; then
echo "Reached max results. Stopping." echo "Reached max results. Stopping."
break break
@@ -60,6 +60,41 @@ while true; do
echo "Done!" echo "Done!"
fi fi
done done
readarray -d '`' tetosongs < vocafortunes/vocadb/$ARTIST
readarray -td '' dups < <(
(( ${#tetosongs[@]} == 0 )) ||
printf '%s\0' "${tetosongs[@]}" |
LC_ALL=C sort -z |
LC_ALL=C uniq -zd
)
readarray -td '' uniq < <(
(( ${#tetosongs[@]} == 0 )) ||
printf '%s\0' "${tetosongs[@]}" |
LC_ALL=C sort -z |
LC_ALL=C uniq -zu
)
echo ${#tetosongs[@]}
if ((${#dups[@]} > 0)); then
echo >&2 "array has duplicates:"
echo ${#dups[@]}
fi
if ((${#uniq[@]} > 0)); then
echo >&2 "Uniques:"
echo ${#uniq[@]}
fi
printf >&2 '%s' "${dups[@]}" > dups
printf >&2 '%s' "${uniq[@]}" > uniq
cat uniq > fixed
cat dups >> fixed
sed -i '1,/^TETO SONG OF THE DAY!/{/^TETO SONG OF THE DAY!$/!d}' fixed
rm vocafortunes/vocadb/$ARTIST
rm uniq dups
mv fixed vocafortunes/vocadb/$ARTIST
# create the fortune database from tetofortunes # create the fortune database from tetofortunes
rm fortunes/tetosotd/tetofortunes.dat # delete the old database if it extists. rm fortunes/tetosotd/tetofortunes.dat # delete the old database if it extists.
strfile -c % fortunes/tetosotd/tetofortunes fortunes/tetosotd/tetofortunes.dat strfile -c % fortunes/tetosotd/tetofortunes fortunes/tetosotd/tetofortunes.dat

View File

@@ -4,4 +4,4 @@ Wants=tetosong.timer
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/bin/bash -c "curl -s https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/autoupdater/updater.sh | bash" ExecStart=/usr/bin/bash -c "curl -s https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/autoupdater/updater.sh | bash"

View File

@@ -1,17 +1,22 @@
#!/usr/bin/bash #!/usr/bin/bash
#
# Updated 5-1-2026 to use new vocafortunes script instead of fortune/misfortune
#
#
# download custom fortunes and config file # download custom fortunes and config file
echo "Updating tetosong..." echo "Updating tetosong..."
# check if the config file exists, if not download it and prompt the user for options. # check if the config file exists, if not download it and prompt the user for options.
#### remove files from old version
rm -rf ~/.local/share/tetosong/fortunes/
# add new files
mkdir -p ~/.local/share/tetosong mkdir -p ~/.local/share/tetosong
mkdir -p ~/.local/share/tetosong/vocafortunes
mkdir -p ~/.local/share/tetosong/vocafortunes/vocadb
mkdir -p ~/.local/share/tetosong/fortunes curl -sLo ~/.local/share/tetosong/vocafortunes/vocadb/140308 https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/vocafortunes/vocadb/140308
mkdir -p ~/.local/share/tetosong/fortunes/tetosotd
curl -sLo ~/.local/share/tetosong/fortunes/tetosotd/tetofortunes https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/fortunes/tetosotd/tetofortunes
curl -sLo ~/.local/sharetetosong/fortunes/tetosotd/tetofortunes.dat https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/fortunes/tetosotd/tetofortunes.dat
AUDIO="$(. ~/.local/share/tetosong/tetosong.config; echo $AUDIO)" AUDIO="$(. ~/.local/share/tetosong/tetosong.config; echo $AUDIO)"
if [ "$AUDIO" = "YES" ]; then if [ "$AUDIO" = "YES" ]; then
curl -sLo ~/.local/share/tetosong/SOTD.zip https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/audio/teto/SOTD.zip curl -sLo ~/.local/share/tetosong/SOTD.zip https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/audio/teto/SOTD.zip
mkdir -p ~/.local/share/tetosong/audio/ mkdir -p ~/.local/share/tetosong/audio/
mkdir -p ~/.local/share/tetosong/audio/teto/ mkdir -p ~/.local/share/tetosong/audio/teto/
unzip -o ~/.local/share/tetosong/SOTD.zip -d ~/.local/share/tetosong/audio/teto/ unzip -o ~/.local/share/tetosong/SOTD.zip -d ~/.local/share/tetosong/audio/teto/
@@ -25,8 +30,8 @@ if [ "$AUTOUPDATE" = "YES" ]; then
# write and enable systemd service file and timer user services # write and enable systemd service file and timer user services
echo "Auto-Updater enabled, updating service..." echo "Auto-Updater enabled, updating service..."
mkdir -p ~/.config/systemd/user mkdir -p ~/.config/systemd/user
curl -sLo ~/.config/systemd/user/tetosong.service https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/autoupdater/tetosong.service curl -sLo ~/.config/systemd/user/tetosong.service https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/autoupdater/tetosong.service
curl -sLo ~/.config/systemd/user/tetosong.timer https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/autoupdater/tetosong.timer curl -sLo ~/.config/systemd/user/tetosong.timer https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/autoupdater/tetosong.timer
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user enable tetosong.timer systemctl --user enable tetosong.timer
systemctl --user start tetosong.timer systemctl --user start tetosong.timer
@@ -36,6 +41,8 @@ fi
# write tetosong to ~/.local/bin and tell the user how to use it. # write tetosong to ~/.local/bin and tell the user how to use it.
echo "writing tetosong to ~/.local/bin" echo "writing tetosong to ~/.local/bin"
mkdir -p ~/.local/bin mkdir -p ~/.local/bin
curl -sLo ~/.local/bin/tetosong https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetosong curl -sLo ~/.local/bin/tetosong https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/tetosong
curl -sLo ~/.local/bin/tetosong https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/vocafortune
chmod +x ~/.local/bin/tetosong chmod +x ~/.local/bin/tetosong
echo "Update complete" chmod +x ~/.local/bin/vocafortune
echo "Make sure ~/.local/bin is in your PATH and you can get your Teto Song Of the Day by typing in tetosong or adding it to your bashrc :)"

1
dates/140308var.json Normal file
View File

@@ -0,0 +1 @@
{"lastDate": "2026-05-02T00:00:00Z"}

Binary file not shown.

View File

@@ -1,27 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# check which fortune command is installed if any. #
if ! [ -x "$(command -v fortune)" ]; then # Updated 5-1-2026 to use new vocafortunes script instead of fortune/misfortune
echo 'fortune is not installed, checking for misfortune'm #
if ! [ -x "$(command -v misfortune)" ]; then #
echo 'neither program is installed, exiting' #
exit 1
else
echo 'misfortune found'
fi
else
echo 'fortune found'
fi
# download custom fortunes and config file # download custom fortunes and config file
echo "Downloading custom fortunes and config file..." echo "Downloading custom fortunes and config file..."
# download the config file and prompt the user for options. # download the config file and prompt the user for options.
mkdir -p ~/.local/share/tetosong mkdir -p ~/.local/share/tetosong
curl -sLo ~/.local/share/tetosong/tetosong.config https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/tetosong.config curl -sLo ~/.local/share/tetosong/tetosong.config https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/tetosong.config
read -p "Do you want to hear Teto in your terminal? (y/n) " yn read -p "Do you want to hear Teto in your terminal? (y/n) " yn
case $yn in case $yn in
[Yy]* ) [Yy]* )
sed -i 's|^AUDIO=.*|AUDIO="YES"|' ~/.local/share/tetosong/tetosong.config sed -i 's|^AUDIO=.*|AUDIO="YES"|' ~/.local/share/tetosong/tetosong.config
curl -sLo /tmp/SOTD.zip https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/audio/teto/SOTD.zip curl -sLo /tmp/SOTD.zip https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/audio/teto/SOTD.zip
mkdir -p ~/.local/share/tetosong/audio/ mkdir -p ~/.local/share/tetosong/audio/
mkdir -p ~/.local/share/tetosong/audio/teto/ mkdir -p ~/.local/share/tetosong/audio/teto/
unzip -o /tmp/SOTD.zip -d ~/.local/share/tetosong/audio/teto/ unzip -o /tmp/SOTD.zip -d ~/.local/share/tetosong/audio/teto/
@@ -38,10 +31,9 @@ case $yn in
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
mkdir -p ~/.local/share/tetosong/fortunes mkdir -p ~/.local/share/tetosong/vocafortunes
mkdir -p ~/.local/share/tetosong/fortunes/tetosotd curl -sLo ~/.local/share/tetosong/vocafortunes/vocadb/140308 https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/fortunes/vocafortunes/140308
curl -sLo ~/.local/share/tetosong/fortunes/tetosotd/tetofortunes https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/fortunes/tetosotd/tetofortunes
curl -sLo ~/.local/share/tetosong/fortunes/tetosotd/tetofortunes.dat https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/fortunes/tetosotd/tetofortunes.dat
# set up autoupdater # set up autoupdater
# i use systemd, so i use systemd timers. I'll figure out something for non-systemd users later. # i use systemd, so i use systemd timers. I'll figure out something for non-systemd users later.
@@ -50,8 +42,8 @@ if [ "$AUTOUPDATE" = "YES" ]; then
# write and enable systemd service file and timer user services # write and enable systemd service file and timer user services
echo "Autoupdater enabled, updating service..." echo "Autoupdater enabled, updating service..."
mkdir -p ~/.config/systemd/user mkdir -p ~/.config/systemd/user
curl -sLo ~/.config/systemd/user/tetosong.service https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/autoupdater/tetosong.service curl -sLo ~/.config/systemd/user/tetosong.service https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/autoupdater/tetosong.service
curl -sLo ~/.config/systemd/user/tetosong.timer https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/autoupdater/tetosong.timer curl -sLo ~/.config/systemd/user/tetosong.timer https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/autoupdater/tetosong.timer
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user enable tetosong.timer systemctl --user enable tetosong.timer
systemctl --user start tetosong.timer systemctl --user start tetosong.timer
@@ -61,6 +53,8 @@ fi
# write tetosong to ~/.local/bin and tell the user how to use it. # write tetosong to ~/.local/bin and tell the user how to use it.
echo "writing tetosong to ~/.local/bin" echo "writing tetosong to ~/.local/bin"
mkdir -p ~/.local/bin mkdir -p ~/.local/bin
curl -sLo ~/.local/bin/tetosong https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/test/tetosong curl -sLo ~/.local/bin/tetosong https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/tetosong
curl -sLo ~/.local/bin/tetosong https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/vocafortune
chmod +x ~/.local/bin/tetosong chmod +x ~/.local/bin/tetosong
chmod +x ~/.local/bin/vocafortune
echo "Make sure ~/.local/bin is in your PATH and you can get your Teto Song Of the Day by typing in tetosong or adding it to your bashrc :)" echo "Make sure ~/.local/bin is in your PATH and you can get your Teto Song Of the Day by typing in tetosong or adding it to your bashrc :)"

View File

@@ -4,10 +4,10 @@ CHILDREN="true" # If we want child voicebanks, we do so we can get all songs fro
START=0 # Start at the beginning of the recordset. if i wanted to make the file in chunks to use the api less i would use this and max to get the songs in chunks. They say dont use it "thousands of times a day", getting every teto song is 280 times. I think I'm ok. maybe. START=0 # Start at the beginning of the recordset. if i wanted to make the file in chunks to use the api less i would use this and max to get the songs in chunks. They say dont use it "thousands of times a day", getting every teto song is 280 times. I think I'm ok. maybe.
RESULTS=100 # Max results. Limit is 100. RESULTS=100 # Max results. Limit is 100.
MAX=30000 # when to stop, there's as of 4-23-26 over 28,000 songs featuring Kasane Teto in the recordset i have selected. MAX=30000 # when to stop, there's as of 4-23-26 over 28,000 songs featuring Kasane Teto in the recordset i have selected.
if [ ! -f var.json ]; then # var.json has our latest date, we use it to know where to stop going back, past it the songs already exist in the fortune file. if [ ! -f dates/${ARTIST}var.json ]; then # var.json has our latest date, we use it to know where to stop going back, past it the songs already exist in the fortune file.
echo '{"lastDate": "2000-04-21T00:00:00Z"}' > var.json # if it doesn't exist, we create it with a default date back in 2000. echo '{"lastDate": "2000-04-21T00:00:00Z"}' > dates/${ARTIST}var.json # if it doesn't exist, we create it with a default date back in 2000.
fi fi
PREVDATE=$(jq -r '.lastDate' var.json) PREVDATE=$(jq -r '.lastDate' dates/${ARTIST}var.json)
AFTERDATE=$(date -u -d "$PREVDATE + 1 Second" +"%Y-%m-%dT%H:%M:%SZ") AFTERDATE=$(date -u -d "$PREVDATE + 1 Second" +"%Y-%m-%dT%H:%M:%SZ")
echo "Result: $AFTERDATE" echo "Result: $AFTERDATE"
#rm tetofortunes var.json tetofortunes.dat # during testing we will remove everything, or if we want to regenerate the fortune file from scratch. #rm tetofortunes var.json tetofortunes.dat # during testing we will remove everything, or if we want to regenerate the fortune file from scratch.
@@ -23,9 +23,9 @@ if [ "$SONGS" -eq 0 ]; then
echo "Result is empty. No more songs." echo "Result is empty. No more songs."
exit 0 exit 0
fi fi
DATE=$(echo "$DATA" | jq -r '.items[0].publishDate') DATE=$(date -u +%Y-%m-%dT00:00:00Z)
echo "DATE: $DATE" echo "DATE: $DATE"
echo "{\"lastDate\": \"$DATE\"}" > var.json echo "{\"lastDate\": \"$DATE\"}" > dates/${ARTIST}var.json
# looping the api to get all songs we need. # looping the api to get all songs we need.
while true; do while true; do
CURLURL="https://vocadb.net/api/songs?songTypes=Original&afterDate=${AFTERDATE}&&artistId%5B%5D=${ARTIST}&childVoicebanks=${CHILDREN}&onlyWithPvs=true&status=Finished&start=${START}&maxResults=${RESULTS}&sort=PublishDate&fields=PVs" CURLURL="https://vocadb.net/api/songs?songTypes=Original&afterDate=${AFTERDATE}&&artistId%5B%5D=${ARTIST}&childVoicebanks=${CHILDREN}&onlyWithPvs=true&status=Finished&start=${START}&maxResults=${RESULTS}&sort=PublishDate&fields=PVs"
@@ -47,8 +47,8 @@ while true; do
echo "$url" echo "$url"
echo "" echo ""
echo "▼・ᴗ・▼" echo "▼・ᴗ・▼"
echo "%" echo "\`"
done >> tetofortunes done >> vocafortunes/vocadb/$ARTIST
if [ "$START" -ge "$MAX" ]; then if [ "$START" -ge "$MAX" ]; then
echo "Reached max results. Stopping." echo "Reached max results. Stopping."
break break
@@ -56,6 +56,42 @@ while true; do
echo "Done!" echo "Done!"
fi fi
done done
readarray -d '`' tetosongs < vocafortunes/vocadb/$ARTIST
readarray -td '' dups < <(
(( ${#tetosongs[@]} == 0 )) ||
printf '%s\0' "${tetosongs[@]}" |
LC_ALL=C sort -z |
LC_ALL=C uniq -zd
)
readarray -td '' uniq < <(
(( ${#tetosongs[@]} == 0 )) ||
printf '%s\0' "${tetosongs[@]}" |
LC_ALL=C sort -z |
LC_ALL=C uniq -zu
)
echo ${#tetosongs[@]}
if ((${#dups[@]} > 0)); then
echo >&2 "array has duplicates:"
echo ${#dups[@]}
fi
if ((${#uniq[@]} > 0)); then
echo >&2 "Uniques:"
echo ${#uniq[@]}
fi
printf >&2 '%s' "${dups[@]}" > dups
printf >&2 '%s' "${uniq[@]}" > uniq
cat uniq > fixed
cat dups >> fixed
sed -i '1,/^TETO SONG OF THE DAY!/{/^TETO SONG OF THE DAY!$/!d}' fixed
rm vocafortunes/vocadb/$ARTIST
rm uniq dups
mv fixed vocafortunes/vocadb/$ARTIST
# create the fortune database from tetofortunes # create the fortune database from tetofortunes
rm tetofortunes.dat # delete the old database if it extists. #rm tetofortunes.dat # delete the old database if it extists.
strfile -c % tetofortunes tetofortunes.dat #strfile -c % tetofortunes tetofortunes.dat

View File

@@ -1,10 +1,15 @@
#!/usr/bin/bash #!/usr/bin/bash
#
# Updated 5-1-26 to use new vocafortune script and not require fortune/misfortune.
#
#
# argument handling # argument handling
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-u|--update) -u|--update)
echo "Downloading tetosong updater..." echo "Downloading tetosong updater..."
bash <(curl -s https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/autoupdater/updater.sh) bash <(curl -s https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/autoupdater/updater.sh)
shift shift
exit 0 exit 0
;; ;;
@@ -26,46 +31,22 @@ done
# check if the config file exists, if not download it # check if the config file exists, if not download it
if [ ! -f ~/.local/share/tetosong/tetosong.config ]; then if [ ! -f ~/.local/share/tetosong/tetosong.config ]; then
echo "Config file not found, downloading default..." 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 curl -sLo ~/.local/share/tetosong/tetosong.config https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/testing/tetosong.config
fi fi
# check if the user wants to play audio # check if the user wants to play audio
AUDIO="$(. ~/.local/share/tetosong/tetosong.config; echo $AUDIO)" AUDIO="$(. ~/.local/share/tetosong/tetosong.config; echo $AUDIO)"
# check which fortune command is installed if any and then run it vocafortune >> /tmp/fortune
if ! [ -x "$(command -v fortune)" ]; then if [ "$AUDIO" = "YES" ]; then
if ! [ -x "$(command -v misfortune)" ]; then if grep -q "SV2" /tmp/fortune; then
echo 'No fortune commmand is installed, exiting!' nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/sv2SOTD.wav 2>/dev/null >/dev/null &
exit 1 elif grep -q "SV" /tmp/fortune; then
else nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/svSOTD.wav 2>/dev/null >/dev/null &
misfortune ~/.local/share/tetosong/fortunes/*/* >> /tmp/fortune # fortune and misfortune handle directories differently elif grep -q "重音テト" /tmp/fortune; then
if [ "$AUDIO" = "YES" ]; then # i guess i could foregoe checking and just run the audio either way since i dont download it unless the user enables it, but i want them to be ableto turn it off if they choose to nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/utSOTD.wav 2>/dev/null >/dev/null &
if grep -q "SV2" /tmp/fortune; then else
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/sv2SOTD.wav 2>/dev/null >/dev/null & nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/sv2SOTD.wav 2>/dev/null >/dev/null &
elif grep -q "SV" /tmp/fortune; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/svSOTD.wav 2>/dev/null >/dev/null &
elif grep -q "重音テト" /tmp/fortune; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/utSOTD.wav 2>/dev/null >/dev/null &
else
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/sv2SOTD.wav 2>/dev/null >/dev/null &
fi
fi
cat /tmp/fortune
rm /tmp/fortune
fi
else
fortune ~/.local/share/tetosong/fortunes/* >> /tmp/fortune
if [ "$AUDIO" = "YES" ]; then
if grep -q "SV2" /tmp/fortune; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/sv2SOTD.wav 2>/dev/null >/dev/null &
elif grep -q "SV" /tmp/fortune; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/svSOTD.wav 2>/dev/null >/dev/null &
elif grep -q "重音テト" /tmp/fortune; then
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/utSOTD.wav 2>/dev/null >/dev/null &
else
nohup ffplay -nodisp -autoexit -v quiet ~/.local/share/tetosong/audio/teto/sv2SOTD.wav 2>/dev/null >/dev/null &
fi
fi fi
fi
cat /tmp/fortune cat /tmp/fortune
rm /tmp/fortune rm /tmp/fortune
fi

View File

@@ -1 +0,0 @@
{"lastDate": "2026-05-27T00:00:00Z"}

10
vocafortune Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# VOCAFORTUNE! Make tetosong not need fortune anymore!
while [ $# -gt 0 ]; do export "${1#-}"="$2"; shift 2; done # now it can be -l ./vocafortunes like a proper program!!!! # argument handling # i can use this anywhere!!!!!!! save this you!!!!!!
#fortune script
shopt -s globstar
if [ -z "$l" ]; then export "DIR"="~/.local/share/tetosong/vocafortunes/**"; else export "DIR"="$l/**"; fi
for file in $DIR; do if [[ -f "$file" ]]; then readarray -td '`' temp < "$file"; array+=("${temp[@]}"); fi; done
export "ITEMS"="${#array[@]}"
export "CHOICE"="$(shuf -i 1-$ITEMS -n 1)"
echo "${array[$CHOICE]}"

File diff suppressed because it is too large Load Diff