Show folders scanned instead of files scanned

This commit is contained in:
Deluan
2020-11-16 00:33:17 -05:00
parent be715c3696
commit a1dcb9a4e3
11 changed files with 60 additions and 30 deletions
+3 -2
View File
@@ -7,8 +7,9 @@ type Event interface {
}
type ScanStatus struct {
Scanning bool `json:"scanning"`
Count int64 `json:"count"`
Scanning bool `json:"scanning"`
Count int64 `json:"count"`
FolderCount int64 `json:"folderCount"`
}
func (s ScanStatus) EventName() string { return "scanStatus" }
+4 -3
View File
@@ -30,9 +30,10 @@ func (c *LibraryScanningController) GetScanStatus(w http.ResponseWriter, r *http
}
response := newResponse()
response.ScanStatus = &responses.ScanStatus{
Scanning: status.Scanning,
Count: int64(status.Count),
LastScan: &status.LastScan,
Scanning: status.Scanning,
Count: int64(status.Count),
FolderCount: int64(status.FolderCount),
LastScan: &status.LastScan,
}
return response, nil
}
@@ -1 +1 @@
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","scanStatus":{"scanning":true,"count":123,"lastScan":"2006-01-02T15:04:00Z"}}
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","scanStatus":{"scanning":true,"count":456,"folderCount":123,"lastScan":"2006-01-02T15:04:00Z"}}
@@ -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" lastScan="2006-01-02T15:04:00Z"></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="456" folderCount="123" lastScan="2006-01-02T15:04:00Z"></scanStatus></subsonic-response>
@@ -1 +1 @@
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","scanStatus":{"scanning":false,"count":0}}
{"status":"ok","version":"1.8.0","type":"navidrome","serverVersion":"v0.0.0","scanStatus":{"scanning":false,"count":0,"folderCount":0}}
@@ -1 +1 @@
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><scanStatus scanning="false" count="0"></scanStatus></subsonic-response>
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0"><scanStatus scanning="false" count="0" folderCount="0"></scanStatus></subsonic-response>
+4 -3
View File
@@ -341,7 +341,8 @@ type Bookmarks struct {
}
type ScanStatus struct {
Scanning bool `xml:"scanning,attr" json:"scanning"`
Count int64 `xml:"count,attr" json:"count"`
LastScan *time.Time `xml:"lastScan,attr,omitempty" json:"lastScan,omitempty"`
Scanning bool `xml:"scanning,attr" json:"scanning"`
Count int64 `xml:"count,attr" json:"count"`
FolderCount int64 `xml:"folderCount,attr" json:"folderCount"`
LastScan *time.Time `xml:"lastScan,attr,omitempty" json:"lastScan,omitempty"`
}
+4 -3
View File
@@ -546,9 +546,10 @@ var _ = Describe("Responses", func() {
BeforeEach(func() {
t, _ := time.Parse(time.RFC822, time.RFC822)
response.ScanStatus = &ScanStatus{
Scanning: true,
Count: 123,
LastScan: &t,
Scanning: true,
FolderCount: 123,
Count: 456,
LastScan: &t,
}
})
It("should match .XML", func() {