summaryrefslogtreecommitdiff
path: root/updater
diff options
context:
space:
mode:
authorAlexander Weber <web.alexander@web.de>2017-04-10 14:56:07 +0200
committerAlexander Weber <web.alexander@web.de>2017-04-10 14:56:07 +0200
commit11c39cd149f0ebd5df599e2b7d8148d3306055ee (patch)
tree78949c8e441148ef2770835a1e6a2ecb15977636 /updater
parentd5df0d5e86633c21cafe0282cb81399acf4b186c (diff)
update_skins_db.sh: skip processing of already existing skins
Skip also the downloading of preview images for them Additional parameter "all" to process all
Diffstat (limited to 'updater')
-rwxr-xr-xupdater/update_skins_db.sh30
1 files changed, 16 insertions, 14 deletions
diff --git a/updater/update_skins_db.sh b/updater/update_skins_db.sh
index 2b03bf7..5bcdaa9 100755
--- a/updater/update_skins_db.sh
+++ b/updater/update_skins_db.sh
@@ -19,7 +19,6 @@ temp="$curpath"/tmp # Where the temp folder will be. Default is $PWD/tmp, whic
METADEST="$curpath"/../meta # This is the folder where the meta data will be saved
TEXTUREDEST="$curpath"/../textures # This is the folder where the skins and the previews will be saved
-
# === Make a bunch of folders and download the db ===
# ===================================================
if [ -d "$temp" ]; then
@@ -41,16 +40,18 @@ wget "$JSONURL" -O "$temp"/rawdb.txt # Download the entire database
# === Do the JSON thing ===
# =========================
i="0" # This will be the counter.
-while [ "$ID" != "null" ] # Repeat for as long as there is data to process
- do
- ID=$(cat "$temp"/rawdb.txt | jq ".skins[$i].id")
-
- # The next lines are kinda complex. sed is being used to strip the quotes from the variables. I had help...
- meta_name="$(jq ".skins[$i].name" < "$temp"/rawdb.txt | sed 's/^"//;s/"$//')"
- meta_author="$(jq ".skins[$i].author" <"$temp"/rawdb.txt | sed 's/^"//;s/"$//')"
- meta_license="$(jq ".skins[$i].license" <"$temp"/rawdb.txt | sed 's/^"//;s/"$//')"
+while true; do
+ ID=$(cat "$temp"/rawdb.txt | jq ".skins[$i].id")
+ if [ "$ID" == "null" ]; then
+ break
+ fi
+
+ if [ ! -f "$METADEST"/character_$ID.txt ] || [ "$1" == "all" ]; then
+ # The next lines are kinda complex. sed is being used to strip the quotes from the variables. I had help...
+ meta_name="$(jq ".skins[$i].name" < "$temp"/rawdb.txt | sed 's/^"//;s/"$//')"
+ meta_author="$(jq ".skins[$i].author" <"$temp"/rawdb.txt | sed 's/^"//;s/"$//')"
+ meta_license="$(jq ".skins[$i].license" <"$temp"/rawdb.txt | sed 's/^"//;s/"$//')"
- if [[ "$ID" != "null" ]]; then # Check to see if ID has a value
echo "# $ID name: $meta_name author: $meta_author license: $meta_license" # Verbosity to show that the script is working.
echo "$meta_name" > "$METADEST"/character_$ID.txt # Save the meta data to files, this line overwrites the data inside the file
@@ -66,10 +67,11 @@ while [ "$ID" != "null" ] # Repeat for as long as there is data to process
# === Download a preview image whilst we're at it ===
# ====================================================
wget -nv "$PREVIEWURL/$ID".png -O "$TEXTUREDEST"/character_"$ID"_preview.png # Downloads a preview of the skin that we just saved.
-
- fi
- i=$[$i+1] # Increase the counter by one.
- done
+ else
+ echo -n "."
+ fi
+ i=$[$i+1] # Increase the counter by one.
+done
# === Now we'll clean up the mess ===
# ===================================