31 lines
543 B
Go
31 lines
543 B
Go
package app
|
|
|
|
import "github.com/veggiedefender/torrent-client/internal/torrent"
|
|
|
|
type Controller struct {
|
|
engine *torrent.Engine
|
|
}
|
|
|
|
func NewController() *Controller {
|
|
engine := torrent.NewEngine()
|
|
|
|
return &Controller{
|
|
engine: engine,
|
|
}
|
|
}
|
|
|
|
func (c *Controller) StartTorrent(path string) error {
|
|
return c.engine.LoadTorrent(path)
|
|
}
|
|
|
|
func (c *Controller) StopTorrent() {
|
|
c.engine.Stop()
|
|
}
|
|
|
|
func (c *Controller) Progress() float64 {
|
|
return c.engine.Progress()
|
|
}
|
|
|
|
func (c *Controller) Status() torrent.Status {
|
|
return c.engine.Status()
|
|
}
|