From 4d22d8f13192d55d3a06feec3df6f1f153b97366 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Tue, 7 Sep 2021 10:34:28 +0300 Subject: [PATCH] fix DLNA IDs --- server/dlna/dlna.go | 4 ++-- server/dlna/list.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/dlna/dlna.go b/server/dlna/dlna.go index b4bd600..062d82c 100644 --- a/server/dlna/dlna.go +++ b/server/dlna/dlna.go @@ -92,13 +92,13 @@ func onBrowse(path, rootObjectPath, host, userAgent string) (ret []interface{}, if path == "/" { ret = getRoot() return - } else if path == "/Torrents" { + } else if path == "/TR" { ret = getTorrents() return } else if isHashPath(path) { ret = getTorrent(path, host) return - } else if filepath.Base(path) == "Load Torrent" { + } else if filepath.Base(path) == "LD" { ret = loadTorrent(path, host) } return diff --git a/server/dlna/list.go b/server/dlna/list.go index 7942183..23bf9cd 100644 --- a/server/dlna/list.go +++ b/server/dlna/list.go @@ -22,7 +22,7 @@ func getRoot() (ret []interface{}) { // Root Object rootObj := upnpav.Object{ - ID: "%2FTorrents", + ID: "%2FTR", ParentID: "0", Title: "Torrents", Class: "object.container.storageFolder", @@ -52,7 +52,7 @@ func getTorrents() (ret []interface{}) { vol++ obj := upnpav.Object{ ID: "%2F" + t.TorrentSpec.InfoHash.HexString(), - ParentID: "%2FTorrents", + ParentID: "%2FTR", Title: t.Title, Class: "object.container.storageFolder", Restricted: 1, @@ -65,8 +65,8 @@ func getTorrents() (ret []interface{}) { } if vol == 0 { obj := upnpav.Object{ - ID: "%2FNo Torrents", - ParentID: "%2FTorrents", + ID: "%2FNT", + ParentID: "%2FTR", Title: "No Torrents", Class: "object.container.storageFolder", Restricted: 1, @@ -98,7 +98,7 @@ func getTorrent(path, host string) (ret []interface{}) { // if torrent not loaded, get button for load if torr.Files() == nil { obj := upnpav.Object{ - ID: parent + "%2FLoad Torrent", + ID: parent + "%2FLD", ParentID: parent, Title: "Load Torrent", Class: "object.container.storageFolder", @@ -181,7 +181,7 @@ func getObjFromTorrent(path, parent, host string, torr *torr.Torrent, file *stat } obj := upnpav.Object{ - ID: parent + "%2F" + file.Path, + ID: url.PathEscape(parent + "/" + file.Path), ParentID: parent, Title: file.Path, Class: "object.item." + mime.Type() + "Item",