Refactor routing

This commit is contained in:
Ben Sarmiento
2023-12-12 08:26:39 +01:00
parent 1661857194
commit 72d017682d
6 changed files with 62 additions and 62 deletions

View File

@@ -12,7 +12,7 @@ import (
"github.com/debridmediamanager/zurg/pkg/logutil"
)
func HandleInfuseListDirectories(torMgr *torrent.TorrentManager) ([]byte, error) {
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:\">")
directories := torMgr.DirectoryMap.Keys()
@@ -27,7 +27,7 @@ func HandleInfuseListDirectories(torMgr *torrent.TorrentManager) ([]byte, error)
return buf.Bytes(), nil
}
func HandleInfuseListTorrents(directory string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
func ServeTorrentsListForInfuse(directory string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
torrents, ok := torMgr.DirectoryMap.Get(directory)
if !ok {
return nil, fmt.Errorf("cannot find directory %s", directory)
@@ -48,7 +48,7 @@ func HandleInfuseListTorrents(directory string, torMgr *torrent.TorrentManager,
return buf.Bytes(), nil
}
func HandleInfuseListFiles(directory, torrentName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.TorrentManager, log *logutil.Logger) ([]byte, error) {
torrents, ok := torMgr.DirectoryMap.Get(directory)
if !ok {
return nil, fmt.Errorf("cannot find directory %s", directory)