Add VidHub endpoints
This commit is contained in:
@@ -12,6 +12,9 @@ import (
|
||||
"github.com/debridmediamanager/zurg/pkg/dav"
|
||||
)
|
||||
|
||||
// ServeRootDirectoryForInfuse serves the root directory for Infuse
|
||||
// There is no root directory, just the directories e.g. movies
|
||||
// Actual path is based on configured base path and current directory
|
||||
func ServeRootDirectoryForInfuse(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||
@@ -23,10 +26,10 @@ func ServeRootDirectoryForInfuse(torMgr *torrent.TorrentManager) ([]byte, error)
|
||||
if strings.HasPrefix(directory, "int__") {
|
||||
continue
|
||||
}
|
||||
buf.WriteString(dav.BaseDirectory(directory, ""))
|
||||
buf.WriteString(dav.Directory(directory, ""))
|
||||
}
|
||||
|
||||
buf.WriteString(dav.BaseDirectory(config.DOWNLOADS, ""))
|
||||
buf.WriteString(dav.Directory(config.DOWNLOADS, ""))
|
||||
|
||||
_, size := version.GetFile()
|
||||
buf.WriteString(dav.File(version.FILE, size, ""))
|
||||
@@ -35,7 +38,7 @@ func ServeRootDirectoryForInfuse(torMgr *torrent.TorrentManager) ([]byte, error)
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func ServeTorrentsListForInfuse(directory string, torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
func ServeGroupDirectoryForInfuse(directory string, torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
@@ -52,14 +55,14 @@ func ServeTorrentsListForInfuse(directory string, torMgr *torrent.TorrentManager
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
buf.WriteString(dav.BaseDirectory(torMgr.GetKey(tor), tor.Added))
|
||||
buf.WriteString(dav.Directory(torMgr.GetKey(tor), tor.Added))
|
||||
}
|
||||
|
||||
buf.WriteString("</d:multistatus>")
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.TorrentManager, shouldHideBrokenTorrents bool) ([]byte, error) {
|
||||
func ServeTorrentFilesForInfuse(directory, torrentName string, torMgr *torrent.TorrentManager, shouldHideBrokenTorrents bool) ([]byte, error) {
|
||||
torrents, ok := torMgr.DirectoryMap.Get(directory)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("cannot find directory %s", directory)
|
||||
@@ -107,7 +110,7 @@ func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.Torr
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
func ServeDownloadsListForInfuse(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
func ServeDownloadsForInfuse(torMgr *torrent.TorrentManager) ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
|
||||
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
|
||||
|
||||
Reference in New Issue
Block a user