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.
11 lines
622 B
Bash
Executable File
11 lines
622 B
Bash
Executable File
#!/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]}"
|