mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
add No Torrents container and ChildCount prop
This commit is contained in:
@@ -19,7 +19,9 @@ import (
|
|||||||
|
|
||||||
func getTorrents() (ret []interface{}) {
|
func getTorrents() (ret []interface{}) {
|
||||||
torrs := torr.ListTorrent()
|
torrs := torr.ListTorrent()
|
||||||
|
var vol = 0
|
||||||
for _, t := range torrs {
|
for _, t := range torrs {
|
||||||
|
vol++
|
||||||
obj := upnpav.Object{
|
obj := upnpav.Object{
|
||||||
ID: "%2F" + t.TorrentSpec.InfoHash.HexString(),
|
ID: "%2F" + t.TorrentSpec.InfoHash.HexString(),
|
||||||
ParentID: "0",
|
ParentID: "0",
|
||||||
@@ -30,7 +32,19 @@ func getTorrents() (ret []interface{}) {
|
|||||||
AlbumArtURI: t.Poster,
|
AlbumArtURI: t.Poster,
|
||||||
Date: upnpav.Timestamp{Time: time.Now()},
|
Date: upnpav.Timestamp{Time: time.Now()},
|
||||||
}
|
}
|
||||||
cnt := upnpav.Container{Object: obj}
|
cnt := upnpav.Container{Object: obj, ChildCount: 1}
|
||||||
|
ret = append(ret, cnt)
|
||||||
|
}
|
||||||
|
if vol == 0 {
|
||||||
|
obj := upnpav.Object{
|
||||||
|
ID: "%2FNo Torrents",
|
||||||
|
ParentID: "0",
|
||||||
|
Title: "No Torrents",
|
||||||
|
Class: "object.container.storageFolder",
|
||||||
|
Restricted: 1,
|
||||||
|
Date: upnpav.Timestamp{Time: time.Now()},
|
||||||
|
}
|
||||||
|
cnt := upnpav.Container{Object: obj, ChildCount: 1}
|
||||||
ret = append(ret, cnt)
|
ret = append(ret, cnt)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -62,7 +76,7 @@ func getTorrent(path, host string) (ret []interface{}) {
|
|||||||
Restricted: 1,
|
Restricted: 1,
|
||||||
Date: upnpav.Timestamp{Time: time.Now()},
|
Date: upnpav.Timestamp{Time: time.Now()},
|
||||||
}
|
}
|
||||||
cnt := upnpav.Container{Object: obj}
|
cnt := upnpav.Container{Object: obj, ChildCount: 1}
|
||||||
ret = append(ret, cnt)
|
ret = append(ret, cnt)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user