Handle case where artists value is a single string rather than a slice. Fixes Arsen6331/itd#9.
This commit is contained in:
parent
b6ba971d50
commit
36aee2e1fe
@ -163,12 +163,17 @@ func OnChange(cb func(ChangeType, string)) {
|
||||
}
|
||||
cb(ChangeTypeAlbum, album)
|
||||
} else if strings.HasSuffix(name, "artist") {
|
||||
artists := val.Value().([]string)
|
||||
artistStr := strings.Join(artists, ", ")
|
||||
if artistStr == "" {
|
||||
artistStr = "Unknown " + ChangeTypeArtist.String()
|
||||
var artists string
|
||||
switch artistVal := val.Value().(type) {
|
||||
case 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" {
|
||||
|
Reference in New Issue
Block a user