Default path for music_directory is now parsed from mpd.conf

This commit is contained in:
aditya-K2 2021-11-05 15:04:22 +05:30
parent a365ca8c08
commit aba0dae95e
2 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,7 @@ var (
"ADDITIONAL_PADDING_Y": 16, "ADDITIONAL_PADDING_Y": 16,
"IMAGE_WIDTH_EXTRA_X": -1.5, "IMAGE_WIDTH_EXTRA_X": -1.5,
"IMAGE_WIDTH_EXTRA_Y": -3.75, "IMAGE_WIDTH_EXTRA_Y": -3.75,
"MUSIC_DIRECTORY": HOME_DIR + "/Music", "MUSIC_DIRECTORY": getMusicDirectory(),
"PORT": "6600", "PORT": "6600",
"DEFAULT_IMAGE_PATH": "default.jpg", "DEFAULT_IMAGE_PATH": "default.jpg",
"COVER_IMAGE_PATH": "cover.jpg", "COVER_IMAGE_PATH": "cover.jpg",

View File

@ -94,6 +94,7 @@ func getMusicDirectory() string {
for _, j := range maps { for _, j := range maps {
if strings.Contains(j, "music_directory") { if strings.Contains(j, "music_directory") {
s := strings.SplitAfter(strings.ReplaceAll(j, " ", ""), "y")[1] s := strings.SplitAfter(strings.ReplaceAll(j, " ", ""), "y")[1]
s = strings.ReplaceAll(s, "\t", "")
d := "" d := ""
for z, m := range s { for z, m := range s {
if (z != 0) && (z != (len(s) - 1)) { if (z != 0) && (z != (len(s) - 1)) {