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
This commit is contained in:
parent
aa11686382
commit
baaada32d5
@ -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")
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user