retroarch: Download covers from libretro
This commit is contained in:
parent
ce81ba63b3
commit
0b6cedb658
|
@ -12,7 +12,7 @@ Use the appropriate ID with the `-provider` flag. [See examples below](#Usage)
|
|||
| Minecraft | `minecraft` | Linux, Linux Flatpak, macOS, Windows | No |
|
||||
| Nintendo Switch | `nintendo-switch` | Requires `-input-path` | No |
|
||||
| PlayStation 4 | `playstation-4` | Requires `-input-path` | No |
|
||||
| RetroArch | `retroarch` | Requires `-input-path` | No |
|
||||
| RetroArch | `retroarch` | Requires `-input-path` | Yes |
|
||||
|
||||
## How it works
|
||||
|
||||
|
|
|
@ -154,11 +154,24 @@ func GetGames(inputPath string, downloadCovers bool) []games.Game {
|
|||
|
||||
for playlistName := range playlists {
|
||||
for _, item := range playlists[playlistName].Items {
|
||||
var cover games.Screenshot
|
||||
|
||||
if downloadCovers {
|
||||
coverURL := formatLibretroBoxartURL(playlistName, item.Label)
|
||||
boxartPath, err := helpers.DownloadURLIntoTempFile(coverURL)
|
||||
if err == nil {
|
||||
cover = games.Screenshot{Path: boxartPath, DestinationName: ".cover"}
|
||||
} else {
|
||||
log.Printf("[error] Error downloading cover for %s: %s", item.Label, err)
|
||||
}
|
||||
}
|
||||
|
||||
userGames = append(userGames, games.Game{
|
||||
Platform: cleanPlatformName(playlistName),
|
||||
Name: cleanGameName(item.Label),
|
||||
Provider: providerName,
|
||||
Screenshots: findScreenshotsForGame(item),
|
||||
Cover: cover,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue