Handle adds and deletes

This commit is contained in:
Ben Sarmiento
2023-12-06 02:02:01 +01:00
parent 4b8fd82acd
commit 0e471ba42d
5 changed files with 41 additions and 28 deletions

View File

@@ -26,8 +26,8 @@ func HandleListDirectories(torMgr *torrent.TorrentManager) (*string, error) {
return &htmlDoc, nil
}
func HandleListTorrents(directory string, t *torrent.TorrentManager, log *zap.SugaredLogger) (*string, error) {
torrents, ok := t.DirectoryMap.Get(directory)
func HandleListTorrents(directory string, torMgr *torrent.TorrentManager, log *zap.SugaredLogger) (*string, error) {
torrents, ok := torMgr.DirectoryMap.Get(directory)
if !ok {
return nil, fmt.Errorf("cannot find directory %s", directory)
}
@@ -49,8 +49,8 @@ func HandleListTorrents(directory string, t *torrent.TorrentManager, log *zap.Su
return &htmlDoc, nil
}
func HandleListFiles(directory, torrentName string, t *torrent.TorrentManager, log *zap.SugaredLogger) (*string, error) {
torrents, ok := t.DirectoryMap.Get(directory)
func HandleListFiles(directory, torrentName string, torMgr *torrent.TorrentManager, log *zap.SugaredLogger) (*string, error) {
torrents, ok := torMgr.DirectoryMap.Get(directory)
if !ok {
return nil, fmt.Errorf("cannot find directory %s", directory)
}