func GetStream(w http.ResponseWriter, r *http.Request) {
	ren := context.Get(r, CtxRender).(*render.Render)
	w.Header().Set("Accept-Ranges", "bytes")
	if version, ok := mux.Vars(r)["version"]; ok {
		if !apiVersionSet.Has(version) {
			ren.JSON(w, 400, errRes(400, "unsupported API version: "+version))
			return
		}
	}
	pID, ok := mux.Vars(r)["id"]
	if !ok {
		ren.JSON(w, 400, errRes(400, "no integer stream ID provided"))
		return
	}
	id, err := strconv.Atoi(pID)
	if err != nil {
		ren.JSON(w, 400, errRes(400, "invalid integer stream ID"))
		return
	}
	song := &data.Song{ID: id}
	if err := song.Load(); err != nil {
		if err == sql.ErrNoRows {
			ren.JSON(w, 404, errRes(404, "song ID not found"))
			return
		}
		log.Println(err)
		ren.JSON(w, 500, serverErr)
		return
	}
	stream, err := song.Stream()
	if err != nil {
		log.Println(err)
		ren.JSON(w, 500, serverErr)
		return
	}
	opStr := fmt.Sprintf("[#%05d] %s - %s [%s %dkbps]", song.ID, song.Artist, song.Title,
		data.CodecMap[song.FileTypeID], song.Bitrate)
	log.Println("stream: starting:", opStr)
	if err := HTTPStream(song, "", song.FileSize, stream, r, w); err != nil {
		if strings.Contains(err.Error(), "connection reset by peer") || strings.Contains(err.Error(), "broken pipe") {
			return
		}
		if err == ErrInvalidRange {
			ren.JSON(w, 416, errRes(416, "invalid HTTP Range header boundaries"))
			return
		}
		log.Println("stream: error:", err)
		return
	}
	log.Println("stream: completed:", opStr)
	return
}
GetStream a raw, non-transcoded, media file stream from wavepipe.  On success, this API will
return a binary stream. On failure, it will return a JSON error.
package api
import (
	"database/sql"
	"fmt"
	"log"
	"net/http"
	"strconv"
	"strings"
	"github.com/mdlayher/wavepipe/data"
	"github.com/gorilla/context"
	"github.com/gorilla/mux"
	"github.com/unrolled/render"
)