forked from Elara6331/infinitime
Handle case where artists value is a single string rather than a slice. Fixes Arsen6331/itd#9.
This commit is contained in:
parent
e82981e3fc
commit
7026da3f6f
@ -163,12 +163,17 @@ func OnChange(cb func(ChangeType, string)) {
|
|||||||
}
|
}
|
||||||
cb(ChangeTypeAlbum, album)
|
cb(ChangeTypeAlbum, album)
|
||||||
} else if strings.HasSuffix(name, "artist") {
|
} else if strings.HasSuffix(name, "artist") {
|
||||||
artists := val.Value().([]string)
|
var artists string
|
||||||
artistStr := strings.Join(artists, ", ")
|
switch artistVal := val.Value().(type) {
|
||||||
if artistStr == "" {
|
case string:
|
||||||
artistStr = "Unknown " + ChangeTypeArtist.String()
|
artists = artistVal
|
||||||
|
case []string:
|
||||||
|
artists = strings.Join(artistVal, ", ")
|
||||||
}
|
}
|
||||||
cb(ChangeTypeArtist, artistStr)
|
if artists == "" {
|
||||||
|
artists = "Unknown " + ChangeTypeArtist.String()
|
||||||
|
}
|
||||||
|
cb(ChangeTypeArtist, artists)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if name == "PlaybackStatus" {
|
} else if name == "PlaybackStatus" {
|
||||||
|
Loading…
Reference in New Issue
Block a user