Added get_steam_names.sh
This commit is contained in:
20
get_steam_names.sh
Executable file
20
get_steam_names.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test ! -f appids.json && wget https://github.com/jsnli/steamappidlist/raw/refs/heads/master/data/games_appid.json -O appids.json
|
||||||
|
|
||||||
|
for dir_name in */; do
|
||||||
|
dir_name=${dir_name%*/}
|
||||||
|
dir_size=$(du -0 -h --max-depth=0 "$dir_name" | sed 's/\t.*//')
|
||||||
|
name_cache=$(jq -r "select(.appid == $dir_name) | .name" appids_cache.json | uniq)
|
||||||
|
if [ -n "$name_cache" ]; then
|
||||||
|
printf '==> %s\t%s\t\t%s\n' "$dir_size" "$dir_name" "$name_cache"
|
||||||
|
else
|
||||||
|
name=$(jq -r ".[] | select(.appid == $dir_name) | .name" appids.json | uniq)
|
||||||
|
if [ -n "$name" ]; then
|
||||||
|
echo "{ \"appid\": $dir_name, \"name\": \"$name\" }" >> appids_cache.json
|
||||||
|
printf '==> %s\t%s\t\t%s\n' "$dir_size" "$dir_name" "$name"
|
||||||
|
else
|
||||||
|
printf '[!] %s\t%s\t\t\033[1mMissing game name\033[0m\n' "$dir_size" "$dir_name"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user