diff --git a/config.go b/config.go index c3d6d18..6b683cc 100644 --- a/config.go +++ b/config.go @@ -16,6 +16,8 @@ var ( "IMAGE_WIDTH_EXTRA_Y": -3.75, "MUSIC_DIRECTORY": HOME_DIR + "/Music", "PORT": "6600", + "DEFAULT_IMAGE_PATH": "default.jpg", + "COVER_IMAGE_PATH": "cover.jpg", } ) diff --git a/imageUtils.go b/imageUtils.go index eafd055..326b190 100644 --- a/imageUtils.go +++ b/imageUtils.go @@ -15,7 +15,7 @@ import ( path to default image is sent. */ func getAlbumArt(uri string) string { - var path string = "/H/code/goMP/default.jpg" + var path string = viper.GetString("DEFAULT_IMAGE_PATH") f, err := os.Open(uri) if err != nil { panic(err) @@ -26,13 +26,13 @@ func getAlbumArt(uri string) string { } albumCover := m.Picture() if albumCover != nil { - b, err := os.Create("/H/code/goMP/thumb.jpg") + b, err := os.Create(viper.GetString("COVER_IMAGE_PATH")) if err != nil { panic(err) } defer b.Close() b.Write(albumCover.Data) - path = "/H/code/goMP/thumb.jpg" + path = viper.GetString("COVER_IMAGE_PATH") b.Close() } f.Close() diff --git a/sample_config.yml b/sample_config.yml index cdef660..e1e611d 100644 --- a/sample_config.yml +++ b/sample_config.yml @@ -46,3 +46,7 @@ IMAGE_WIDTH_EXTRA_Y : -3.75 MPD_PORT : "6600" # Port on which music player daemon is running + + +DEFAULT_IMAGE_PATH: "default.jpg" +COVER_IMAGE_PATH: "cover.jpg" # path to store the embedded cover art