Compare commits
No commits in common. "e29c7be4facd564ecd15f83cc0c347037e88d0b2" and "ada3580a8564e7d756dc4a7b794c9bc20f3146e5" have entirely different histories.
e29c7be4fa
...
ada3580a85
19
main.go
19
main.go
@ -8,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@ -80,13 +79,10 @@ func GetAllHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func GetFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||
fileName, err := url.QueryUnescape(mux.Vars(r)["file"])
|
||||
if err != nil {
|
||||
InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
vars := mux.Vars(r)
|
||||
file := vars["file"]
|
||||
|
||||
http.ServeFile(w, r, filepath.Join(LibraryPath, ".songs", fileName))
|
||||
http.ServeFile(w, r, filepath.Join(LibraryPath, ".songs", file))
|
||||
}
|
||||
|
||||
func GetPlaylistHandler(w http.ResponseWriter, r *http.Request) {
|
||||
@ -144,13 +140,8 @@ func GetAllFilesHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func GetEncodeFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
format := vars["format"]
|
||||
fileName, err := url.QueryUnescape(vars["file"])
|
||||
if err != nil {
|
||||
InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
fileName := mux.Vars(r)["file"]
|
||||
format := mux.Vars(r)["format"]
|
||||
|
||||
inputFilePath := filepath.Join(LibraryPath, ".songs", fileName)
|
||||
outputFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("%d.%s", rand.Int(), format))
|
||||
|
Loading…
Reference in New Issue
Block a user