add licence
This commit is contained in:
@@ -27,6 +27,7 @@ func respondRaw(w http.ResponseWriter, r *http.Request, code int, sub *subsonic.
|
||||
w.Write([]byte(`{"subsonic-response":`))
|
||||
w.Write(data)
|
||||
w.Write([]byte("}"))
|
||||
fmt.Println("THE JSON", string(data))
|
||||
case "jsonp":
|
||||
w.Header().Set("Content-Type", "application/javascript")
|
||||
data, err := json.Marshal(sub)
|
||||
@@ -37,6 +38,7 @@ func respondRaw(w http.ResponseWriter, r *http.Request, code int, sub *subsonic.
|
||||
w.Write([]byte(fmt.Sprintf(`%s({"subsonic-response":`, callback)))
|
||||
w.Write(data)
|
||||
w.Write([]byte("});"))
|
||||
fmt.Println("THE JSONP", string(data))
|
||||
default:
|
||||
w.Header().Set("Content-Type", "application/xml")
|
||||
data, err := xml.Marshal(sub)
|
||||
@@ -44,6 +46,7 @@ func respondRaw(w http.ResponseWriter, r *http.Request, code int, sub *subsonic.
|
||||
log.Printf("could not marshall to xml: %v\n", err)
|
||||
}
|
||||
w.Write(data)
|
||||
fmt.Println("THE XML", string(data))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
@@ -167,14 +166,17 @@ func (c *Controller) Stream(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
stat, _ := file.Stat()
|
||||
size := strconv.FormatInt(stat.Size(), 10)
|
||||
w.Header().Set("Content-Type", "application/octet-stream")
|
||||
w.Header().Set("Content-Length", size)
|
||||
file.Seek(0, 0)
|
||||
io.Copy(w, file)
|
||||
http.ServeContent(w, req, track.Path, stat.ModTime(), file)
|
||||
}
|
||||
|
||||
func (c *Controller) GetMusicFolders(w http.ResponseWriter, req *http.Request) {}
|
||||
func (c *Controller) GetPlaylists(w http.ResponseWriter, req *http.Request) {}
|
||||
func (c *Controller) GetGenres(w http.ResponseWriter, req *http.Request) {}
|
||||
func (c *Controller) GetPodcasts(w http.ResponseWriter, req *http.Request) {}
|
||||
func (c *Controller) GetLicence(w http.ResponseWriter, req *http.Request) {
|
||||
sub := subsonic.NewResponse()
|
||||
sub.Licence = &subsonic.Licence{
|
||||
Valid: true,
|
||||
}
|
||||
respond(w, req, sub)
|
||||
}
|
||||
|
||||
func (c *Controller) NotFound(w http.ResponseWriter, req *http.Request) {
|
||||
respondError(w, req, 0, "unknown route")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user