sanitize wallpaper filename by including topic in the format
This commit is contained in:
parent
5e1cb37c9b
commit
7b29eee1ff
@ -132,7 +132,9 @@ func downloadRandomWallpaper(wallpaperPath string, r *rand.Rand, topics []string
|
||||
// Select a random image from the results
|
||||
randomIndex := r.Intn(len(wallhavenResp.Data))
|
||||
wallpaperURL := wallhavenResp.Data[randomIndex].Path
|
||||
filename := filepath.Base(wallpaperURL)
|
||||
orig := filepath.Base(wallpaperURL)
|
||||
sanitizedTopic := strings.ReplaceAll(strings.ToLower(displayName), " ", "-")
|
||||
filename := fmt.Sprintf("%s-%s", sanitizedTopic, orig)
|
||||
filepath := filepath.Join(wallpaperPath, filename)
|
||||
|
||||
fmt.Fprintf(os.Stderr, "Downloading: %s\n", filename)
|
||||
|
Loading…
x
Reference in New Issue
Block a user