Skip to content

Commit

Permalink
Improve name matching
Browse files Browse the repository at this point in the history
fixes #70
  • Loading branch information
Lucki authored and boppreh committed Mar 1, 2021
1 parent 83b2572 commit 264ddd7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions download.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,18 @@ func getSteamGridDBImage(game *Game, artStyleExtensions []string, steamGridDBApi

SteamGridDBGameID := -1
if jsonSearchResponse.Success && len(jsonSearchResponse.Data) >= 1 {
// First match should be the best one
SteamGridDBGameID = jsonSearchResponse.Data[0].ID
// try to get exact match
for i := 0; i < len(jsonSearchResponse.Data); i++ {
if jsonSearchResponse.Data[i].Name == game.Name {
SteamGridDBGameID = jsonSearchResponse.Data[i].ID
break
}
}

// else guess first result
if SteamGridDBGameID == -1 {
SteamGridDBGameID = jsonSearchResponse.Data[0].ID
}
}

if SteamGridDBGameID == -1 {
Expand Down

0 comments on commit 264ddd7

Please sign in to comment.