feat(subsonic): expose track musicbrainz id

Release-As: 0.16.3
This commit is contained in:
sentriz
2023-12-02 17:58:18 +00:00
parent 816378140e
commit f98b2326da
11 changed files with 233 additions and 170 deletions

View File

@@ -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),
}

View File

@@ -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{},

View File

@@ -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"`

View File

@@ -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
@@ -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
@@ -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
}
]
}

View File

@@ -8,61 +8,16 @@
"albumList2": {
"album": [
{
"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-1",
"album": "album-1",
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-11",
"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",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-13",
"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",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-9",
"id": "al-7",
"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",
"title": "album-0",
"album": "album-0",
"coverArt": "al-7",
"name": "album-0",
"songCount": 3,
"duration": 300,
"year": 2021
@@ -83,31 +38,16 @@
"year": 2021
},
{
"id": "al-7",
"id": "al-12",
"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",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-5",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-2",
"album": "album-2",
"coverArt": "al-5",
"name": "album-2",
"artistId": "ar-3",
"artist": "artist-2",
"artists": [{ "id": "ar-3", "name": "artist-2" }],
"displayArtist": "artist-2",
"title": "album-1",
"album": "album-1",
"coverArt": "al-12",
"name": "album-1",
"songCount": 3,
"duration": 300,
"year": 2021
@@ -141,6 +81,66 @@
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"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-2",
"album": "album-2",
"coverArt": "al-9",
"name": "album-2",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-5",
"created": "2019-11-30T00:00:00Z",
"artistId": "ar-1",
"artist": "artist-0",
"artists": [{ "id": "ar-1", "name": "artist-0" }],
"displayArtist": "artist-0",
"title": "album-2",
"album": "album-2",
"coverArt": "al-5",
"name": "album-2",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-13",
"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",
"songCount": 3,
"duration": 300,
"year": 2021
},
{
"id": "al-11",
"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",
"songCount": 3,
"duration": 300,
"year": 2021
}
]
}

View File

@@ -46,7 +46,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-2",
@@ -72,7 +73,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-3",
@@ -98,7 +100,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
}
]
}

View File

@@ -32,7 +32,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-2",
@@ -56,7 +57,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-3",
@@ -80,7 +82,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
}
]
}

View File

@@ -22,7 +22,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-2",
"title": "album-0"
"title": "album-0",
"musicBrainzId": ""
},
{
"id": "al-4",
@@ -36,7 +37,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-2",
"title": "album-1"
"title": "album-1",
"musicBrainzId": ""
},
{
"id": "al-5",
@@ -50,7 +52,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-2",
"title": "album-2"
"title": "album-2",
"musicBrainzId": ""
}
]
}

View File

@@ -33,7 +33,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-2",
@@ -61,7 +62,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-3",
@@ -89,7 +91,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-4",
@@ -117,7 +120,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-5",
@@ -145,7 +149,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-6",
@@ -173,7 +178,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-7",
@@ -201,7 +207,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-8",
@@ -229,7 +236,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-9",
@@ -257,7 +265,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-10",
@@ -285,7 +294,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-11",
@@ -313,7 +323,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-12",
@@ -341,7 +352,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-13",
@@ -369,7 +381,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-14",
@@ -397,7 +410,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-15",
@@ -425,7 +439,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-16",
@@ -453,7 +468,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-17",
@@ -481,7 +497,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-18",
@@ -509,7 +526,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-19",
@@ -537,7 +555,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-20",
@@ -565,7 +584,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
}
]
}

View File

@@ -19,7 +19,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-2",
"title": "album-0"
"title": "album-0",
"musicBrainzId": ""
},
{
"id": "al-4",
@@ -33,7 +34,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-2",
"title": "album-1"
"title": "album-1",
"musicBrainzId": ""
},
{
"id": "al-5",
@@ -47,7 +49,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-2",
"title": "album-2"
"title": "album-2",
"musicBrainzId": ""
},
{
"id": "al-7",
@@ -61,7 +64,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-6",
"title": "album-0"
"title": "album-0",
"musicBrainzId": ""
},
{
"id": "al-8",
@@ -75,7 +79,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-6",
"title": "album-1"
"title": "album-1",
"musicBrainzId": ""
},
{
"id": "al-9",
@@ -89,7 +94,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-6",
"title": "album-2"
"title": "album-2",
"musicBrainzId": ""
},
{
"id": "al-11",
@@ -103,7 +109,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-10",
"title": "album-0"
"title": "album-0",
"musicBrainzId": ""
},
{
"id": "al-12",
@@ -117,7 +124,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-10",
"title": "album-1"
"title": "album-1",
"musicBrainzId": ""
},
{
"id": "al-13",
@@ -131,7 +139,8 @@
"isDir": true,
"isVideo": false,
"parent": "al-10",
"title": "album-2"
"title": "album-2",
"musicBrainzId": ""
}
]
}

View File

@@ -29,7 +29,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-2",
@@ -53,7 +54,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-3",
@@ -77,7 +79,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-4",
@@ -101,7 +104,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-5",
@@ -125,7 +129,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-6",
@@ -149,7 +154,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-7",
@@ -173,7 +179,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-8",
@@ -197,7 +204,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-9",
@@ -221,7 +229,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-10",
@@ -245,7 +254,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-11",
@@ -269,7 +279,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-12",
@@ -293,7 +304,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-13",
@@ -317,7 +329,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-14",
@@ -341,7 +354,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-15",
@@ -365,7 +379,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-16",
@@ -389,7 +404,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-17",
@@ -413,7 +429,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-18",
@@ -437,7 +454,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-19",
@@ -461,7 +479,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
},
{
"id": "tr-20",
@@ -485,7 +504,8 @@
"track": 1,
"discNumber": 1,
"type": "music",
"year": 2021
"year": 2021,
"musicBrainzId": ""
}
]
}