I guess I play GA now
This commit is contained in:
parent
c5c23cdbd0
commit
0f0786f957
17
.bashrc
17
.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(\"$*\"))"; }
|
||||
|
55
ga_silvie_to_cockatrice.sh
Executable file
55
ga_silvie_to_cockatrice.sh
Executable file
@ -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 '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cockatrice_carddatabase version="4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<info>
|
||||
<author>Zergling_man</author>
|
||||
<createdAt>'"`date -Iseconds`"'</createdAt>
|
||||
<sourceUrl>https://github.com/ItsSilvie/img.silvie.org/</sourceUrl>
|
||||
<sourceVersion>'"`git log | head -n 1 | awk '{ print $2 }'`"'</sourceVersion>
|
||||
</info>
|
||||
<sets>' > head.xml
|
||||
echo '</sets>
|
||||
<cards>' > cards.xml
|
||||
|
||||
for id in `jq -r '.[]|.u' < search.json`; do
|
||||
jq -r '" <card>
|
||||
<name>"+.name+"</name>
|
||||
<text>"+.effect_raw+"</text>
|
||||
<prop>"+if .power==null and (.life//.durability)==null then "" else "
|
||||
<pt>"+(.power//""|tostring)+"/"+((.life//.durability//"")|tostring)+"</pt>" end+"
|
||||
<type>"+({"null":"","false":"Slow ","true":"Fast "}[.speed|tostring])+(.types|join(" "))+" - "+(.subtypes|join(" "))+"</type>
|
||||
<maintype>"+.types[0]+"</maintype>
|
||||
<cmc>"+((.cost_reserve//.cost_memory)|tostring)+"</cmc>
|
||||
<manacost>"+((.cost_reserve//.cost_memory)|tostring)+"</manacost>"+if .elements==["NORM"] then "" else "
|
||||
<colors>"+(.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(""))+"</colors>
|
||||
<coloridentity>"+(.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(""))+"</coloridentity>" end+"
|
||||
</prop>
|
||||
"+(.editions|map("<set rarity=\""+["common","uncommon","rare","mythic","special","bonus","mythic","mythic","mythic"][.rarity-1]+"\">"+.set.prefix+"</set>")|join("
|
||||
"))+"
|
||||
<tablerow>"+if (.cost_memory != null) then "1" else "2" end+"</tablerow>
|
||||
</card>"' < $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 '<set>
|
||||
<name>'"$pfx"'</name>
|
||||
<longname>'"$name"'</longname>
|
||||
<settype>Grand Archive</settype>
|
||||
<releasedate>'"`date -d $date -I`"'</releasedate>
|
||||
</set>' >> sets.xml
|
||||
done < sets.csv
|
||||
|
||||
echo '</cards>
|
||||
</cockatrice_carddatabase>' >> cards.xml
|
||||
|
||||
cat head.xml sets.xml cards.xml > 05.ga.xml
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user