mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
add dlna header
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/anacrolix/dms/dlna"
|
||||||
"github.com/anacrolix/missinggo/httptoo"
|
"github.com/anacrolix/missinggo/httptoo"
|
||||||
"github.com/anacrolix/torrent"
|
"github.com/anacrolix/torrent"
|
||||||
|
|
||||||
@@ -60,6 +61,14 @@ func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter
|
|||||||
|
|
||||||
resp.Header().Set("Connection", "close")
|
resp.Header().Set("Connection", "close")
|
||||||
resp.Header().Set("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", t.Hash().HexString(), file.Path())))
|
resp.Header().Set("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", t.Hash().HexString(), file.Path())))
|
||||||
|
resp.Header().Set("transferMode.dlna.org", "Streaming")
|
||||||
|
|
||||||
|
if req.Header.Get("getContentFeatures.dlna.org") != "" {
|
||||||
|
resp.Header().Set("contentFeatures.dlna.org", dlna.ContentFeatures{
|
||||||
|
SupportRange: true,
|
||||||
|
SupportTimeSeek: true,
|
||||||
|
}.String())
|
||||||
|
}
|
||||||
|
|
||||||
http.ServeContent(resp, req, file.Path(), time.Unix(t.Timestamp, 0), reader)
|
http.ServeContent(resp, req, file.Path(), time.Unix(t.Timestamp, 0), reader)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user