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

@@ -113,6 +113,35 @@ func getTorrent(path, host string) (ret []interface{}) {
return
}
func getTorrentMeta(path, host string) (ret interface{}) {
// find torrent without load
torrs := torr.ListTorrent()
var torr *torr.Torrent
for _, t := range torrs {
if strings.Contains(path, t.TorrentSpec.InfoHash.HexString()) {
torr = t
break
}
}
if torr == nil {
return nil
}
// Meta object
obj := upnpav.Object{
ID: "%2F" + torr.TorrentSpec.InfoHash.HexString(),
ParentID: "%2FTR",
Restricted: 1,
Title: torr.Title,
Class: "object.container.storageFolder",
Date: upnpav.Timestamp{Time: time.Now()},
}
meta := upnpav.Container{Object: obj, ChildCount: 1}
return meta
}
func loadTorrent(path, host string) (ret []interface{}) {
hash := filepath.Base(filepath.Dir(path))
if hash == "/" {