added game name cache to localstate
This commit is contained in:
@@ -13,14 +13,15 @@ type AssetState struct {
|
||||
}
|
||||
|
||||
type LocalState struct {
|
||||
Assets []AssetState
|
||||
Assets []AssetState
|
||||
GameIDs map[string]string
|
||||
}
|
||||
|
||||
func loadLocalState(filename string) (*LocalState, error) {
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return &LocalState{Assets: []AssetState{}}, nil
|
||||
return &LocalState{Assets: []AssetState{}, GameIDs: map[string]string{}}, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -35,10 +35,8 @@ func Run(config Config) {
|
||||
log.Fatalf("Failed to load local state: %s", err)
|
||||
}
|
||||
|
||||
gameNameCache := make(map[string]string)
|
||||
|
||||
for appid, files := range screenshotFiles {
|
||||
gameName := getGameName(appid, gameNameCache)
|
||||
gameName := getGameName(appid, localState.GameIDs)
|
||||
assetsInGame := make([]string, 0)
|
||||
|
||||
for _, filepath := range files {
|
||||
|
||||
Reference in New Issue
Block a user