From ff2cb2335c1aa1150c4e06f2b1b4f51a94ad3144 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Wed, 19 Nov 2025 21:35:49 +0100 Subject: [PATCH] added game name cache to localstate --- internal/localstate.go | 5 +++-- internal/steamimmich.go | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/localstate.go b/internal/localstate.go index 8090378..f8ce3f6 100644 --- a/internal/localstate.go +++ b/internal/localstate.go @@ -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 } diff --git a/internal/steamimmich.go b/internal/steamimmich.go index 284ada0..dc024d9 100644 --- a/internal/steamimmich.go +++ b/internal/steamimmich.go @@ -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 {