Implements library scanning endpoints. Also:
- Bumped Subsonic API version to 1.15: - Better User/Users Subsonic endpoint implementations, not final though
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","scanStatus":{"scanning":true,"count":123}}
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","scanStatus":{"scanning":true,"count":123,"lastScan":"2006-01-02T15:04:00Z"}}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><scanStatus scanning="true" count="123"></scanStatus></subsonic-response>
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><scanStatus scanning="true" count="123" lastScan="2006-01-02T15:04:00Z"></scanStatus></subsonic-response>
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","users":{"user":[{"username":"deluan","email":"navidrome@deluan.com","scrobblingEnabled":false,"adminRole":true,"settingsRole":false,"downloadRole":false,"uploadRole":false,"playlistRole":false,"coverArtRole":false,"commentRole":false,"podcastRole":false,"streamRole":false,"jukeboxRole":false,"shareRole":false,"videoConversionRole":false,"folder":[1]}]}}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><users><user username="deluan" email="navidrome@deluan.com" scrobblingEnabled="false" adminRole="true" settingsRole="false" downloadRole="false" uploadRole="false" playlistRole="false" coverArtRole="false" commentRole="false" podcastRole="false" streamRole="false" jukeboxRole="false" shareRole="false" videoConversionRole="false"><folder>1</folder></user></users></subsonic-response>
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","users":{"user":[{"username":"deluan","scrobblingEnabled":false,"adminRole":false,"settingsRole":false,"downloadRole":false,"uploadRole":false,"playlistRole":false,"coverArtRole":false,"commentRole":false,"podcastRole":false,"streamRole":false,"jukeboxRole":false,"shareRole":false,"videoConversionRole":false}]}}
|
||||
+1
@@ -0,0 +1 @@
|
||||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><users><user username="deluan" scrobblingEnabled="false" adminRole="false" settingsRole="false" downloadRole="false" uploadRole="false" playlistRole="false" coverArtRole="false" commentRole="false" podcastRole="false" streamRole="false" jukeboxRole="false" shareRole="false" videoConversionRole="false"></user></users></subsonic-response>
|
||||
@@ -17,6 +17,7 @@ type Subsonic struct {
|
||||
Indexes *Indexes `xml:"indexes,omitempty" json:"indexes,omitempty"`
|
||||
Directory *Directory `xml:"directory,omitempty" json:"directory,omitempty"`
|
||||
User *User `xml:"user,omitempty" json:"user,omitempty"`
|
||||
Users *Users `xml:"users,omitempty" json:"users,omitempty"`
|
||||
AlbumList *AlbumList `xml:"albumList,omitempty" json:"albumList,omitempty"`
|
||||
AlbumList2 *AlbumList `xml:"albumList2,omitempty" json:"albumList2,omitempty"`
|
||||
Playlists *Playlists `xml:"playlists,omitempty" json:"playlists,omitempty"`
|
||||
@@ -270,6 +271,10 @@ type User struct {
|
||||
Folder []int `xml:"folder,omitempty" json:"folder,omitempty"`
|
||||
}
|
||||
|
||||
type Users struct {
|
||||
User []User `xml:"user" json:"user"`
|
||||
}
|
||||
|
||||
type Genre struct {
|
||||
Name string `xml:",chardata" json:"value,omitempty"`
|
||||
SongCount int `xml:"songCount,attr" json:"songCount"`
|
||||
@@ -334,6 +339,7 @@ type Bookmarks struct {
|
||||
}
|
||||
|
||||
type ScanStatus struct {
|
||||
Scanning bool `xml:"scanning,attr" json:"scanning"`
|
||||
Count int64 `xml:"count,attr" json:"count"`
|
||||
Scanning bool `xml:"scanning,attr" json:"scanning"`
|
||||
Count int64 `xml:"count,attr" json:"count"`
|
||||
LastScan *time.Time `xml:"lastScan,attr,omitempty" json:"lastScan,omitempty"`
|
||||
}
|
||||
|
||||
@@ -220,6 +220,39 @@ var _ = Describe("Responses", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Users", func() {
|
||||
BeforeEach(func() {
|
||||
u := User{Username: "deluan"}
|
||||
response.Users = &Users{User: []User{u}}
|
||||
})
|
||||
|
||||
Context("without data", func() {
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
|
||||
Context("with data", func() {
|
||||
BeforeEach(func() {
|
||||
u := User{Username: "deluan"}
|
||||
u.Email = "navidrome@deluan.com"
|
||||
u.AdminRole = true
|
||||
u.Folder = []int{1}
|
||||
response.Users = &Users{User: []User{u}}
|
||||
})
|
||||
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.Marshal(response)).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Playlists", func() {
|
||||
BeforeEach(func() {
|
||||
response.Playlists = &Playlists{}
|
||||
@@ -504,9 +537,11 @@ var _ = Describe("Responses", func() {
|
||||
|
||||
Context("with data", func() {
|
||||
BeforeEach(func() {
|
||||
t, _ := time.Parse(time.RFC822, time.RFC822)
|
||||
response.ScanStatus = &ScanStatus{
|
||||
Scanning: true,
|
||||
Count: 123,
|
||||
LastScan: &t,
|
||||
}
|
||||
})
|
||||
It("should match .XML", func() {
|
||||
|
||||
Reference in New Issue
Block a user