ProtonDB dalla shell Updated!

Ho aggiornato lo script su osservazione di un amico che mi ha indicato e chiesto come mai non avessi utilizzato "JQ" per l'analisi dei risultati, la risposta semplice, perchΓ© non conoscevo affatto questo strumento!

Ho così aggiornato lo script con l'utilizzo di JQ e implementato i loghi "PROTN DB" casuali se avete figlet installato, vi lascio di seguito il codice dello script aggiornato

  1#!/bin/bash
  2
  3# ProtonDB Shell Query Tool - Versione 2.0
  4# Cerca giochi su ProtonDB e mostra risultati
  5# by b3lz3bu - rymstudio 2025
  6# necessitΓ  di "chafa" per il rendering delle immagini e "jq" per parsing JSON
  7
  8set -euo pipefail
  9
 10# Colori
 11RED='\033[0;31m'
 12GREEN='\033[0;32m'
 13YELLOW='\033[1;33m'
 14BLUE='\033[0;34m'
 15MAGENTA='\033[0;35m'
 16CYAN='\033[0;36m'
 17WHITE='\033[1;37m'
 18GRAY='\033[0;90m'
 19BOLD='\033[1m'
 20RESET='\033[0m'
 21
 22# URL per ASCII art casuali (puoi modificare questo URL)
 23ASCII_ART_URL="https://raw.githubusercontent.com/xero/figlet-fonts/master/3d.flf"
 24
 25# Funzione per controllare dipendenze
 26check_dependencies() {
 27    local missing_deps=()
 28    local optional_deps=()
 29    
 30    # Dipendenze essenziali
 31    if ! command -v python3 &> /dev/null; then
 32        missing_deps+=("python3")
 33    fi
 34    
 35    if ! command -v curl &> /dev/null; then
 36        missing_deps+=("curl")
 37    fi
 38    
 39    if ! command -v jq &> /dev/null; then
 40        missing_deps+=("jq")
 41    fi
 42    
 43    # Dipendenze opzionali per immagini
 44    if ! command -v chafa &> /dev/null && \
 45       ! command -v catimg &> /dev/null && \
 46       ! command -v img2txt &> /dev/null; then
 47        optional_deps+=("chafa (o catimg/img2txt)")
 48    fi
 49    
 50    # Se mancano dipendenze essenziali, mostra errore e istruzioni
 51    if [ ${#missing_deps[@]} -gt 0 ]; then
 52        echo -e "${RED}${BOLD}⚠ ERRORE: Dipendenze mancanti!${RESET}\n"
 53        echo -e "${YELLOW}Pacchetti richiesti non trovati:${RESET}"
 54        for dep in "${missing_deps[@]}"; do
 55            echo -e "  ${RED}βœ—${RESET} $dep"
 56        done
 57        echo ""
 58        echo -e "${CYAN}${BOLD}Come installarli:${RESET}"
 59        echo -e "${GRAY}# Debian/Ubuntu/Linux Mint:${RESET}"
 60        echo -e "  sudo apt install ${missing_deps[*]}"
 61        echo ""
 62        echo -e "${GRAY}# Arch Linux:${RESET}"
 63        echo -e "  sudo pacman -S ${missing_deps[*]}"
 64        echo ""
 65        echo -e "${GRAY}# Fedora:${RESET}"
 66        echo -e "  sudo dnf install ${missing_deps[*]}"
 67        echo ""
 68        exit 1
 69    fi
 70    
 71    # Suggerisci dipendenze opzionali
 72    if [ ${#optional_deps[@]} -gt 0 ]; then
 73        echo -e "${YELLOW}πŸ’‘ Suggerimento: Per visualizzare le immagini nella shell, installa:${RESET}"
 74        for dep in "${optional_deps[@]}"; do
 75            echo -e "  ${GRAY}β–Έ${RESET} $dep"
 76        done
 77        echo -e "${GRAY}  Debian/Ubuntu: sudo apt install chafa${RESET}"
 78        echo -e "${GRAY}  Arch Linux: sudo pacman -S chafa${RESET}\n"
 79    fi
 80}
 81
 82# Funzione per mostrare banner con figlet casuale
 83show_ascii_banner() {
 84    # Se figlet Γ¨ disponibile, usa un font casuale
 85    if command -v figlet &> /dev/null; then
 86        # Array di font figlet (presenti di default)
 87        local fonts=(
 88            "standard"
 89            "slant"
 90            "banner"
 91            "big"
 92            "block"
 93            "bubble"
 94            "digital"
 95            "ivrit"
 96            "lean"
 97            "mini"
 98            "script"
 99            "shadow"
100            "small"
101            "smscript"
102            "smshadow"
103            "smslant"
104            "speed"
105            "starwars"
106            "stop"
107            "3-d"
108            "3x5"
109            "5lineoblique"
110            "banner3"
111            "doh"
112            "doom"
113            "epic"
114            "isometric1"
115            "letters"
116            "alligator"
117            "dotmatrix"
118            "bulbhead"
119            "colossal"
120        )
121        
122        # Seleziona un font casuale
123        local random_index=$((RANDOM % ${#fonts[@]}))
124        local selected_font="${fonts[$random_index]}"
125        
126        echo -e "${CYAN}${BOLD}"
127        # Prova a usare il font selezionato, se non esiste usa standard
128        if figlet -f "$selected_font" "PROTONDB" 2>/dev/null; then
129            echo -e "${GRAY}[Font: $selected_font]${RESET}"
130        else
131            figlet "PROTONDB" 2>/dev/null
132        fi
133        echo -e "${MAGENTA}Query Tool v2.0 - by rymstudio 2025${RESET}"
134        echo -e "${RESET}"
135    else
136        # Fallback su ASCII art predefinita
137        show_default_banner
138    fi
139}
140
141# Banner predefinito se figlet non Γ¨ disponibile
142show_default_banner() {
143    echo -e "${CYAN}${BOLD}"
144    cat << "EOF"
145╔═══════════════════════════════════════════════════════════════════╗
146β•‘                                                                   β•‘
147β•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—         β•‘
148β•‘   β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘         β•‘
149β•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘         β•‘
150β•‘   β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘         β•‘
151β•‘   β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•   β–ˆβ–ˆβ•‘   β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘         β•‘
152β•‘   β•šβ•β•     β•šβ•β•  β•šβ•β• β•šβ•β•β•β•β•β•    β•šβ•β•    β•šβ•β•β•β•β•β• β•šβ•β•  β•šβ•β•β•β•         β•‘
153β•‘                                                                   β•‘
154β•‘                    PROTONDB QUERY TOOL - RYMSTUDIO 2025           β•‘
155β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
156EOF
157    echo -e "${RESET}"
158}
159
160# Funzione per mostrare un badge colorato per il tier
161show_tier_badge() {
162    local tier="$1"
163    case "${tier,,}" in
164        "platinum"|"platino")
165            echo -e "${WHITE}${BOLD}[βœ“ PLATINUM]${RESET}"
166            ;;
167        "gold"|"oro")
168            echo -e "${YELLOW}${BOLD}[β˜… GOLD]${RESET}"
169            ;;
170        "silver"|"argento")
171            echo -e "${GRAY}${BOLD}[β—† SILVER]${RESET}"
172            ;;
173        "bronze"|"bronzo")
174            echo -e "${RED}${BOLD}[● BRONZE]${RESET}"
175            ;;
176        "borked"|"rotto")
177            echo -e "${RED}${BOLD}[βœ— BORKED]${RESET}"
178            ;;
179        "native"|"nativo")
180            echo -e "${GREEN}${BOLD}[β–Ά NATIVE]${RESET}"
181            ;;
182        "pending")
183            echo -e "${BLUE}${BOLD}[β§— PENDING]${RESET}"
184            ;;
185        *)
186            echo -e "${GRAY}[? SCONOSCIUTO]${RESET}"
187            ;;
188    esac
189}
190
191# Funzione per mostrare immagine nella shell
192show_image() {
193    local url="$1"
194    local tmp_img="/tmp/protondb_img_$$.jpg"
195    
196    if curl -s -f -o "$tmp_img" "$url" 2>/dev/null; then
197        if command -v chafa &> /dev/null; then
198            chafa -s 70x22 "$tmp_img" 2>/dev/null
199        elif command -v catimg &> /dev/null; then
200            catimg -w 70 "$tmp_img" 2>/dev/null
201        elif command -v img2txt &> /dev/null; then
202            img2txt -W 70 -H 22 "$tmp_img" 2>/dev/null
203        fi
204        rm -f "$tmp_img"
205    fi
206}
207
208# Funzione per ottenere info da ProtonDB usando jq
209get_protondb_info() {
210    local steam_id="$1"
211    
212    # Usa l'API interna di ProtonDB
213    local protondb_summary="https://www.protondb.com/api/v1/reports/summaries/${steam_id}.json"
214    
215    # Usa jq per estrarre il tier
216    local tier=$(curl -s "$protondb_summary" 2>/dev/null | jq -r '.tier // .trendingTier // empty' 2>/dev/null | tr '[:upper:]' '[:lower:]')
217    
218    # Se jq non restituisce nulla, prova con scraping
219    if [ -z "$tier" ]; then
220        local html=$(curl -s -A "Mozilla/5.0" "https://www.protondb.com/app/${steam_id}" 2>/dev/null)
221        tier=$(echo "$html" | grep -oP 'tier"?:\s*"?\K[a-zA-Z]+' | head -1 | tr '[:upper:]' '[:lower:]')
222    fi
223    
224    echo "$tier"
225}
226
227# Funzione per cercare giochi su Steam usando jq
228search_steam_games() {
229    local query="$1"
230    local encoded=$(echo "$query" | sed 's/ /+/g')
231    
232    # Cerca su Steam
233    local steam_search="https://store.steampowered.com/api/storesearch/?term=${encoded}&l=italian&cc=IT"
234    local json=$(curl -s "$steam_search")
235    
236    # Usa jq per estrarre i risultati (fino a 5)
237    echo "$json" | jq -r '.items[:5] | .[] | "\(.id)|\(.name)|\(.tiny_image // "")"' 2>/dev/null
238}
239
240# Funzione per mostrare un risultato
241show_result() {
242    local title="$1"
243    local tier="$2"
244    local image_url="$3"
245    local steam_id="$4"
246    local is_primary="$5"
247    
248    if [ "$is_primary" = "true" ]; then
249        echo -e "${MAGENTA}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
250        echo -e "${MAGENTA}${BOLD}${RESET} ${CYAN}${BOLD}RISULTATO PRINCIPALE${RESET}                                              ${MAGENTA}${BOLD}${RESET}"
251        echo -e "${MAGENTA}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}\n"
252        
253        # Mostra l'immagine
254        if [ -n "$image_url" ]; then
255            show_image "$image_url"
256            echo ""
257        fi
258        
259        echo -e "${WHITE}${BOLD}${title}${RESET}"
260        echo -e "Steam ID: ${CYAN}${steam_id}${RESET}"
261        
262        if [ -n "$tier" ] && [ "$tier" != "null" ]; then
263            echo -e "CompatibilitΓ  ProtonDB: $(show_tier_badge "$tier")"
264        else
265            echo -e "CompatibilitΓ  ProtonDB: ${GRAY}Nessun dato disponibile${RESET}"
266        fi
267        
268        echo -e "\n${BLUE}πŸ”— ProtonDB: ${RESET}https://www.protondb.com/app/${steam_id}"
269        echo -e "${BLUE}πŸ”— Steam: ${RESET}https://store.steampowered.com/app/${steam_id}"
270        echo -e "\n${GRAY}────────────────────────────────────────────────────────────────────${RESET}\n"
271    else
272        echo -e "${BLUE}β–Έ ${WHITE}${title}${RESET} ${GRAY}(Steam ID: ${steam_id})${RESET}"
273        
274        if [ -n "$tier" ] && [ "$tier" != "null" ]; then
275            echo -e "  $(show_tier_badge "$tier")"
276        else
277            echo -e "  ${GRAY}Nessun dato ProtonDB${RESET}"
278        fi
279        echo ""
280    fi
281}
282
283# Main
284if [ $# -eq 0 ]; then
285    echo -e "${RED}Uso: $0 <nome gioco>${RESET}"
286    echo -e "${GRAY}Esempio: $0 \"Diablo IV\"${RESET}"
287    echo -e "${GRAY}         $0 diablo${RESET}"
288    exit 1
289fi
290
291# Controlla dipendenze prima di iniziare
292check_dependencies
293
294query="$*"
295
296# Mostra banner (con ASCII art casuale se figlet Γ¨ disponibile)
297show_ascii_banner
298
299echo -e "\n${CYAN}${BOLD}πŸ” Cercando '${query}' su Steam...${RESET}\n"
300
301# Cerca i giochi su Steam
302results=$(search_steam_games "$query")
303
304if [ -z "$results" ]; then
305    echo -e "${RED}Nessun risultato trovato per '${query}'${RESET}"
306    echo -e "${GRAY}Prova con un nome diverso o piΓΉ specifico${RESET}\n"
307    exit 1
308fi
309
310echo -e "${WHITE}${BOLD}═══════════════════════════════════════════════════════════════════${RESET}"
311echo -e "${GREEN}${BOLD}  RISULTATI TROVATI${RESET}"
312echo -e "${WHITE}${BOLD}═══════════════════════════════════════════════════════════════════${RESET}\n"
313
314# Processa i risultati
315count=0
316while IFS='|' read -r steam_id name image_url; do
317    count=$((count + 1))
318    
319    # Per il primo risultato, cerca anche su ProtonDB
320    if [ $count -eq 1 ]; then
321        echo -e "${GRAY}πŸ“Š Recuperando dati da ProtonDB...${RESET}"
322        tier=$(get_protondb_info "$steam_id")
323        
324        # Se l'immagine Γ¨ piccola, prendi quella grande
325        if [[ "$image_url" == *"capsule_sm"* ]]; then
326            image_url="https://cdn.akamai.steamstatic.com/steam/apps/${steam_id}/header.jpg"
327        fi
328        
329        show_result "$name" "$tier" "$image_url" "$steam_id" "true"
330    else
331        # Altri risultati mostrati in modo compatto
332        tier=$(get_protondb_info "$steam_id")
333        show_result "$name" "$tier" "" "$steam_id" "false"
334    fi
335    
336    # Limita a 5 risultati
337    if [ $count -ge 5 ]; then
338        break
339    fi
340done <<< "$results"
341
342echo -e "${WHITE}${BOLD}═══════════════════════════════════════════════════════════════════${RESET}"
343echo -e "${GREEN}Vuoi vedere piΓΉ dettagli? Visita: ${CYAN}https://www.protondb.com${RESET}\n"

tutti conosciamo il famoso sito protonDB dal quale Γ¨ possibile, inserendo il nome di un gioco o il suo Stem ID, verificare la compatibilitΓ  dello stesso sul layer di compatibilitΓ  di Valve Proton.

Mi sono chiesto se fosse possibile interrogare il database di protonDB al di fuori del sito, ovviamente si Γ¨ possibile farllo, e mi sono chiesto quanto sarebbe stato "figo" farlo direttamente dal terminale utilizzando uno script apposito.

Con un po' di aiuto e numerosissime bestemmie sono riuscito a tirar via uno script per farlo, se siete interessanti ad utilizzarlo vi lascio di seguito il codice, molte cose potrebbero essere piΓΉ rifinite, soprattutto il metodo di come ho inserito una grossa scritta PROTON nel codice.

per utilizzare la funzione di rendering dell'immgaine nel terminale dovrete installare uno strumento apposito, io vi consiglio chafa che potete installare facilmente con

1#per sistemi debian
2sudo apt install chafa
3
4#per sistemi Arch
5sudo pacman -S chafa

di seguito il codice dello script:

  1#!/bin/bash
  2
  3# ProtonDB Shell Query Tool - Versione con scrap 1.0
  4# Cerca giochi su ProtonDB e mostra risultati
  5# by b3lz3bu - rymstudio 2025 - https://www.rymstudio.it
  6# necessitΓ  di "chafa" per il rendering delle immagini
  7
  8set -euo pipefail
  9
 10# Colori
 11RED='\033[0;31m'
 12GREEN='\033[0;32m'
 13YELLOW='\033[1;33m'
 14BLUE='\033[0;34m'
 15MAGENTA='\033[0;35m'
 16CYAN='\033[0;36m'
 17WHITE='\033[1;37m'
 18GRAY='\033[0;90m'
 19BOLD='\033[1m'
 20RESET='\033[0m'
 21
 22# Funzione per mostrare un badge colorato per il tier
 23show_tier_badge() {
 24    local tier="$1"
 25    case "${tier,,}" in
 26        "platinum"|"platino")
 27            echo -e "${WHITE}${BOLD}[βœ“ PLATINUM]${RESET}"
 28            ;;
 29        "gold"|"oro")
 30            echo -e "${YELLOW}${BOLD}[β˜… GOLD]${RESET}"
 31            ;;
 32        "silver"|"argento")
 33            echo -e "${GRAY}${BOLD}[β—† SILVER]${RESET}"
 34            ;;
 35        "bronze"|"bronzo")
 36            echo -e "${RED}${BOLD}[● BRONZE]${RESET}"
 37            ;;
 38        "borked"|"rotto")
 39            echo -e "${RED}${BOLD}[βœ— BORKED]${RESET}"
 40            ;;
 41        "native"|"nativo")
 42            echo -e "${GREEN}${BOLD}[β–Ά NATIVE]${RESET}"
 43            ;;
 44        "pending")
 45            echo -e "${BLUE}${BOLD}[β§— PENDING]${RESET}"
 46            ;;
 47        *)
 48            echo -e "${GRAY}[? SCONOSCIUTO]${RESET}"
 49            ;;
 50    esac
 51}
 52
 53# Funzione per mostrare immagine nella shell
 54show_image() {
 55    local url="$1"
 56    local tmp_img="/tmp/protondb_img_$$.jpg"
 57    
 58    if curl -s -f -o "$tmp_img" "$url" 2>/dev/null; then
 59        if command -v chafa &> /dev/null; then
 60            chafa -s 70x22 "$tmp_img" 2>/dev/null
 61        elif command -v catimg &> /dev/null; then
 62            catimg -w 70 "$tmp_img" 2>/dev/null
 63        elif command -v img2txt &> /dev/null; then
 64            img2txt -W 70 -H 22 "$tmp_img" 2>/dev/null
 65        fi
 66        rm -f "$tmp_img"
 67    fi
 68}
 69
 70# Funzione per ottenere l'ID Steam di un gioco da SteamDB
 71get_steam_id() {
 72    local query="$1"
 73    local encoded=$(echo "$query" | sed 's/ /+/g')
 74    
 75    # Cerca su Steam tramite la loro API di ricerca
 76    local steam_search="https://store.steampowered.com/api/storesearch/?term=${encoded}&l=italian&cc=IT"
 77    local result=$(curl -s "$steam_search" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
 78    
 79    echo "$result"
 80}
 81
 82# Funzione per ottenere info da ProtonDB
 83get_protondb_info() {
 84    local steam_id="$1"
 85    
 86    # Usa l'API interna di ProtonDB (non ufficiale ma funzionante)
 87    local api_url="https://www.protondb.com/proxy/steam/api/appdetails?appids=${steam_id}"
 88    local protondb_summary="https://www.protondb.com/api/v1/reports/summaries/${steam_id}.json"
 89    
 90    # Prova prima con l'API summary
 91    local tier=$(curl -s "$protondb_summary" 2>/dev/null | python3 -c "
 92import sys, json
 93try:
 94    data = json.load(sys.stdin)
 95    tier = data.get('tier', data.get('trendingTier', ''))
 96    print(tier.lower() if tier else '')
 97except:
 98    pass
 99" 2>/dev/null)
100    
101    # Se non funziona, prova con scraping della pagina
102    if [ -z "$tier" ]; then
103        local html=$(curl -s -A "Mozilla/5.0" "https://www.protondb.com/app/${steam_id}" 2>/dev/null)
104        # Cerca pattern come "tier-gold", "tier-platinum", etc.
105        tier=$(echo "$html" | grep -oP 'tier"?:\s*"?\K[a-zA-Z]+' | head -1 | tr '[:upper:]' '[:lower:]')
106        
107        # Altro tentativo: cerca nelle classi CSS
108        if [ -z "$tier" ]; then
109            tier=$(echo "$html" | grep -oP 'class="[^"]*tier-\K[a-z]+' | head -1)
110        fi
111    fi
112    
113    echo "$tier"
114}
115
116# Funzione per cercare giochi su Steam
117search_steam_games() {
118    local query="$1"
119    local encoded=$(echo "$query" | sed 's/ /+/g')
120    
121    # Cerca su Steam
122    local steam_search="https://store.steampowered.com/api/storesearch/?term=${encoded}&l=italian&cc=IT"
123    local json=$(curl -s "$steam_search")
124    
125    # Estrai i risultati (fino a 5)
126    echo "$json" | python3 -c "
127import sys, json
128try:
129    data = json.load(sys.stdin)
130    items = data.get('items', [])[:5]
131    for item in items:
132        print(f\"{item['id']}|{item['name']}|{item.get('tiny_image', '')}\")
133except:
134    pass
135" 2>/dev/null
136}
137
138# Funzione per mostrare un risultato
139show_result() {
140    local title="$1"
141    local tier="$2"
142    local image_url="$3"
143    local steam_id="$4"
144    local is_primary="$5"
145    
146    if [ "$is_primary" = "true" ]; then
147        echo -e "${MAGENTA}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
148        echo -e "${MAGENTA}${BOLD}${RESET} ${CYAN}${BOLD}RISULTATO PRINCIPALE${RESET}                                              ${MAGENTA}${BOLD}${RESET}"
149        echo -e "${MAGENTA}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}\n"
150        
151        # Mostra l'immagine
152        if [ -n "$image_url" ]; then
153            show_image "$image_url"
154            echo ""
155        fi
156        
157        echo -e "${WHITE}${BOLD}${title}${RESET}"
158        echo -e "Steam ID: ${CYAN}${steam_id}${RESET}"
159        
160        if [ -n "$tier" ] && [ "$tier" != "null" ]; then
161            echo -e "CompatibilitΓ  ProtonDB: $(show_tier_badge "$tier")"
162        else
163            echo -e "CompatibilitΓ  ProtonDB: ${GRAY}Nessun dato disponibile${RESET}"
164        fi
165        
166        echo -e "\n${BLUE}πŸ”— ProtonDB: ${RESET}https://www.protondb.com/app/${steam_id}"
167        echo -e "${BLUE}πŸ”— Steam: ${RESET}https://store.steampowered.com/app/${steam_id}"
168        echo -e "\n${GRAY}────────────────────────────────────────────────────────────────────${RESET}\n"
169    else
170        echo -e "${BLUE}β–Έ ${WHITE}${title}${RESET} ${GRAY}(Steam ID: ${steam_id})${RESET}"
171        
172        if [ -n "$tier" ] && [ "$tier" != "null" ]; then
173            echo -e "  $(show_tier_badge "$tier")"
174        else
175            echo -e "  ${GRAY}Nessun dato ProtonDB${RESET}"
176        fi
177        echo ""
178    fi
179}
180
181# Main
182if [ $# -eq 0 ]; then
183    echo -e "${RED}Uso: $0 <nome gioco>${RESET}"
184    echo -e "${GRAY}Esempio: $0 \"Diablo IV\"${RESET}"
185    echo -e "${GRAY}         $0 diablo${RESET}"
186    exit 1
187fi
188
189# Controlla dipendenze
190if ! command -v python3 &> /dev/null; then
191    echo -e "${RED}Errore: python3 Γ¨ richiesto per il parsing JSON${RESET}"
192    exit 1
193fi
194
195query="$*"
196
197# Banner
198echo -e "${CYAN}${BOLD}"
199cat << "EOF"
200╔═══════════════════════════════════════════════════════════════════╗
201β•‘                                                                   β•‘
202β•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—           β•‘
203β•‘   β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘           β•‘
204β•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘           β•‘
205β•‘   β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘           β•‘
206β•‘   β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•   β–ˆβ–ˆβ•‘   β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘           β•‘
207β•‘   β•šβ•β•     β•šβ•β•  β•šβ•β• β•šβ•β•β•β•β•β•    β•šβ•β•    β•šβ•β•β•β•β•β• β•šβ•β•  β•šβ•β•β•β•           β•‘
208β•‘                                                                   β•‘
209β•‘                    PROTONDB QUERY TOOL - RYMSTUDIO 2025           β•‘
210β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
211EOF
212echo -e "${RESET}"
213
214echo -e "\n${CYAN}${BOLD}πŸ” Cercando '${query}' su Steam...${RESET}\n"
215
216# Cerca i giochi su Steam
217results=$(search_steam_games "$query")
218
219if [ -z "$results" ]; then
220    echo -e "${RED}Nessun risultato trovato per '${query}'${RESET}"
221    echo -e "${GRAY}Prova con un nome diverso o piΓΉ specifico${RESET}\n"
222    exit 1
223fi
224
225echo -e "${WHITE}${BOLD}═══════════════════════════════════════════════════════════════════${RESET}"
226echo -e "${GREEN}${BOLD}  RISULTATI TROVATI${RESET}"
227echo -e "${WHITE}${BOLD}═══════════════════════════════════════════════════════════════════${RESET}\n"
228
229# Processa i risultati
230count=0
231while IFS='|' read -r steam_id name image_url; do
232    count=$((count + 1))
233    
234    # Per il primo risultato, cerca anche su ProtonDB
235    if [ $count -eq 1 ]; then
236        echo -e "${GRAY}πŸ“Š Recuperando dati da ProtonDB...${RESET}"
237        tier=$(get_protondb_info "$steam_id")
238        
239        # Se l'immagine Γ¨ piccola, prendi quella grande
240        if [[ "$image_url" == *"capsule_sm"* ]]; then
241            image_url="https://cdn.akamai.steamstatic.com/steam/apps/${steam_id}/header.jpg"
242        fi
243        
244        show_result "$name" "$tier" "$image_url" "$steam_id" "true"
245    else
246        # Altri risultati mostrati in modo compatto
247        tier=$(get_protondb_info "$steam_id")
248        show_result "$name" "$tier" "" "$steam_id" "false"
249    fi
250    
251    # Limita a 5 risultati
252    if [ $count -ge 5 ]; then
253        break
254    fi
255done <<< "$results"
256
257echo -e "${WHITE}${BOLD}═══════════════════════════════════════════════════════════════════${RESET}"
258echo -e "${GREEN}Vuoi vedere piΓΉ dettagli? Visita: ${CYAN}https://www.protondb.com${RESET}\n"
259
260# Info su come migliorare la visualizzazione
261if ! command -v chafa &> /dev/null && ! command -v catimg &> /dev/null && ! command -v img2txt &> /dev/null; then
262    echo -e "${YELLOW}πŸ’‘ Suggerimento: Installa 'chafa' per vedere le immagini nella shell:${RESET}"
263    echo -e "${GRAY}   sudo apt install chafa    # Debian/Ubuntu${RESET}"
264    echo -e "${GRAY}   sudo pacman -S chafa      # Arch Linux${RESET}\n"
265fi

Salvatelo con il nome che volete, io ho utilizzato protondb.sh e rendetelo eseguibile:

1chmod +x prontondb.sh

Funziona in modo davvero semplice, basterΓ  digitare

1./protondb.sh <nome del gioco>

protonDB Ready Or Not