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 {
 | 
			
		||||
	_i := imagePath
 | 
			
		||||
	if strings.HasSuffix(uri, ".mp3") {
 | 
			
		||||
		imagePath := GetMp3Image(uri, imagePath)
 | 
			
		||||
		if imagePath == "" {
 | 
			
		||||
			Copy(viper.GetString("DEFAULT_IMAGE_PATH"), _i)
 | 
			
		||||
			return viper.GetString("DEFAULT_IMAGE_PATH")
 | 
			
		||||
		} else {
 | 
			
		||||
			return imagePath
 | 
			
		||||
		}
 | 
			
		||||
	} else if strings.HasSuffix(uri, ".flac") {
 | 
			
		||||
		imagePath := GetFlacImage(uri, imagePath)
 | 
			
		||||
		if imagePath == "" {
 | 
			
		||||
			Copy(viper.GetString("DEFAULT_IMAGE_PATH"), _i)
 | 
			
		||||
			return viper.GetString("DEFAULT_IMAGE_PATH")
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		Copy(viper.GetString("DEFAULT_IMAGE_PATH"), _i)
 | 
			
		||||
		return viper.GetString("DEFAULT_IMAGE_PATH")
 | 
			
		||||
	}
 | 
			
		||||
	return imagePath
 | 
			
		||||
}
 | 
			
		||||
	} else {
 | 
			
		||||
		return viper.GetString("DEFAULT_IMAGE_PATH")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getImg(uri string) (image.Image, error) {
 | 
			
		||||
	f, err := os.Open(uri)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user