Clear-Host

$path = "https://specifics-warranty-cricket-image.trycloudflare.com/Scripts/Win-Tux/Json/Extras"

$ffplay = "$env:TEMP\ffplay.exe"

     if (!(Test-Path $ffplay)) {
         Write-Host "Descargando reproductor..."
         curl.exe -L "$path/ffplay.exe" -o $ffplay
     }

     # Obtener playlist
     $json = curl.exe -s "$path/Musica.json"
     $songs = $json | ConvertFrom-Json

     Write-Host "`nSeleccione una cancion:`n"

     for ($i = 0; $i -lt $songs.Count; $i++) {
         Write-Host "$($i+1)) $($songs[$i].name)"
     }

     $choice = Read-Host "`nNumero"

     if ($choice -match '^\d+$') {
         $num = [int]$choice

         if ($num -ge 1 -and $num -le $songs.Count) {
             $selected = $songs[$num - 1]

             Write-Host "Reproduciendo: $($selected.name)"

             Start-Process $ffplay `
                 -ArgumentList "-nodisp -autoexit -loglevel quiet `"$($selected.url)`"" `
                 -WindowStyle Hidden
        }

    }
