mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-08 02:57:38 +08:00
misc update
This commit is contained in:
@@ -7,6 +7,7 @@ type Torrent interface {
|
||||
Start() error
|
||||
Remove() error
|
||||
Save() string
|
||||
Exists() bool
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,14 @@ func (t *Torrent) getTorrent() transmissionrpc.Torrent {
|
||||
return r[0]
|
||||
}
|
||||
|
||||
func (t *Torrent) Exists() bool {
|
||||
r, err := t.c.TorrentGetAllFor(context.TODO(), []int64{t.id})
|
||||
if err != nil {
|
||||
log.Errorf("get torrent info for error: %v", err)
|
||||
}
|
||||
return len(r) > 0
|
||||
}
|
||||
|
||||
func (t *Torrent) Name() string {
|
||||
return *t.getTorrent().Name
|
||||
}
|
||||
@@ -91,3 +99,4 @@ func (t *Torrent) Remove() error {
|
||||
func (t *Torrent) Save() string {
|
||||
return strconv.Itoa(int(t.id))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user