Skip to content

Commit

Permalink
fix(subsonic): return empty opensubsonic fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Nov 11, 2023
1 parent 3f100fa commit 5022500
Show file tree
Hide file tree
Showing 12 changed files with 304 additions and 100 deletions.
2 changes: 1 addition & 1 deletion scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func populateTrack(tx *db.DB, album *db.Album, track *db.Track, trags tagcommon.

track.TagTitle = trags.Title()
track.TagTitleUDec = decoded(trags.Title())
track.TagTrackArtist = trags.Artist()
track.TagTrackArtist = tagcommon.MustArtist(trags)
track.TagTrackNumber = trags.TrackNumber()
track.TagDiscNumber = trags.DiscNumber()
track.TagBrainzID = trags.BrainzID()
Expand Down
18 changes: 9 additions & 9 deletions server/ctrlsubsonic/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ type Album struct {

// legacy or single tag mode
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
Artist string `xml:"artist,attr" json:"artist"`

Artists []*ArtistRef `xml:"artists,omitempty" json:"artists,omitempty"`
DisplayArtist string `xml:"diplayArtist,attr,omitempty" json:"displayArtist,omitempty"`
Artists []*ArtistRef `xml:"artists" json:"artists"`
DisplayArtist string `xml:"diplayArtist,attr" json:"displayArtist"`

// folder stuff
Title string `xml:"title,attr,omitempty" json:"title"`
Expand Down Expand Up @@ -173,14 +173,14 @@ type TrackChild struct {
AlbumID *specid.ID `xml:"albumId,attr,omitempty" json:"albumId,omitempty"`

// legacy or single tag mode
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
Artist string `xml:"artist,attr" json:"artist"`
ArtistID *specid.ID `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`

Artists []*ArtistRef `xml:"artists,omitempty" json:"artists,omitempty"`
DisplayArtist string `xml:"diplayArtist,attr,omitempty" json:"displayArtist,omitempty"`
Artists []*ArtistRef `xml:"artists" json:"artists"`
DisplayArtist string `xml:"diplayArtist,attr" json:"displayArtist"`

AlbumArtists []*ArtistRef `xml:"albumArtists,omitempty" json:"albumArtists,omitempty"`
AlbumDisplayArtist string `xml:"diplayAlbumArtist,attr,omitempty" json:"displayAlbumArtist,omitempty"`
AlbumArtists []*ArtistRef `xml:"albumArtists" json:"albumArtists"`
AlbumDisplayArtist string `xml:"diplayAlbumArtist,attr" json:"displayAlbumArtist"`

Bitrate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"`
ContentType string `xml:"contentType,attr,omitempty" json:"contentType,omitempty"`
Expand Down
18 changes: 18 additions & 0 deletions server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-2",
Expand All @@ -24,6 +26,8 @@
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
Expand All @@ -37,6 +41,8 @@
"id": "al-5",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-2",
Expand All @@ -50,6 +56,8 @@
"id": "al-7",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-6",
Expand All @@ -63,6 +71,8 @@
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-6",
Expand All @@ -76,6 +86,8 @@
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
Expand All @@ -89,6 +101,8 @@
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-10",
Expand All @@ -102,6 +116,8 @@
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-10",
Expand All @@ -115,6 +131,8 @@
"id": "al-13",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-10",
Expand Down
18 changes: 18 additions & 0 deletions server/ctrlsubsonic/testdata/test_get_album_list_alpha_name
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-2",
Expand All @@ -24,6 +26,8 @@
"id": "al-7",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-6",
Expand All @@ -37,6 +41,8 @@
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-10",
Expand All @@ -50,6 +56,8 @@
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
Expand All @@ -63,6 +71,8 @@
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-6",
Expand All @@ -76,6 +86,8 @@
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-10",
Expand All @@ -89,6 +101,8 @@
"id": "al-5",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-2",
Expand All @@ -102,6 +116,8 @@
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
Expand All @@ -115,6 +131,8 @@
"id": "al-13",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-10",
Expand Down
18 changes: 18 additions & 0 deletions server/ctrlsubsonic/testdata/test_get_album_list_newest
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-2",
Expand All @@ -24,6 +26,8 @@
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
Expand All @@ -37,6 +41,8 @@
"id": "al-5",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-2",
Expand All @@ -50,6 +56,8 @@
"id": "al-7",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-6",
Expand All @@ -63,6 +71,8 @@
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-6",
Expand All @@ -76,6 +86,8 @@
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
Expand All @@ -89,6 +101,8 @@
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-0",
"album": "album-0",
"parent": "al-10",
Expand All @@ -102,6 +116,8 @@
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-10",
Expand All @@ -115,6 +131,8 @@
"id": "al-13",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-10",
Expand Down
Loading

0 comments on commit 5022500

Please sign in to comment.