diff --git a/api/stream.go b/api/stream.go index 7be7be97e..e7bbafd38 100644 --- a/api/stream.go +++ b/api/stream.go @@ -1,13 +1,14 @@ package api import ( + "strconv" + "github.com/astaxie/beego" "github.com/deluan/gosonic/api/responses" "github.com/deluan/gosonic/domain" - "github.com/deluan/gosonic/stream" + "github.com/deluan/gosonic/engine" "github.com/deluan/gosonic/utils" "github.com/karlkfi/inject" - "strconv" ) type StreamController struct { @@ -55,7 +56,7 @@ func (c *StreamController) Stream() { c.Ctx.Output.Header("Cache-Control", "must-revalidate") c.Ctx.Output.Header("Pragma", "public") - err := stream.Stream(c.mf.Path, c.mf.BitRate, maxBitRate, c.Ctx.ResponseWriter) + err := engine.Stream(c.mf.Path, c.mf.BitRate, maxBitRate, c.Ctx.ResponseWriter) if err != nil { beego.Error("Error streaming file", c.id, ":", err) } @@ -66,7 +67,7 @@ func (c *StreamController) Stream() { func (c *StreamController) Download() { beego.Debug("Sending file", c.mf.Path) - stream.Stream(c.mf.Path, 0, 0, c.Ctx.ResponseWriter) + engine.Stream(c.mf.Path, 0, 0, c.Ctx.ResponseWriter) beego.Debug("Finished sending", c.mf.Path) } diff --git a/stream/downsampling.go b/engine/stream.go similarity index 98% rename from stream/downsampling.go rename to engine/stream.go index a4f1cbeb7..3efd6908d 100644 --- a/stream/downsampling.go +++ b/engine/stream.go @@ -1,12 +1,13 @@ -package stream +package engine import ( - "github.com/astaxie/beego" "io" "os" "os/exec" "strconv" "strings" + + "github.com/astaxie/beego" ) // TODO Encapsulate as a io.Reader diff --git a/stream/downsampling_test.go b/engine/stream_test.go similarity index 97% rename from stream/downsampling_test.go rename to engine/stream_test.go index 9dc5103bf..ee03bf596 100644 --- a/stream/downsampling_test.go +++ b/engine/stream_test.go @@ -1,9 +1,10 @@ -package stream +package engine import ( + "testing" + . "github.com/deluan/gosonic/tests" . "github.com/smartystreets/goconvey/convey" - "testing" ) func TestDownsampling(t *testing.T) {