ksh script to download and generate map icons for some maps

This commit is contained in:
edshot99 2024-03-25 03:13:41 -05:00
parent 5162e48a31
commit 76110bdbaa
2 changed files with 38 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.dropbox*
Icon*
desktop.ini
tmp

37
generate_map_thumbnails Executable file
View File

@ -0,0 +1,37 @@
#!/bin/ksh
# generate_map_thumbnails
# by edshot99 2024
STEAM_API_URL="https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/"
mkdir -p tmp/maps/thumb
for map in \
gm_aknevo#487999127 \
gm_aknevo_xmas#571682168 \
gm_atomic#105984257 \
gm_bigcity#105982362 \
gm_blackmesa_sigma#104483047 \
gm_blackmesasigma_night#104482189 \
gm_bluehills_test3#243902601 \
gm_buttes#105985587 \
gm_buttes_night#105985987 \
gm_cyclopean#175516237 \
gm_ddocean#144683665 \
gm_excess_island#115250988 \
gm_flatsnow_bj#1602003520 \
gm_functional_flatgrass#298072218 \
gm_templebeta#2533339955 \
gm_thevoid#1940231148 \
; do \
mapname=$(echo ${map} | sed 's^#.*^^g') && \
mapid=$(echo ${map} | sed 's^.*#^^g') && \
if [ ! -f tmp/${mapname}.jpg ]; then \
sleep 3 && \
curl -d "itemcount=1" -d "publishedfileids[0]=${mapid}" ${STEAM_API_URL} -o tmp/${mapname}.json && \
curl $(cat tmp/${mapname}.json | sed 's^.*preview_url":"^^g' | sed 's^/".*^/^g') -o tmp/${mapname}.jpg \
;fi \
; done
for map in tmp/*.jpg; do ffmpeg -loglevel error -n -i "${map}" "tmp/maps/thumb/$(echo ${map} | sed 's^tmp/^^g' | sed 's^\.jpg^^g').png"; done