small refactor*
This commit is contained in:
parent
b6b541e050
commit
24a4d30275
232 changed files with 2164 additions and 1906 deletions
plugins/qbittorrent
27
plugins/qbittorrent/api.go
Normal file
27
plugins/qbittorrent/api.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package qbittorrent
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.kmsign.ru/royalcat/tstor/plugins/qbittorrent/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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue