diff --git a/.bashrc b/.bashrc index d3a98c7..9c2f66b 100644 --- a/.bashrc +++ b/.bashrc @@ -18,7 +18,7 @@ function yts { yt-dlp --get-title --get-duration --get-id ytsearch10:"'$*'"; } function ytl { echo https://inv.riverside.rocks/watch?v=$1; } function ytv { echo https://inv.riverside.rocks/watch?v=$(yt-dlp --get-id ytsearch:"'$*'"); } function ytl2 { echo https://youtube.com/watch?v=$1; } -function vid { mpv "https://inv.riverside.rocks/latest_version?id=$1&itag=22&local=true"; } +function vid { vlc "https://inv.riverside.rocks/latest_version?id=$1&itag=22&local=true"; } #honorary jewtube function nts { yt-dlp --get-title --get-duration --get-id nicosearch10:"$*"; } @@ -56,6 +56,21 @@ function catbox alias shitpost="~/tinker/tinyscripts/shitpost.sh" function cheat { curl "cheat.sh/$*"; } function unroll { magick $1 -layers CompareAny blah.png; } +function ga +{ + PROG=sxiv + TARGET=~/Games/img.silvie.org/docs/cdn/deck-builder/ + BLOB=$TARGET/search.json + if [ $1 == -r ]; then PROG=ristretto; shift; fi + if [ $1 == -i ]; then PROG=; shift; fi + if grep -Eq '[0-9a-zA-Z]{10}' <<< "$1"; then id=$1 # This format is fucking shit, just randomly capital letters on one in 50 cards. + else name="$*"; fi + + if [ $id -a $PROG ]; then $PROG $TARGET$id.jpg; return; fi # Can skip the search.json lookup (not really necessary) + if [ -z $id ]; then data=`jq '.[]|select(.n=="'"$name"'")' < $BLOB`; fi + if [ -z $PROG ]; then jq <<< "$data"; return; fi + $PROG $TARGET`jq -r .u <<< "$data"`.jpg +} #fun function space { python -c "print(\" \".join(\"$*\"))"; } diff --git a/ga_silvie_to_cockatrice.sh b/ga_silvie_to_cockatrice.sh new file mode 100755 index 0000000..a584843 --- /dev/null +++ b/ga_silvie_to_cockatrice.sh @@ -0,0 +1,55 @@ +# Only really need to remove sets.*. head/cards get reinitialised anyway, 05 only gets written once so always reinits, and pics basically doesn't change unless it's broken. +rm -r head.xml cards.xml sets.csv sets.xml 05.ga.xml pics + +echo ' + + + Zergling_man + '"`date -Iseconds`"' + https://github.com/ItsSilvie/img.silvie.org/ + '"`git log | head -n 1 | awk '{ print $2 }'`"' + +' > head.xml +echo ' +' > cards.xml + +for id in `jq -r '.[]|.u' < search.json`; do +jq -r '" + "+.name+" + "+.effect_raw+" + "+if .power==null and (.life//.durability)==null then "" else " + "+(.power//""|tostring)+"/"+((.life//.durability//"")|tostring)+"" end+" + "+({"null":"","false":"Slow ","true":"Fast "}[.speed|tostring])+(.types|join(" "))+" - "+(.subtypes|join(" "))+" + "+.types[0]+" + "+((.cost_reserve//.cost_memory)|tostring)+" + "+((.cost_reserve//.cost_memory)|tostring)+""+if .elements==["NORM"] then "" else " + "+(.elements|map({"NORM":"","WATER":"U","FIRE":"R","WIND":"G","EXALTED":"W","ARCANE":"B","ASTRA":"B","CRUX":"B","EXIA":"B","LUXEM":"B","NEOS":"B","TERA":"B","UMBRA":"B"}[.])|join(""))+" + "+(.elements|map({"NORM":"","WATER":"U","FIRE":"R","WIND":"G","EXALTED":"W","ARCANE":"B","ASTRA":"B","CRUX":"B","EXIA":"B","LUXEM":"B","NEOS":"B","TERA":"B","UMBRA":"B"}[.])|join(""))+"" end+" + + "+(.editions|map(""+.set.prefix+"")|join(" + "))+" + "+if (.cost_memory != null) then "1" else "2" end+" + "' < $id.json >> cards.xml + IFS=, read set name <<< "`jq -r '.editions[0].set.prefix+","+.name' < $id.json`" + install -d "pics/$set" + cp $id.jpg "pics/$set/$name.jpg" + jq -r '.editions[]|.set|.prefix+","+.name+","+.release_date' < $id.json >> sets.csv +done + +cat sets.csv | sort | uniq > sets2.csv +mv sets2.csv sets.csv + +while read line; do + IFS=, read pfx name date <<< "$line" + echo ' + '"$pfx"' + '"$name"' + Grand Archive + '"`date -d $date -I`"' +' >> sets.xml +done < sets.csv + +echo ' +' >> cards.xml + +cat head.xml sets.xml cards.xml > 05.ga.xml \ No newline at end of file diff --git a/shitpost.sh b/shitpost.sh index f1a64af..4fcb235 100755 --- a/shitpost.sh +++ b/shitpost.sh @@ -15,4 +15,4 @@ ssh jasmine chown http:http "'/srv/http$sp_targ'" ssh jasmine chmod 664 "'/srv/http$sp_targ'" echo "http://rakka.au$sp_targ" | sed 's/ /%20/g' - - -#desu.si, catbox.moe +#desu.si, catbox.moe, bunkr.cr