mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 05:26:09 +05:00
DLNA: don't err for root obj meta
and swap icons order
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/anacrolix/dms/dlna/dms"
|
||||
"github.com/anacrolix/dms/upnpav"
|
||||
|
||||
"server/log"
|
||||
"server/web/pages/template"
|
||||
@@ -41,20 +42,6 @@ func Start() {
|
||||
NoProbe: true,
|
||||
StallEventSubscribe: true,
|
||||
Icons: []dms.Icon{
|
||||
dms.Icon{
|
||||
Width: 48,
|
||||
Height: 48,
|
||||
Depth: 24,
|
||||
Mimetype: "image/png",
|
||||
ReadSeeker: bytes.NewReader(template.Dlnaicon48png),
|
||||
},
|
||||
dms.Icon{
|
||||
Width: 120,
|
||||
Height: 120,
|
||||
Depth: 24,
|
||||
Mimetype: "image/png",
|
||||
ReadSeeker: bytes.NewReader(template.Dlnaicon120png),
|
||||
},
|
||||
dms.Icon{
|
||||
Width: 48,
|
||||
Height: 48,
|
||||
@@ -69,6 +56,20 @@ func Start() {
|
||||
Mimetype: "image/jpeg",
|
||||
ReadSeeker: bytes.NewReader(template.Dlnaicon120jpg),
|
||||
},
|
||||
dms.Icon{
|
||||
Width: 48,
|
||||
Height: 48,
|
||||
Depth: 24,
|
||||
Mimetype: "image/png",
|
||||
ReadSeeker: bytes.NewReader(template.Dlnaicon48png),
|
||||
},
|
||||
dms.Icon{
|
||||
Width: 120,
|
||||
Height: 120,
|
||||
Depth: 24,
|
||||
Mimetype: "image/png",
|
||||
ReadSeeker: bytes.NewReader(template.Dlnaicon120png),
|
||||
},
|
||||
},
|
||||
NotifyInterval: 30 * time.Second,
|
||||
AllowedIpNets: func() []*net.IPNet {
|
||||
@@ -119,6 +120,20 @@ func onBrowse(path, rootObjectPath, host, userAgent string) (ret []interface{},
|
||||
}
|
||||
|
||||
func onBrowseMeta(path string, rootObjectPath string, host, userAgent string) (ret interface{}, err error) {
|
||||
if path == "/" {
|
||||
// Root Object Meta
|
||||
rootObj := upnpav.Object{
|
||||
ID: "0",
|
||||
ParentID: "-1",
|
||||
Restricted: 1,
|
||||
Searchable: 1,
|
||||
Title: "TorrServer",
|
||||
Class: "object.container.storageFolder",
|
||||
}
|
||||
// add Root Object
|
||||
ret = upnpav.Container{Object: rootObj, ChildCount: 1}
|
||||
return
|
||||
}
|
||||
err = fmt.Errorf("not implemented")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import (
|
||||
|
||||
func getRoot() (ret []interface{}) {
|
||||
|
||||
// Root Object
|
||||
rootObj := upnpav.Object{
|
||||
// Torrents Object
|
||||
tObj := upnpav.Object{
|
||||
ID: "%2FTR",
|
||||
ParentID: "0",
|
||||
Restricted: 1,
|
||||
@@ -30,9 +30,9 @@ func getRoot() (ret []interface{}) {
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
}
|
||||
|
||||
// add Root Object
|
||||
lenl := len(torr.ListTorrent())
|
||||
cnt := upnpav.Container{Object: rootObj, ChildCount: lenl}
|
||||
// add Torrents Object
|
||||
vol := len(torr.ListTorrent())
|
||||
cnt := upnpav.Container{Object: tObj, ChildCount: vol}
|
||||
ret = append(ret, cnt)
|
||||
|
||||
return
|
||||
@@ -74,7 +74,6 @@ func getTorrents() (ret []interface{}) {
|
||||
}
|
||||
cnt := upnpav.Container{Object: obj, ChildCount: 1}
|
||||
ret = append(ret, cnt)
|
||||
vol = 1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ module server
|
||||
go 1.17
|
||||
|
||||
replace (
|
||||
github.com/anacrolix/dms v1.2.2 => github.com/tsynik/dms v0.0.0-20210908102802-d5d0f568fcbb
|
||||
github.com/anacrolix/dms v1.2.2 => github.com/tsynik/dms v0.0.0-20210909053938-38af4173d4ac
|
||||
github.com/anacrolix/torrent v1.31.0 => github.com/tsynik/torrent v1.2.7-0.20210907192509-2141ede9aa09
|
||||
)
|
||||
|
||||
|
||||
@@ -678,8 +678,8 @@ github.com/tinylib/msgp v1.1.1/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDW
|
||||
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/tsynik/dms v0.0.0-20210908102802-d5d0f568fcbb h1:Oc8uYDfJzQE21RRXw3DJnDYCoKxr1AmjL/yxKPP69/Y=
|
||||
github.com/tsynik/dms v0.0.0-20210908102802-d5d0f568fcbb/go.mod h1:1GqMUla/yTV3GFjpKMpmdntkTl6aslGK3jfIksEwIdI=
|
||||
github.com/tsynik/dms v0.0.0-20210909053938-38af4173d4ac h1:1JLBJz2aGJhQ6ZR+zJWl68/0DLJkr+E3E74HEzOFOjw=
|
||||
github.com/tsynik/dms v0.0.0-20210909053938-38af4173d4ac/go.mod h1:oWW4QbQ9YGl+FJ1X8xcrUYVObfA/KdipoeBuTC4ltG8=
|
||||
github.com/tsynik/torrent v1.2.7-0.20210907192509-2141ede9aa09 h1:GHhNKxddZiYrWeiXqMQiPKcSIXKF+o/w1wrqHOgOFrk=
|
||||
github.com/tsynik/torrent v1.2.7-0.20210907192509-2141ede9aa09/go.mod h1:E9gvoHzc58EtTudJbzZ2Ho7SKDCYk84734hB9ztBJS4=
|
||||
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
|
||||
@@ -863,10 +863,10 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
||||
Reference in New Issue
Block a user