22 Commits
eggs ... main

Author SHA1 Message Date
135b7e5da8 Update README.md 2026-05-02 01:06:53 -04:00
cccddb7045 Merge pull request #3 from eric5949/testing
Testing
2026-05-02 01:05:23 -04:00
d9372881bf Merge branch 'main' into testing 2026-05-02 01:05:08 -04:00
e9add46de0 update links back to main 2026-05-02 01:01:58 -04:00
e0728a6ab3 Update automakefortune.sh 2026-05-02 00:58:56 -04:00
bd7b0be8e6 Update vocafortune 2026-05-02 00:44:37 -04:00
70e2b73883 Update installer.sh
again...
2026-05-02 00:35:37 -04:00
c5397a501b Update installer.sh 2026-05-02 00:29:30 -04:00
542ba1b9b0 fix installer 2026-05-02 00:27:48 -04:00
a7cb1db0bc 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.
2026-05-02 00:24:21 -04:00
fe5c02be27 Update URLs to use main branch for downloads 2026-05-01 20:55:13 -04:00
478877475b fix automakefortune.sh
failed last week because i forgot dumb stuff.
2026-04-27 23:01:03 -04:00
Eric Mitchell
0445d33adc Update fortune files 2026-04-28 02:58:45 +00:00
bb2c970a71 Update README with formatting corrections 2026-04-25 11:39:24 -04:00
b5f64677ee Merge pull request #1 from eric5949/test
add different tetos and clean up some things for future flexibiltiy
2026-04-25 11:38:28 -04:00
8adbb1274e Update updater.sh 2026-04-25 11:33:35 -04:00
7e5b1b4e20 update 2026-04-25 11:32:17 -04:00
35321f0f4a fix installer and update readme.
update links back to main for merge
2026-04-25 11:31:11 -04:00
cb11960fbb Update installer.sh 2026-04-25 11:20:51 -04:00
86e986227f big update
- added multiple teto voices based on the song returned by fortune
- moved files around for future flexibility
- added automakefortune service
2026-04-25 11:19:43 -04:00
4716231802 Fix mkdir command posistion in installer.sh
can't write the config if the folder for it doesnt exist yet
2026-04-24 11:06:02 -04:00
35bc81e2da Update ExecStart to use remote updater script
it was set to use my local copy '0_0
2026-04-24 10:55:59 -04:00
18 changed files with 220994 additions and 219899 deletions

View File

@@ -1,22 +1,22 @@
# **Kasane Teto in Your Terminal!**
## **Find songs nobody knows exist!**
A small wrapper and custom list for fortune/misfortune that picks a random Teto song of the day from any of almost 28,000 original, finished songs with videos on VocaDB. Your original fortune command will remain untouched, tetosong just tells it to use a custom directory.
A small fortune type script that picks a random Teto song of the day from any of over 28,000 original, finished songs with videos on VocaDB.
## **Enable Audio to Hear "Teto Song of the Day!" in your terminal from Utau, SynthV, or SynthV2 Teto!**
Sound plays based on the song you get! Utau for Utau! SV for SV!
https://github.com/user-attachments/assets/bc2a9909-d24a-43fa-882a-5e785cda3020
## **Now With Optional Automatic Updates!**
Disabled by default, opt-in during setup to enable a systemd user service and timer to update the script and song list every Sunday at 5AM UTC. I check for new songs and push new tetofortunes from my server every Sunday at 3AM UTC
## **Dependencies**
NO LONGER REQUIRES FORTUNE
### install.sh and tetosong
fortune/fortune-mod or misfortune
ffmpeg -optional for speaking Teto
### makefortune.sh
fortune/fortune-mod (for strfile)
jq
## *Install and Run*

BIN
audio/teto/SOTD.zip Normal file

Binary file not shown.

BIN
audio/teto/svSOTD.wav Normal file

Binary file not shown.

