tstor/src/daemons/qbittorrent/api.go
royalcat ff38d10fbf
Some checks failed
docker / build-docker (push) Failing after 29s
rename daemons
2024-10-27 01:19:16 +03:00

27 lines
546 B
Go

package qbittorrent
import (
"context"
"git.kmsign.ru/royalcat/tstor/pkg/qbittorrent"
)
func (d *Daemon) ListTorrents(ctx context.Context) ([]*qbittorrent.TorrentInfo, error) {
return d.client.qb.Torrent().GetTorrents(ctx, &qbittorrent.TorrentOption{})
}
func (d *Daemon) SourceFiles(ctx context.Context, hash string) ([]string, error) {
d.sourceFilesMu.Lock()
defer d.sourceFilesMu.Unlock()
out := make([]string, 0, 1)
for k, h := range d.sourceFiles {
if h != hash {
continue
}
out = append(out, k)
}
return out, nil
}