use http.Client for API key in immich
This commit is contained in:
@@ -26,6 +26,8 @@ func Run(config Config) {
|
||||
return
|
||||
}
|
||||
|
||||
immichClient := newImmichHttpClient(config.APIKey)
|
||||
|
||||
gameNameCache := make(map[string]string)
|
||||
|
||||
for appid, files := range screenshotFiles {
|
||||
@@ -33,7 +35,7 @@ func Run(config Config) {
|
||||
assetsInGame := make([]string, 0)
|
||||
|
||||
for _, filepath := range files {
|
||||
res, err := uploadToImmich(filepath, appid, config.BaseURL, config.APIKey, config.DeiveID)
|
||||
res, err := uploadToImmich(filepath, appid, config.BaseURL, config.DeiveID, &immichClient)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to upload to immich: %s", err)
|
||||
@@ -42,17 +44,19 @@ func Run(config Config) {
|
||||
|
||||
log.Printf("Assest uploaded: %s (%s) %s with ID: %s", gameName, appid, filepath, res.ID)
|
||||
|
||||
return
|
||||
|
||||
assetsInGame = append(assetsInGame, res.ID)
|
||||
}
|
||||
|
||||
err := setAssetMetadata(assetsInGame, fmt.Sprintf("Game: %s", gameName), config.BaseURL, config.APIKey)
|
||||
err := setAssetMetadata(assetsInGame, fmt.Sprintf("Game: %s", gameName), config.BaseURL, immichClient)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to set asset metadata: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
if config.Album != "" {
|
||||
err = addAssetsToAlbum(assetsInGame, config.Album, config.BaseURL, config.APIKey)
|
||||
err = addAssetsToAlbum(assetsInGame, config.Album, config.BaseURL, immichClient)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to add assets to album: %s", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user