if the image is not extracted copy the default image to the image path and return the path to the default image for checking the lastfm api
This commit is contained in:
parent
62bcda33cb
commit
1d9fe23b00
@ -65,24 +65,25 @@ func GetFlacImage(songPath, imagePath string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func extractImageFromFile(uri string, imagePath string) string {
|
func extractImageFromFile(uri string, imagePath string) string {
|
||||||
|
_i := imagePath
|
||||||
if strings.HasSuffix(uri, ".mp3") {
|
if strings.HasSuffix(uri, ".mp3") {
|
||||||
imagePath := GetMp3Image(uri, imagePath)
|
imagePath := GetMp3Image(uri, imagePath)
|
||||||
if imagePath == "" {
|
if imagePath == "" {
|
||||||
|
Copy(viper.GetString("DEFAULT_IMAGE_PATH"), _i)
|
||||||
return viper.GetString("DEFAULT_IMAGE_PATH")
|
return viper.GetString("DEFAULT_IMAGE_PATH")
|
||||||
} else {
|
|
||||||
return imagePath
|
|
||||||
}
|
}
|
||||||
} else if strings.HasSuffix(uri, ".flac") {
|
} else if strings.HasSuffix(uri, ".flac") {
|
||||||
imagePath := GetFlacImage(uri, imagePath)
|
imagePath := GetFlacImage(uri, imagePath)
|
||||||
if imagePath == "" {
|
if imagePath == "" {
|
||||||
|
Copy(viper.GetString("DEFAULT_IMAGE_PATH"), _i)
|
||||||
return viper.GetString("DEFAULT_IMAGE_PATH")
|
return viper.GetString("DEFAULT_IMAGE_PATH")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Copy(viper.GetString("DEFAULT_IMAGE_PATH"), _i)
|
||||||
|
return viper.GetString("DEFAULT_IMAGE_PATH")
|
||||||
|
}
|
||||||
return imagePath
|
return imagePath
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return viper.GetString("DEFAULT_IMAGE_PATH")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getImg(uri string) (image.Image, error) {
|
func getImg(uri string) (image.Image, error) {
|
||||||
f, err := os.Open(uri)
|
f, err := os.Open(uri)
|
||||||
|
Loading…
Reference in New Issue
Block a user