return a "-1" id (like airsonic) for "nil" items

This commit is contained in:
sentriz
2020-06-06 20:51:47 +01:00
parent b1cd71b97f
commit 9246429cac
2 changed files with 4 additions and 1 deletions

View File

@@ -265,7 +265,7 @@ func (c *Controller) ServeGetArtistInfoTwo(r *http.Request) *spec.Response {
continue
}
similar := &spec.SimilarArtist{
ID: &specid.ID{Type: specid.Artist, Value: -1},
ID: &specid.ID{},
}
if artist.ID != 0 {
similar.ID = artist.SID()

View File

@@ -51,6 +51,9 @@ func New(in string) (ID, error) {
}
func (i ID) String() string {
if i.Value == 0 {
return "-1"
}
return fmt.Sprintf("%s%s%d", i.Type, separator, i.Value)
}