mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge branch 'master' into old-engine
This commit is contained in:
@@ -112,19 +112,6 @@ func getTorrent(path, host string) (ret []interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getTorrentMeta(path, host string) (ret interface{}) {
|
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
|
// Meta object
|
||||||
if path == "/" {
|
if path == "/" {
|
||||||
// root object meta
|
// root object meta
|
||||||
@@ -150,10 +137,23 @@ func getTorrentMeta(path, host string) (ret interface{}) {
|
|||||||
Date: upnpav.Timestamp{Time: time.Now()},
|
Date: upnpav.Timestamp{Time: time.Now()},
|
||||||
Class: "object.container.storageFolder",
|
Class: "object.container.storageFolder",
|
||||||
}
|
}
|
||||||
|
torrs := torr.ListTorrent()
|
||||||
vol := len(torrs)
|
vol := len(torrs)
|
||||||
meta := upnpav.Container{Object: trObj, ChildCount: vol}
|
meta := upnpav.Container{Object: trObj, ChildCount: vol}
|
||||||
return meta
|
return meta
|
||||||
} else if isHashPath(path) {
|
} else if isHashPath(path) {
|
||||||
|
// 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
|
||||||
|
}
|
||||||
// hash object meta
|
// hash object meta
|
||||||
obj := upnpav.Object{
|
obj := upnpav.Object{
|
||||||
ID: "%2F" + torr.TorrentSpec.InfoHash.HexString(),
|
ID: "%2F" + torr.TorrentSpec.InfoHash.HexString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user