BIN
audio/teto/utSOTD.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,101 @@
#!/usr/bin/env bash
cd $HOME
yes | rm -r tetosong
git clone git@github.com:eric5949/tetosong.git
cd tetosong
ARTIST=140308 # 116 is Kasane Teto
CHILDREN="true" # If we want child voicebanks, we do so we can get all songs from utau, sv, and sv2
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.
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 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"}' > dates/${ARTIST}var.json # if it doesn't exist, we create it with a default date back in 2000.
fi
PREVDATE=$(jq -r '.lastDate' dates/${ARTIST}var.json)
AFTERDATE=$(date -u -d "$PREVDATE + 1 Second" +"%Y-%m-%dT%H:%M:%SZ")
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.
# setting the latest date. just pulling the latest song from the api and setting the createDate as the latest date in var.json for use when we update the fortune file again, dont want to add the same songs twice. idk how I'll handle broken links and such, maybe just regenerate the whole thing periodically.
CURLURL="https://vocadb.net/api/songs?songTypes=Original&afterDate=${AFTERDATE}&&artistId%5B%5D=${ARTIST}&childVoicebanks=${CHILDREN}&onlyWithPvs=true&status=Finished&start=0&maxResults=1&sort=PublishDate&fields=PVs"
echo "CURLURL: $CURLURL"
DATA=$(curl -X 'GET' \
$CURLURL \
-H 'accept: application/json')
# making sure there are songs to add.
SONGS=$(echo "$DATA" | jq -c '.items | length')
if [ "$SONGS" -eq 0 ]; then
echo "Result is empty. No more songs."
exit 0
fi
DATE=$(date -u +%Y-%m-%dT00:00:00Z)
echo "DATE: $DATE"
echo "{\"lastDate\": \"$DATE\"}" > dates/${ARTIST}var.json
# looping the api to get all songs we need.
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"
DATA=$(curl -X 'GET' \
$CURLURL \
-H 'accept: application/json')
SONGS=$(echo "$DATA" | jq -r '.items | length')
if [ "$SONGS" -eq 0 ]; then
echo "Result is empty. No more songs."
break
else
START=$((START + SONGS))
echo "Found songs! Processing... (Total fetched: $START)"
echo "$DATA" | jq -r '.items[] | [.artistString, .defaultName, .pvs[0].url] | @tsv' | while IFS=$'\t' read -r artist name url; do
echo "TETO SONG OF THE DAY!"
echo ""
echo "$artist -- $name"
echo ""
echo "$url"
echo ""
echo "▼・ᴗ・▼"
echo "\`"
done >> vocafortunes/vocadb/$ARTIST
if [ "$START" -ge "$MAX" ]; then
echo "Reached max results. Stopping."
break
fi
echo "Done!"
fi
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
git add vocafortunes/vocadb/$ARTIST dates/${ARTIST}var.json
git commit -m "Update fortune files"
git push -u origin main

View File

@@ -0,0 +1,7 @@
[Unit]
Description=tetofortunes autoupdater
Wants=makefortune.timer
[Service]
Type=oneshot
ExecStart=%h/.local/bin/automakefortune.sh

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Run automakefortune.sh once a week
[Timer]
OnCalendar=Sun *-*-* 03:00:00
Persistent=true
Unit=makefortune.service
[Install]
WantedBy=timers.target

View File

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

View File

@@ -1,15 +1,27 @@
#!/usr/bin/bash
#
# Updated 5-1-2026 to use new vocafortunes script instead of fortune/misfortune
#
#
# download custom fortunes and config file
echo "Updating tetosong..."
# check if the config file exists, if not download it and prompt the user for options.
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
#### remove files from old version
rm -rf ~/.local/share/tetosong/fortunes/
# add new files
mkdir -p ~/.local/share/tetosong
curl -sLo ~/.local/share/tetosong/tetofortunes https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetofortunes
curl -sLo ~/.local/share/tetosong/tetofortunes.dat https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetofortunes.dat
curl -sLo ~/.local/share/tetosong/sv2SOTD.wav https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/sv2SOTD.wav
mkdir -p ~/.local/share/tetosong/vocafortunes
mkdir -p ~/.local/share/tetosong/vocafortunes/vocadb
curl -sLo ~/.local/share/tetosong/vocafortunes/vocadb/140308 https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/vocafortunes/vocadb/140308
AUDIO="$(. ~/.local/share/tetosong/tetosong.config; echo $AUDIO)"
if [ "$AUDIO" = "YES" ]; then
curl -sLo ~/.local/share/tetosong/SOTD.zip https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/audio/teto/SOTD.zip
mkdir -p ~/.local/share/tetosong/audio/
mkdir -p ~/.local/share/tetosong/audio/teto/
unzip -o ~/.local/share/tetosong/SOTD.zip -d ~/.local/share/tetosong/audio/teto/
rm ~/.local/share/tetosong/SOTD.zip
fi
# set up autoupdater
# # i use systemd, so i use systemd timers. I'll figure out something for non-systemd users later.
@@ -30,5 +42,7 @@ fi
echo "writing tetosong to ~/.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/main/vocafortune
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"}

View File

