Skip to content

Commit

Permalink
feat(subsonic): expose track musicbrainz id
Browse files Browse the repository at this point in the history
Release-As: 0.16.3
  • Loading branch information
sentriz committed Dec 2, 2023
1 parent 8163781 commit f98b232
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 156 deletions.
1 change: 1 addition & 0 deletions server/ctrlsubsonic/spec/construct_by_folder.go
Expand Up @@ -74,6 +74,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
Bitrate: t.Bitrate,
IsDir: false,
Type: "music",
MusicBrainzID: t.TagBrainzID,
CreatedAt: t.CreatedAt,
AverageRating: formatRating(t.AverageRating),
}
Expand Down
1 change: 1 addition & 0 deletions server/ctrlsubsonic/spec/construct_by_tags.go
Expand Up @@ -77,6 +77,7 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
TrackNumber: t.TagTrackNumber,
DiscNumber: t.TagDiscNumber,
Type: "music",
MusicBrainzID: t.TagBrainzID,
Year: album.TagYear,
AverageRating: formatRating(t.AverageRating),
TranscodeMeta: TranscodeMeta{},
Expand Down
3 changes: 3 additions & 0 deletions server/ctrlsubsonic/spec/spec.go
Expand Up @@ -200,6 +200,9 @@ type TrackChild struct {
DiscNumber int `xml:"discNumber,attr,omitempty" json:"discNumber,omitempty"`
Type string `xml:"type,attr,omitempty" json:"type,omitempty"`
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`

MusicBrainzID string `xml:"musicBrainzId,attr" json:"musicBrainzId"`

// star / rating
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
Expand Down
76 changes: 38 additions & 38 deletions server/ctrlsubsonic/testdata/test_get_album_list_random
Expand Up @@ -8,16 +8,31 @@
"albumList": {
"album": [
{
"id": "al-4",
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artist": "artist-2",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-2",
"parent": "al-10",
"isDir": true,
"coverArt": "al-4",
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300
},
{
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-6",
"isDir": true,
"coverArt": "al-8",
"name": "album-1",
"songCount": 3,
"duration": 300
Expand All @@ -38,16 +53,31 @@
"duration": 300
},
{
"id": "al-12",
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-2",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
"isDir": true,
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300
},
{
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-0",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-10",
"parent": "al-2",
"isDir": true,
"coverArt": "al-12",
"coverArt": "al-4",
"name": "album-1",
"songCount": 3,
"duration": 300
Expand Down Expand Up @@ -111,36 +141,6 @@
"name": "album-0",
"songCount": 3,
"duration": 300
},
{
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-2",
"album": "album-2",
"parent": "al-6",
"isDir": true,
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300
},
{
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artist": "artist-1",
"artists": null,
"displayArtist": "",
"title": "album-1",
"album": "album-1",
"parent": "al-6",
"isDir": true,
"coverArt": "al-8",
"name": "album-1",
"songCount": 3,
"duration": 300
}
]
}
Expand Down
120 changes: 60 additions & 60 deletions server/ctrlsubsonic/testdata/test_get_album_list_two_random
Expand Up @@ -8,91 +8,91 @@
"albumList2": {
"album": [
{
"id": "al-12",
"id": "al-7",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"artistId": "ar-2",
"artist": "artist-1",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "artist-1",
"title": "album-0",
"album": "album-0",
"coverArt": "al-7",
"name": "album-0",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-1",
"album": "album-1",
"coverArt": "al-12",
"coverArt": "al-4",
"name": "album-1",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-11",
"id": "al-12",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-0",
"album": "album-0",
"coverArt": "al-11",
"name": "album-0",
"title": "album-1",
"album": "album-1",
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-13",
"id": "al-3",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-2",
"album": "album-2",
"coverArt": "al-13",
"name": "album-2",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-0",
"album": "album-0",
"coverArt": "al-3",
"name": "album-0",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-9",
"id": "al-8",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-2",
"artist": "artist-1",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "artist-1",
"title": "album-2",
"album": "album-2",
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-4",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-1",
"album": "album-1",
"coverArt": "al-4",
"coverArt": "al-8",
"name": "album-1",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-7",
"id": "al-9",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-2",
"artist": "artist-1",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "artist-1",
"title": "album-0",
"album": "album-0",
"coverArt": "al-7",
"name": "album-0",
"title": "album-2",
"album": "album-2",
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300,
"year": 2021
Expand All @@ -113,31 +113,31 @@
"year": 2021
},
{
"id": "al-3",
"id": "al-13",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-0",
"album": "album-0",
"coverArt": "al-3",
"name": "album-0",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-2",
"album": "album-2",
"coverArt": "al-13",
"name": "album-2",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-8",
"id": "al-11",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-2",
"artist": "artist-1",
"artists": [{ "id": "ar-2", "name": "artist-1" }],
"displayArtist": "artist-1",
"title": "album-1",
"album": "album-1",
"coverArt": "al-8",
"name": "album-1",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-0",
"album": "album-0",
"coverArt": "al-11",
"name": "album-0",
"songCount": 3,
"duration": 300,
"year": 2021
Expand Down
9 changes: 6 additions & 3 deletions server/ctrlsubsonic/testdata/test_get_album_with_cover
Expand Up @@ -46,7 +46,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-2",
Expand All @@ -72,7 +73,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-3",
Expand All @@ -98,7 +100,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
}
]
}
Expand Down
Expand Up @@ -32,7 +32,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-2",
Expand All @@ -56,7 +57,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-3",
Expand All @@ -80,7 +82,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
}
]
}
Expand Down

0 comments on commit f98b232

Please sign in to comment.