feat(subsonic): add MusicBrainz ID and Sort Name to getArtists
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"status": "ok",
|
||||
"version": "1.8.0",
|
||||
"type": "navidrome",
|
||||
"serverVersion": "v0.0.0",
|
||||
"openSubsonic": true,
|
||||
"artists": {
|
||||
"index": [
|
||||
{
|
||||
"name": "A",
|
||||
"artist": [
|
||||
{
|
||||
"id": "111",
|
||||
"name": "aaa",
|
||||
"albumCount": 2,
|
||||
"starred": "2016-03-02T20:30:00Z",
|
||||
"userRating": 3,
|
||||
"artistImageUrl": "https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png",
|
||||
"musicBrainzId": "1234",
|
||||
"sortName": "sort name"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"lastModified": 1,
|
||||
"ignoredArticles": "A"
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
|
||||
<artists lastModified="1" ignoredArticles="A">
|
||||
<index name="A">
|
||||
<artist id="111" name="aaa" albumCount="2" starred="2016-03-02T20:30:00Z" userRating="3" artistImageUrl="https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png" musicBrainzId="1234" sortName="sort name"></artist>
|
||||
</index>
|
||||
</artists>
|
||||
</subsonic-response>
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"status": "ok",
|
||||
"version": "1.8.0",
|
||||
"type": "navidrome",
|
||||
"serverVersion": "v0.0.0",
|
||||
"openSubsonic": true,
|
||||
"artists": {
|
||||
"index": [
|
||||
{
|
||||
"name": "A",
|
||||
"artist": [
|
||||
{
|
||||
"id": "111",
|
||||
"name": "aaa",
|
||||
"albumCount": 2,
|
||||
"starred": "2016-03-02T20:30:00Z",
|
||||
"userRating": 3,
|
||||
"artistImageUrl": "https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png",
|
||||
"musicBrainzId": "",
|
||||
"sortName": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"lastModified": 1,
|
||||
"ignoredArticles": "A"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
|
||||
<artists lastModified="1" ignoredArticles="A">
|
||||
<index name="A">
|
||||
<artist id="111" name="aaa" albumCount="2" starred="2016-03-02T20:30:00Z" userRating="3" artistImageUrl="https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png" musicBrainzId="" sortName=""></artist>
|
||||
</index>
|
||||
</artists>
|
||||
</subsonic-response>
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"status": "ok",
|
||||
"version": "1.8.0",
|
||||
"type": "navidrome",
|
||||
"serverVersion": "v0.0.0",
|
||||
"openSubsonic": true,
|
||||
"artists": {
|
||||
"lastModified": 1,
|
||||
"ignoredArticles": "A"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
|
||||
<artists lastModified="1" ignoredArticles="A"></artists>
|
||||
</subsonic-response>
|
||||
@@ -35,7 +35,7 @@ type Subsonic struct {
|
||||
Genres *Genres `xml:"genres,omitempty" json:"genres,omitempty"`
|
||||
|
||||
// ID3
|
||||
Artist *Indexes `xml:"artists,omitempty" json:"artists,omitempty"`
|
||||
Artist *Artists `xml:"artists,omitempty" json:"artists,omitempty"`
|
||||
ArtistWithAlbumsID3 *ArtistWithAlbumsID3 `xml:"artist,omitempty" json:"artist,omitempty"`
|
||||
AlbumWithSongsID3 *AlbumWithSongsID3 `xml:"album,omitempty" json:"album,omitempty"`
|
||||
|
||||
@@ -112,6 +112,17 @@ type Indexes struct {
|
||||
IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"`
|
||||
}
|
||||
|
||||
type IndexID3 struct {
|
||||
Name string `xml:"name,attr" json:"name"`
|
||||
Artists []ArtistID3 `xml:"artist" json:"artist"`
|
||||
}
|
||||
|
||||
type Artists struct {
|
||||
Index []IndexID3 `xml:"index" json:"index,omitempty"`
|
||||
LastModified int64 `xml:"lastModified,attr" json:"lastModified"`
|
||||
IgnoredArticles string `xml:"ignoredArticles,attr" json:"ignoredArticles"`
|
||||
}
|
||||
|
||||
type MediaType string
|
||||
|
||||
const (
|
||||
@@ -207,8 +218,8 @@ type ArtistID3 struct {
|
||||
ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"`
|
||||
|
||||
// OpenSubsonic extensions
|
||||
MusicBrainzId string `xml:"musicBrainzId,attr,omitempty" json:"musicBrainzId,omitempty"`
|
||||
SortName string `xml:"sortName,attr,omitempty" json:"sortName,omitempty"`
|
||||
MusicBrainzId string `xml:"musicBrainzId,attr" json:"musicBrainzId"`
|
||||
SortName string `xml:"sortName,attr" json:"sortName"`
|
||||
}
|
||||
|
||||
type AlbumID3 struct {
|
||||
|
||||
@@ -120,6 +120,73 @@ var _ = Describe("Responses", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Artist", func() {
|
||||
BeforeEach(func() {
|
||||
response.Artist = &Artists{LastModified: 1, IgnoredArticles: "A"}
|
||||
})
|
||||
|
||||
Context("without data", func() {
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
|
||||
Context("with data", func() {
|
||||
BeforeEach(func() {
|
||||
artists := make([]ArtistID3, 1)
|
||||
t := time.Date(2016, 03, 2, 20, 30, 0, 0, time.UTC)
|
||||
artists[0] = ArtistID3{
|
||||
Id: "111",
|
||||
Name: "aaa",
|
||||
Starred: &t,
|
||||
UserRating: 3,
|
||||
AlbumCount: 2,
|
||||
ArtistImageUrl: "https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png",
|
||||
}
|
||||
index := make([]IndexID3, 1)
|
||||
index[0] = IndexID3{Name: "A", Artists: artists}
|
||||
response.Artist.Index = index
|
||||
})
|
||||
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
|
||||
Context("with data and MBID and Sort Name", func() {
|
||||
BeforeEach(func() {
|
||||
artists := make([]ArtistID3, 1)
|
||||
t := time.Date(2016, 03, 2, 20, 30, 0, 0, time.UTC)
|
||||
artists[0] = ArtistID3{
|
||||
Id: "111",
|
||||
Name: "aaa",
|
||||
Starred: &t,
|
||||
UserRating: 3,
|
||||
AlbumCount: 2,
|
||||
ArtistImageUrl: "https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png",
|
||||
MusicBrainzId: "1234",
|
||||
SortName: "sort name",
|
||||
}
|
||||
index := make([]IndexID3, 1)
|
||||
index[0] = IndexID3{Name: "A", Artists: artists}
|
||||
response.Artist.Index = index
|
||||
})
|
||||
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Child", func() {
|
||||
Context("without data", func() {
|
||||
BeforeEach(func() {
|
||||
@@ -466,7 +533,6 @@ var _ = Describe("Responses", func() {
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user