@@ -1,38 +1,40 @@
#!/usr/bin/bash
# check which fortune command is installed if any.
if ! [ -x "$(command -v fortune)" ]; then
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
#!/usr/bin/env bash
#
# Updated 5-1-2026 to use new vocafortunes script instead of fortune/misfortune
#
#
#
# download custom fortunes and config file
echo "Downloading custom fortunes and config file..."
# download the config file and prompt the user for options.
mkdir -p ~/.local/share/tetosong
curl -sLo ~/.local/share/tetosong/tetosong.config https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetosong.config
read -p "Do you want to hear Teto in your terminal? (y/n) " yn
case $yn in
[Yy]* ) sed -i 's|^AUDIO=.*|AUDIO="YES"|' ~/.local/share/tetosong/tetosong.config ;;
[Yy]* )
sed -i 's|^AUDIO=.*|AUDIO="YES"|' ~/.local/share/tetosong/tetosong.config
curl -sLo /tmp/SOTD.zip https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/audio/teto/SOTD.zip
mkdir -p ~/.local/share/tetosong/audio/
mkdir -p ~/.local/share/tetosong/audio/teto/
unzip -o /tmp/SOTD.zip -d ~/.local/share/tetosong/audio/teto/
rm /tmp/SOTD.zip
;;
[Nn]* ) sed -i 's|^AUDIO=.*|AUDIO="NO"|' ~/.local/share/tetosong/tetosong.config ;;
* ) echo "Please answer yes or no.";;
esac
read -p "Do you want to enable automatic updates? (y/n) " yn
case $yn in
[Yy]* ) sed -i 's|^AUTOUPDATE=.*|AUTOUPDATE="YES"|' ~/.local/share/tetosong/tetosong.config ;;
[Yy]* )
sed -i 's|^AUTOUPDATE=.*|AUTOUPDATE="YES"|' ~/.local/share/tetosong/tetosong.config ;;
[Nn]* ) sed -i 's|^AUTOUPDATE=.*|AUTOUPDATE="NO"|' ~/.local/share/tetosong/tetosong.config ;;
* ) echo "Please answer yes or no.";;
esac
mkdir -p ~/.local/share/tetosong
curl -sLo ~/.local/share/tetosong/tetofortunes https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetofortunes
curl -sLo ~/.local/share/tetosong/tetofortunes.dat https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/tetofortunes.dat
curl -sLo ~/.local/share/tetosong/sv2SOTD.wav https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/sv2SOTD.wav
mkdir -p ~/.local/share/tetosong/vocafortunes
mkdir -p ~/.local/share/tetosong/vocafortunes/vocadb
curl -sLo ~/.local/share/tetosong/vocafortunes/vocadb/140308 https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/vocafortunes/vocadb/140308
# set up autoupdater
# i use systemd, so i use systemd timers. I'll figure out something for non-systemd users later.
@@ -53,5 +55,7 @@ fi
echo "writing tetosong to ~/.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/vocafortune https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/vocafortune
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 :)"

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.
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.
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.
echo '{"lastDate": "2000-04-21T00:00:00Z"}' > var.json # if it doesn't exist, we create it with a default date back in 2000.
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"}' > dates/${ARTIST}var.json # if it doesn't exist, we create it with a default date back in 2000.
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")
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.
@@ -23,9 +23,9 @@ if [ "$SONGS" -eq 0 ]; then
echo "Result is empty. No more songs."
exit 0
fi
DATE=$(echo "$DATA" | jq -r '.items[0].publishDate')
DATE=$(date -u +%Y-%m-%dT00:00:00Z)
echo "DATE: $DATE"
echo "{\"lastDate\": \"$DATE\"}" > var.json
echo "{\"lastDate\": \"$DATE\"}" > dates/${ARTIST}var.json
# looping the api to get all songs we need.
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"
@@ -47,8 +47,8 @@ while true; do
echo "$url"
echo ""
echo "▼・ᴗ・▼"
echo "%"
done >> tetofortunes
echo "\`"
done >> vocafortunes/vocadb/$ARTIST
if [ "$START" -ge "$MAX" ]; then
echo "Reached max results. Stopping."
break
@@ -56,6 +56,42 @@ while true; do
echo "Done!"
fi
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
rm tetofortunes.dat # delete the old database if it extists.
strfile -c % tetofortunes tetofortunes.dat
#rm tetofortunes.dat # delete the old database if it extists.
#strfile -c % tetofortunes tetofortunes.dat

Binary file not shown.

View File

@@ -1,13 +1,18 @@
#!/usr/bin/bash
#
# Updated 5-1-26 to use new vocafortune script and not require fortune/misfortune.
#
#
# argument handling
while [[ $# -gt 0 ]]; do
case $1 in
-u|--update)
echo "Downloading tetosong updater..."
bash <(curl -s https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/autoupdater/updater.sh)
shift
exit 0
;;
-u|--update)
echo "Downloading tetosong updater..."
bash <(curl -s https://raw.githubusercontent.com/eric5949/tetosong/refs/heads/main/autoupdater/updater.sh)
shift
exit 0
;;
-h|--help)
echo "--- TETOSONG HELP ---"
echo ""
@@ -25,26 +30,23 @@ done
# 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
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 &
vocafortune >> /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
fortune ~/.local/share/tetosong
fi
cat /tmp/fortune
rm /tmp/fortune

View File

@@ -1 +0,0 @@
{"lastDate": "2026-04-24T00: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"="$HOME/.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