retroarch: Download covers from libretro

This commit is contained in:
Felipe M 2021-01-14 23:07:50 +01:00
parent ce81ba63b3
commit 0b6cedb658
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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,
})
}
}