Switch "/stream" controller to new "encode or stream cache" function
This commit is contained in:
@@ -69,10 +69,9 @@ func (c *Controller) ServeStream(w http.ResponseWriter, r *http.Request) *spec.R
|
|||||||
track.Album.RightPath,
|
track.Album.RightPath,
|
||||||
track.Filename,
|
track.Filename,
|
||||||
)
|
)
|
||||||
if mime, ok := mime.Types[track.Ext()]; ok {
|
StreamTrack(w, r, absPath, client, c.CachePath)
|
||||||
w.Header().Set("Content-Type", mime)
|
|
||||||
}
|
//
|
||||||
http.ServeFile(w, r, absPath)
|
|
||||||
// after we've served the file, mark the album as played
|
// after we've served the file, mark the album as played
|
||||||
user := r.Context().Value(CtxUser).(*db.User)
|
user := r.Context().Value(CtxUser).(*db.User)
|
||||||
play := db.Play{
|
play := db.Play{
|
||||||
@@ -109,6 +108,9 @@ func (c *Controller) ServeDownload(w http.ResponseWriter, r *http.Request) *spec
|
|||||||
track.Album.RightPath,
|
track.Album.RightPath,
|
||||||
track.Filename,
|
track.Filename,
|
||||||
)
|
)
|
||||||
|
if mime, ok := mime.Types[track.Ext()]; ok {
|
||||||
|
w.Header().Set("Content-Type", mime)
|
||||||
|
}
|
||||||
http.ServeFile(w, r, absPath)
|
http.ServeFile(w, r, absPath)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user