mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
add searchClass o root obj meta
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/anacrolix/dms/upnpav"
|
||||
|
||||
"server/log"
|
||||
mt "server/mimetype"
|
||||
"server/settings"
|
||||
"server/torr"
|
||||
"server/torr/state"
|
||||
@@ -124,6 +125,11 @@ func getTorrentMeta(path, host string) (ret interface{}) {
|
||||
Title: "TorrServer",
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
Class: "object.container",
|
||||
SearchXML: ` <upnp:searchClass includeDerived="1">object.container</upnp:searchClass>
|
||||
<upnp:searchClass includeDerived="1">object.item.audioItem</upnp:searchClass>
|
||||
<upnp:searchClass includeDerived="1">object.item.imageItem</upnp:searchClass>
|
||||
<upnp:searchClass includeDerived="1">object.item.videoItem</upnp:searchClass>
|
||||
`,
|
||||
}
|
||||
// add Root Object
|
||||
meta := upnpav.Container{Object: rootObj}
|
||||
@@ -134,13 +140,12 @@ func getTorrentMeta(path, host string) (ret interface{}) {
|
||||
ID: "%2FTR",
|
||||
ParentID: "0",
|
||||
Restricted: 1,
|
||||
Searchable: 1,
|
||||
Title: "Torrents",
|
||||
Class: "object.container.storageFolder",
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
Class: "object.container",
|
||||
}
|
||||
//vol := len(torr.ListTorrent())
|
||||
meta := upnpav.Container{Object: trObj}
|
||||
vol := len(torr.ListTorrent())
|
||||
meta := upnpav.Container{Object: trObj, ChildCount: vol}
|
||||
return meta
|
||||
}
|
||||
|
||||
@@ -165,8 +170,8 @@ func getTorrentMeta(path, host string) (ret interface{}) {
|
||||
ParentID: "%2FTR",
|
||||
Restricted: 1,
|
||||
Title: torr.Title,
|
||||
Class: "object.container.storageFolder",
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
Class: "object.container",
|
||||
}
|
||||
meta := upnpav.Container{Object: obj}
|
||||
return meta
|
||||
@@ -180,10 +185,10 @@ func getTorrentMeta(path, host string) (ret interface{}) {
|
||||
ID: parent + "%2FLD",
|
||||
ParentID: parent,
|
||||
Restricted: 1,
|
||||
Searchable: 1,
|
||||
Searchable: 0,
|
||||
Title: "Load Torrents",
|
||||
Class: "object.container.storageFolder",
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
Class: "object.container",
|
||||
}
|
||||
meta := upnpav.Container{Object: obj}
|
||||
return meta
|
||||
@@ -199,16 +204,15 @@ func getTorrentMeta(path, host string) (ret interface{}) {
|
||||
ID: id,
|
||||
ParentID: parent,
|
||||
Restricted: 1,
|
||||
Searchable: 1,
|
||||
Title: file,
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
Class: "object.container",
|
||||
Date: upnpav.Timestamp{Time: time.Now()},
|
||||
}
|
||||
meta := upnpav.Container{Object: obj}
|
||||
return meta
|
||||
}
|
||||
// for error response
|
||||
return nil
|
||||
// nil for error
|
||||
return
|
||||
}
|
||||
|
||||
func loadTorrent(path, host string) (ret []interface{}) {
|
||||
@@ -263,7 +267,7 @@ func getLink(host, path string) string {
|
||||
|
||||
func getObjFromTorrent(path, parent, host string, torr *torr.Torrent, file *state.TorrentFileStat) (ret interface{}) {
|
||||
|
||||
mime, err := MimeTypeByPath(file.Path)
|
||||
mime, err := mt.MimeTypeByPath(file.Path)
|
||||
if err != nil {
|
||||
if settings.BTsets.EnableDebug {
|
||||
log.TLogln("Can't detect mime type", err)
|
||||
|
||||
Reference in New Issue
Block a user