From ef480d1bd297f023fe98626539d64009d5b3a4b4 Mon Sep 17 00:00:00 2001 From: yosh Date: Sat, 16 Mar 2024 13:27:39 -0400 Subject: [PATCH] resonite-photoexif: fix and use aria2c :D --- resonite-photoexif | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resonite-photoexif b/resonite-photoexif index 43b709e..8af0aa3 100755 --- a/resonite-photoexif +++ b/resonite-photoexif @@ -28,18 +28,17 @@ for resrec; do curl -s "$asseturi" | tail -c +10 | brotli -d | bson2json > "$tmp_json" while read -r argline; do - echo "$argline" eval "set -- $argline" outfile="$outdir/$timestamp.webp" imguri=$1 echo "downloading image $timestamp.webp" - curl -s -o "$tmpfile" "$imguri" + aria2c -q -d / --allow-overwrite=true --auto-file-renaming=false -o "$tmpfile" "$imguri" if [ $# -gt 1 ]; then meta_place=$2 meta_host=$3 meta_photographer=$4 meta_time=$(date -u -d "@$5" +'%Y:%m:%d %H:%M:%S') - shift 4 + shift 5 meta_presentusers=$(sed 's/ /, /g' <<-EOF $* EOF @@ -79,7 +78,14 @@ Present Users: $meta_presentusers" "$tmpfile" \ select(.Type=="FrooxEngine.PhotoMetadata").Data.TimeTaken.Data/1000, select(.Type=="FrooxEngine.PhotoMetadata").Data.UserInfos.Data[].User._userId.Data ] - | select(. != []) | @sh' < "$tmp_json") + | select(. != []) | @sh' < "$tmp_json" \ + || jq -r '.Object.Children | .. | objects | .Components.Data | select(. != null) + | [ .[] + | ( select(.Type=="FrooxEngine.StaticTexture2D").Data.URL.Data + | sub("@(resdb:///(?[^.]+))?.*";"https://assets.resonite.com/\(.x)") + ) + ] + | select(. != []) | @sh' < "$tmp_json") EOF done