From baaada32d527c30da4c1c914d89eb25e1980a78a Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 3 Apr 2024 22:26:20 -0400 Subject: [PATCH] skindb - scrips - downloader cannot retrieve secuencial id, mke it own * the id returned by api are not secuencial, to avoid issues created our own secuencial id based on order of original id * started the id of scripts from 32 cos first ones are simpleskins --- misc/skinsdb_download_terrastudios.py | 7 ++++--- misc/skinsdb_download_terrastudios.sh | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/misc/skinsdb_download_terrastudios.py b/misc/skinsdb_download_terrastudios.py index 09c54d7..fbf75b9 100755 --- a/misc/skinsdb_download_terrastudios.py +++ b/misc/skinsdb_download_terrastudios.py @@ -29,12 +29,12 @@ if r.status_code != 200: data = r.json() count = 0 +id = 32 print("Writing skins, separator="+fsep+" started from id 1 but as id 32 cos first ones are from older&mixed simple_skins+skins-minetest") for json in data["skins"]: - id = json["id"] - id = int(id) + 32 + il = json["id"] id = str(id) # Texture file @@ -55,7 +55,8 @@ for json in data["skins"]: if ffil == "n": file.write("" + name + "\n" + author + "\n" + license + "\n") file.close() - print("Added #%s Name: %s Author: %s License: %s" % (id, name, author, license)) + print("Added #%s as %s Name: %s Author: %s License: %s" % (str(il), id, name, author, license)) + id = int(id) + 1 count += 1 print("Fetched " + str(count) + " skins!, started from id 1 but as id 32 cos first ones are from older&mixed simple_skins+skins-minetest") diff --git a/misc/skinsdb_download_terrastudios.sh b/misc/skinsdb_download_terrastudios.sh index f3f9c55..4d5bce2 100755 --- a/misc/skinsdb_download_terrastudios.sh +++ b/misc/skinsdb_download_terrastudios.sh @@ -48,6 +48,8 @@ echo "Downloading skins from $SITE ..." wget -O .rawdata.json "$SITE" +ILN=32 + for IL in $(jq '.skins[].id' .rawdata.json) do ID=$IL @@ -57,7 +59,7 @@ do IMG=`export ID=$IL && jq ".skins[] | select(.id == "$ID") | .img " .rawdata.json` DES="$NAM made by $AUT" COM="$LIC - $NAM made by $AUT" - echo "$IL : name $NAM, authot $AUT, description $DES, comment $COM, license $LIC" + echo "$IL : as $ILN name $NAM, authot $AUT, description $DES, comment $COM, license $LIC" if [ $FFL=="n" ] then NAM=${NAM//\"/} @@ -65,17 +67,18 @@ do LIC=${LIC//\"/} COM=${COM//\"/} IMG=${IMG//\"/} - echo $NAM > ../meta/character$SEP$IL.txt - echo $AUT >> ../meta/character$SEP$IL.txt - echo $LIC >> ../meta/character$SEP$IL.txt - echo $COM >> ../meta/character$SEP$IL.txt + echo $NAM > ../meta/character$SEP$ILN.txt + echo $AUT >> ../meta/character$SEP$ILN.txt + echo $LIC >> ../meta/character$SEP$ILN.txt + echo $COM >> ../meta/character$SEP$ILN.txt else - echo "name = $NAM" > ../meta/character$SEP$IL.txt - echo "author = $AUT" >> ../meta/character$SEP$IL.txt - echo "description = $DES" >> ../meta/character$SEP$IL.txt - echo "comment = $COM" >> ../meta/character$SEP.txt - echo "license = $LIC" >> ../meta/character$SEP$IL.txt + echo "name = $NAM" > ../meta/character$SEP$ILN.txt + echo "author = $AUT" >> ../meta/character$SEP$ILN.txt + echo "description = $DES" >> ../meta/character$SEP$ILN.txt + echo "comment = $COM" >> ../meta/character$SEP$ILN.txt + echo "license = $LIC" >> ../meta/character$SEP$ILN.txt fi - echo "$IL : writing $NAM skin png file" - echo $IMG | base64 --wrap=0 -d > ../textures/character$SEP$IL.png + echo "$ILN : writing $NAM skin png file" + echo $IMG | base64 --wrap=0 -d > ../textures/character$SEP$ILN.png + ILN=$(($ILN + 1)) done