This commit is contained in:
YouROK
2021-09-08 11:40:04 +03:00
parent 31f50556ec
commit 8f38a35b0f

View File

@@ -27,12 +27,12 @@ func getRoot() (ret []interface{}) {
Restricted: 1, Restricted: 1,
Title: "Torrents", Title: "Torrents",
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
Date: upnpav.Timestamp{Time: time.Now()}, Date: upnpav.Timestamp{Time: time.Now()},
} }
// add Root Object // add Root Object
len := len(torr.ListTorrent()) lenl := len(torr.ListTorrent())
cnt := upnpav.Container{Object: rootObj, ChildCount: len} cnt := upnpav.Container{Object: rootObj, ChildCount: lenl}
ret = append(ret, cnt) ret = append(ret, cnt)
return return
@@ -46,7 +46,7 @@ func getTorrents() (ret []interface{}) {
sort.Slice(torrs, func(i, j int) bool { sort.Slice(torrs, func(i, j int) bool {
return torrs[i].Title < torrs[j].Title return torrs[i].Title < torrs[j].Title
}) })
var vol = 0 var vol = 0
for _, t := range torrs { for _, t := range torrs {
vol++ vol++
@@ -58,7 +58,7 @@ func getTorrents() (ret []interface{}) {
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
Icon: t.Poster, Icon: t.Poster,
AlbumArtURI: t.Poster, AlbumArtURI: t.Poster,
Date: upnpav.Timestamp{Time: time.Now()}, Date: upnpav.Timestamp{Time: time.Now()},
} }
cnt := upnpav.Container{Object: obj, ChildCount: 1} cnt := upnpav.Container{Object: obj, ChildCount: 1}
ret = append(ret, cnt) ret = append(ret, cnt)
@@ -70,7 +70,7 @@ func getTorrents() (ret []interface{}) {
Restricted: 1, Restricted: 1,
Title: "No Torrents", Title: "No Torrents",
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
Date: upnpav.Timestamp{Time: time.Now()}, Date: upnpav.Timestamp{Time: time.Now()},
} }
cnt := upnpav.Container{Object: obj, ChildCount: 1} cnt := upnpav.Container{Object: obj, ChildCount: 1}
ret = append(ret, cnt) ret = append(ret, cnt)
@@ -103,7 +103,7 @@ func getTorrent(path, host string) (ret []interface{}) {
Restricted: 1, Restricted: 1,
Title: "Load Torrent", Title: "Load Torrent",
Class: "object.container.storageFolder", Class: "object.container.storageFolder",
Date: upnpav.Timestamp{Time: time.Now()}, Date: upnpav.Timestamp{Time: time.Now()},
} }
cnt := upnpav.Container{Object: obj, ChildCount: 1} cnt := upnpav.Container{Object: obj, ChildCount: 1}
ret = append(ret, cnt) ret = append(ret, cnt)
@@ -187,7 +187,7 @@ func getObjFromTorrent(path, parent, host string, torr *torr.Torrent, file *stat
Restricted: 1, Restricted: 1,
Title: file.Path, Title: file.Path,
Class: "object.item." + mime.Type() + "Item", Class: "object.item." + mime.Type() + "Item",
Date: upnpav.Timestamp{Time: time.Now()}, Date: upnpav.Timestamp{Time: time.Now()},
} }
item := upnpav.Item{ item := upnpav.Item{
@@ -199,7 +199,7 @@ func getObjFromTorrent(path, parent, host string, torr *torr.Torrent, file *stat
URL: getLink(host, pathPlay), URL: getLink(host, pathPlay),
ProtocolInfo: fmt.Sprintf("http-get:*:%s:%s", mime, dlna.ContentFeatures{ ProtocolInfo: fmt.Sprintf("http-get:*:%s:%s", mime, dlna.ContentFeatures{
SupportTimeSeek: true, SupportTimeSeek: true,
SupportRange: true, SupportRange: true,
}.String()), }.String()),
Size: uint64(file.Length), Size: uint64(file.Length),
}) })