fix DLNA IDs

This commit is contained in:
nikk gitanes
2021-09-07 10:34:28 +03:00
parent 6d499aa655
commit 4d22d8f131
2 changed files with 8 additions and 8 deletions

View File

@@ -92,13 +92,13 @@ func onBrowse(path, rootObjectPath, host, userAgent string) (ret []interface{},
if path == "/" { if path == "/" {
ret = getRoot() ret = getRoot()
return return
} else if path == "/Torrents" { } else if path == "/TR" {
ret = getTorrents() ret = getTorrents()
return return
} else if isHashPath(path) { } else if isHashPath(path) {
ret = getTorrent(path, host) ret = getTorrent(path, host)
return return
} else if filepath.Base(path) == "Load Torrent" { } else if filepath.Base(path) == "LD" {
ret = loadTorrent(path, host) ret = loadTorrent(path, host)
} }
return return

View File

@@ -22,7 +22,7 @@ func getRoot() (ret []interface{}) {
// Root Object // Root Object
rootObj := upnpav.Object{ rootObj := upnpav.Object{
ID: "%2FTorrents", ID: "%2FTR",
ParentID: "0", ParentID: "0",
Title: "Torrents", Title: "Torrents",
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
@@ -52,7 +52,7 @@ func getTorrents() (ret []interface{}) {
vol++ vol++
obj := upnpav.Object{ obj := upnpav.Object{
ID: "%2F" + t.TorrentSpec.InfoHash.HexString(), ID: "%2F" + t.TorrentSpec.InfoHash.HexString(),
ParentID: "%2FTorrents", ParentID: "%2FTR",
Title: t.Title, Title: t.Title,
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
Restricted: 1, Restricted: 1,
@@ -65,8 +65,8 @@ func getTorrents() (ret []interface{}) {
} }
if vol == 0 { if vol == 0 {
obj := upnpav.Object{ obj := upnpav.Object{
ID: "%2FNo Torrents", ID: "%2FNT",
ParentID: "%2FTorrents", ParentID: "%2FTR",
Title: "No Torrents", Title: "No Torrents",
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
Restricted: 1, Restricted: 1,
@@ -98,7 +98,7 @@ func getTorrent(path, host string) (ret []interface{}) {
// if torrent not loaded, get button for load // if torrent not loaded, get button for load
if torr.Files() == nil { if torr.Files() == nil {
obj := upnpav.Object{ obj := upnpav.Object{
ID: parent + "%2FLoad Torrent", ID: parent + "%2FLD",
ParentID: parent, ParentID: parent,
Title: "Load Torrent", Title: "Load Torrent",
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
@@ -181,7 +181,7 @@ func getObjFromTorrent(path, parent, host string, torr *torr.Torrent, file *stat
} }
obj := upnpav.Object{ obj := upnpav.Object{
ID: parent + "%2F" + file.Path, ID: url.PathEscape(parent + "/" + file.Path),
ParentID: parent, ParentID: parent,
Title: file.Path, Title: file.Path,
Class: "object.item." + mime.Type() + "Item", Class: "object.item." + mime.Type() + "Item",