Initial support for song browsing from UI
This commit is contained in:
@@ -53,6 +53,9 @@ func (app *Router) routes() http.Handler {
|
||||
R(r, "/user", func(ctx context.Context) rest.Repository {
|
||||
return app.ds.Resource(model.User{})
|
||||
})
|
||||
R(r, "/song", func(ctx context.Context) rest.Repository {
|
||||
return app.ds.Resource(model.MediaFile{})
|
||||
})
|
||||
})
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ func ToChild(entry engine.Entry) responses.Child {
|
||||
child.CoverArt = entry.CoverArt
|
||||
child.Track = entry.Track
|
||||
child.Duration = entry.Duration
|
||||
child.Size = entry.Size
|
||||
child.Size = strconv.Itoa(entry.Size)
|
||||
child.Suffix = entry.Suffix
|
||||
child.BitRate = entry.BitRate
|
||||
child.ContentType = entry.ContentType
|
||||
|
||||
@@ -2,6 +2,7 @@ package subsonic
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/engine"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
@@ -54,7 +55,7 @@ func (c *StreamController) Stream(w http.ResponseWriter, r *http.Request) (*resp
|
||||
// contentLength = strconv.Itoa((mf.Duration + 1) * maxBitRate * 1000 / 8)
|
||||
//}
|
||||
h := w.Header()
|
||||
h.Set("Content-Length", mf.Size)
|
||||
h.Set("Content-Length", strconv.Itoa(mf.Size))
|
||||
h.Set("Content-Type", "audio/mpeg")
|
||||
h.Set("Expires", "0")
|
||||
h.Set("Cache-Control", "must-revalidate")
|
||||
|
||||
Reference in New Issue
Block a user