mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
Merge branch 'master' into new-torrent
This commit is contained in:
@@ -65,7 +65,7 @@ func (t *Torrent) Preload(index int, size int64) {
|
||||
|
||||
// mb5 -> 8/16 MB
|
||||
mb5 := int64(t.Info().PieceLength)
|
||||
if (mb5 < 8 * 1024 * 1024) {
|
||||
if mb5 < 8*1024*1024 {
|
||||
mb5 = 8 * 1024 * 1024
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/anacrolix/dms/dlna"
|
||||
"github.com/anacrolix/missinggo/httptoo"
|
||||
"github.com/anacrolix/torrent"
|
||||
|
||||
@@ -55,11 +56,19 @@ func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter
|
||||
log.Println("Connect client", host, port)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sets.SetViewed(&sets.Viewed{t.Hash().HexString(), fileID})
|
||||
|
||||
resp.Header().Set("Connection", "close")
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user