ksh script to download and generate map icons for some maps

moved from edshot99/ulx repository
This commit is contained in:
edshot99 2024-11-29 01:42:30 -06:00
parent d68368f33f
commit ae3e36fdac
2 changed files with 55 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
map_resource_fixes/maps/
map_resource_fixes/tmp/

View File

@ -0,0 +1,52 @@
#!/bin/ksh
# generate_map_thumbnails
# by edshot99 2024
STEAM_API_URL="https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/"
mkdir -p maps/thumb
mkdir -p tmp
for map in \
gm_aknevo#487999127 \
gm_aknevo_xmas#571682168 \
gm_atomic#105984257 \
gm_baik_town#537810494 \
gm_bay#104484764 \
gm_bigcity#105982362 \
gm_blackmesa_sigma#104483047 \
gm_blackmesasigma_night#104482189 \
gm_bluehills_test3#243902601 \
gm_buttes#105985587 \
gm_buttes_night#105985987 \
gm_coolsnow#200098715 \
gm_cyclopean#175516237 \
gm_ddocean#144683665 \
gm_desert#1521235996 \
gm_excess_island#115250988 \
gm_flatbuild_pbs_2015_dev#432484761 \
gm_flatsnow_bj#1602003520 \
gm_functional_flatgrass#298072218 \
gm_krzysiuhouse#2758738890 \
gm_reactionsew#112108040 \
gm_redrock#350869194 \
gm_shirus#2725259476 \
gm_templebeta#2533339955 \
gm_thevoid#1940231148 \
gm_warmap_v5#105630061 \
gm_warmap_v5_snow#105960495 \
rp_cscdesert_v2-1#110345906 \
rp_salvation_2_stalker_snow#132901080 \
rp_salvation_night_redemption#133030882 \
; 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}" "maps/thumb/$(echo ${map} | sed 's^tmp/^^g' | sed 's^\.jpg^^g').png"; done