feat: implement seed ratio check logic

This commit is contained in:
Simon Ding
2024-08-01 19:52:40 +08:00
parent 408ff163ef
commit e26e86a63f
5 changed files with 64 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ type Torrent interface {
Remove() error
Save() string
Exists() bool
SeedRatio() *float64
}

View File

@@ -130,6 +130,9 @@ func (t *Torrent) Exists() bool {
}
func (t *Torrent) Name() string {
if !t.Exists() {
return ""
}
return *t.getTorrent().Name
}
@@ -155,6 +158,10 @@ func (t *Torrent) Stop() error {
return t.c.TorrentStopIDs(context.TODO(), []int64{t.ID})
}
func (t *Torrent) SeedRatio() *float64 {
return t.getTorrent().UploadRatio
}
func (t *Torrent) Start() error {
return t.c.TorrentStartIDs(context.TODO(), []int64{t.ID})
}