Initial commit
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
40
installer.sh
Normal file
40
installer.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# this one is going to get the fortune wrapper set up and all that good stuff.
|
||||
#
|
||||
# it needs to check if fortune is installed (or misfortune if not) ans then i need to find out how to find where the fortune files are installed (i have a misfortune folder, but i cant imagine fortune stores them in there)
|
||||
# then i need to downlaod the tetofortunes and tetofortunes.dat files to that location
|
||||
#
|
||||
# then i need to write a script to ~/.local/bin caled tetosong that simply calls either fortune or misfortune (i'll check i guess?)
|
||||
#
|
||||
|
||||
if ! [ -x "$(command -v fortune)" ]; then
|
||||
echo 'fortune is not installed, checking for misfortune' >&2
|
||||
if ! [ -x "$(command -v misfortune)" ]; then
|
||||
echo 'neither program is installed, exiting' >&2
|
||||
exit 1
|
||||
else
|
||||
echo 'misfortune found' >&2
|
||||
fi
|
||||
else
|
||||
echo 'fortune found' >&2
|
||||
fi
|
||||
|
||||
mkdir -p ~/.local/share/fortune
|
||||
curl -L -o ~/.local/share/fortune/tetofortunes https://gitea.cloudaf.cc/eric/TetoSongOfTheDay/raw/branch/main/tetofortunes
|
||||
curl -L -o ~/.local/share/fortune/tetofortunes.dat https://gitea.cloudaf.cc/eric/TetoSongOfTheDay/raw/branch/main/tetofortunes.dat
|
||||
|
||||
#cat > $wineprefix_path/tetosong <<EOF
|
||||
#!/bin/bash
|
||||
#if ! [ -x "$(command -v fortune)" ]; then
|
||||
# echo 'fortune is not installed, checking for misfortune' >&2
|
||||
# if ! [ -x "$(command -v misfortune)" ]; then
|
||||
# echo 'neither program is installed, exiting' >&2
|
||||
# exit 1
|
||||
# else
|
||||
# echo 'misfortune found' >&2
|
||||
# fi
|
||||
#else
|
||||
# fortune ~/.local/share/tetofortunes/tetofortunes
|
||||
#fi
|
||||
#EOF
|
||||
62
makefortune.sh
Normal file
62
makefortune.sh
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/bash
|
||||
ARTIST=116 # 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 163 times. I think I'm ok.
|
||||
RESULTS=100 # Max results. Limit is 100.
|
||||
MAX=20000 # when to stop, there's as of 4-20-26 16327 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.
|
||||
fi
|
||||
PREVDATE=$(jq -r '.lastDate' 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')
|
||||
DATE=$(echo "$DATA" | jq -r '.items[0].publishDate')
|
||||
echo "DATE: $DATE"
|
||||
# making sure there are songs to add.
|
||||
SONGS=$(echo "$DATA" | jq '.items | length')
|
||||
if [ "$SONGS" -eq 0 ]; then
|
||||
echo "Result is empty. No more songs."
|
||||
exit 0
|
||||
fi
|
||||
echo "{\"lastDate\": \"$DATE\"}" > 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 '.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 ""
|
||||
echo "%"
|
||||
done >> tetofortunes
|
||||
if [ "$START" -ge "$MAX" ]; then
|
||||
echo "Reached max results. Stopping."
|
||||
break
|
||||
fi
|
||||
echo "Done!"
|
||||
fi
|
||||
done
|
||||
# create the fortune database from tetofortunes
|
||||
rm tetofortunes.dat # delete the old database if it extists.
|
||||
strfile -c % tetofortunes tetofortunes.dat
|
||||
146943
tetofortunes
Normal file
146943
tetofortunes
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tetofortunes.dat
Normal file
BIN
tetofortunes.dat
Normal file
Binary file not shown.
Reference in New Issue
Block a user