Skip to content

Commit

Permalink
feat(generate_csv): fetch album mapping from remote instead of local …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
woodchen-ink committed Nov 16, 2024
1 parent eb7ddee commit f31ff5c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lankong_tools/generate_csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ func main() {
panic("API_TOKEN environment variable is required")
}

// 读取相册映射配置
mappingFile, err := os.ReadFile("lankong_tools/album_mapping.json")
// 从远程获取相册映射配置
resp, err := http.Get("https://github-file-2mq.pages.dev/random-api.czl.net/album_mapping.json")
if err != nil {
panic(fmt.Sprintf("Failed to read album mapping: %v", err))
panic(fmt.Sprintf("Failed to fetch album mapping: %v", err))
}
defer resp.Body.Close()

// 读取响应内容
mappingFile, err := io.ReadAll(resp.Body)
if err != nil {
panic(fmt.Sprintf("Failed to read album mapping response: %v", err))
}

var albumMapping AlbumMapping
Expand Down

0 comments on commit f31ff5c

Please sign in to comment.