update meta for samsung tvs

This commit is contained in:
nikk gitanes
2021-09-11 20:29:07 +03:00
parent 1a1c32ec25
commit 0fb9c74798
3 changed files with 49 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/anacrolix/dms/upnpav"
"server/log"
"server/torr"
"server/web/pages/template"
)
@@ -121,7 +122,6 @@ 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",
@@ -134,8 +134,25 @@ func onBrowseMeta(path string, rootObjectPath string, host, userAgent string) (r
// add Root Object
ret = upnpav.Container{Object: rootObj, ChildCount: 1}
return
} else if path == "/TR" {
// Torrents Object Meta
trObj := upnpav.Object{
ID: "%2FR",
ParentID: "0",
Restricted: 1,
Searchable: 1,
Title: "Torrents",
Date: upnpav.Timestamp{Time: time.Now()},
Class: "object.container.storageFolder",
}
vol := len(torr.ListTorrent())
ret = upnpav.Container{Object: trObj, ChildCount: vol}
return
} else if isHashPath(path) {
ret = getTorrentMeta(path, host)
return
}
err = fmt.Errorf("not implemented")
// err = fmt.Errorf("not implemented")
return
}