mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
fix ETag header
VLC will be happy
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package torr
|
package torr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@@ -61,7 +62,7 @@ func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter
|
|||||||
sets.SetViewed(&sets.Viewed{t.Hash().HexString(), fileID})
|
sets.SetViewed(&sets.Viewed{t.Hash().HexString(), fileID})
|
||||||
|
|
||||||
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(), hex.EncodeToString([]byte(file.Path())))))
|
||||||
// DLNA headers
|
// DLNA headers
|
||||||
resp.Header().Set("transferMode.dlna.org", "Streaming")
|
resp.Header().Set("transferMode.dlna.org", "Streaming")
|
||||||
mime, err := mt.MimeTypeByPath(file.Path())
|
mime, err := mt.MimeTypeByPath(file.Path())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -72,7 +73,7 @@ func sendM3U(c *gin.Context, name, hash string, m3u string) {
|
|||||||
c.Header("Content-Type", "audio/x-mpegurl")
|
c.Header("Content-Type", "audio/x-mpegurl")
|
||||||
c.Header("Connection", "close")
|
c.Header("Connection", "close")
|
||||||
if hash != "" {
|
if hash != "" {
|
||||||
c.Header("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", hash, name)))
|
c.Header("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", hash, hex.EncodeToString([]byte(name)))))
|
||||||
}
|
}
|
||||||
if name == "" {
|
if name == "" {
|
||||||
name = "playlist.m3u"
|
name = "playlist.m3u"
|
||||||
|
|||||||
Reference in New Issue
Block a user