Skip to content

Commit

Permalink
Encode empty year as zero
Browse files Browse the repository at this point in the history
Some players (Amperfy) fail when the year is not present in the
response.
  • Loading branch information
ironsmile committed May 17, 2024
1 parent 6dd2aa6 commit 81dee3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/webserver/subsonic/get_music_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (s *subsonic) getRootDirectory(
xsdChild{
ID: artistFSID(artist.ID),
ParentID: combinedMusicFolderID,
CoverArtID: artistCoverArtID(artist.ID),
Name: artist.Name,
Artist: artist.Name,
Title: artist.Name,
Expand Down
6 changes: 3 additions & 3 deletions src/webserver/subsonic/xsd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ type xsdChild struct {
CoverArtID string `xml:"coverArt,attr,omitempty" json:"coverArt"`
Track int64 `xml:"track,attr,omitempty" json:"track,omitempty"` // position in album, I suppose
Duration int64 `xml:"duration,attr,omitempty" json:"duration,omitempty"` // in seconds
Year int16 `xml:"year,attr,omitempty" json:"year,omitempty"`
Year int16 `xml:"year,attr" json:"year"`
Genre string `xml:"genre,attr,omitempty" json:"gener,omitempty"`
Size int64 `xml:"size,attr,omitempty" json:"size,omitempty"` // in bytes
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
UserRating uint8 `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
Suffix string `xml:"suffix,attr,omitempty" json:"suffix,omitempty"`
BitRate string `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
BitRate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
Path string `xml:"path,attr,omitempty" json:"path,omitempty"` // on the file system I suppose
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
Expand Down Expand Up @@ -178,7 +178,7 @@ type xsdAlbumID3 struct {
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playCount,omitempty"`
Created time.Time `xml:"created,attr" json:"created"`
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
Year int16 `xml:"year,attr,omitempty" json:"year,omitempty"`
Year int16 `xml:"year,attr" json:"year"`
Genre string `xml:"genre,attr,omitempty" json:"gener,omitempty"`
}

Expand Down

0 comments on commit 81dee3b

Please sign in to comment.