2022-03-20 00:11:19 +03:00
|
|
|
package gorrent
|
|
|
|
|
2022-03-24 00:38:29 +03:00
|
|
|
import "context"
|
|
|
|
|
2022-03-20 00:11:19 +03:00
|
|
|
var version = `1.0.0`
|
|
|
|
|
|
|
|
func GetMetaFromFile(path string) (*Info, error) {
|
|
|
|
info := &Info{}
|
|
|
|
if err := info.LoadFile(path); err != nil {
|
|
|
|
return info, err
|
|
|
|
}
|
|
|
|
return info, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func Version() string {
|
|
|
|
return version
|
|
|
|
}
|
2022-03-24 00:38:29 +03:00
|
|
|
|
|
|
|
func NewEngine(settings *Settings) *Engine {
|
|
|
|
e := &Engine{
|
|
|
|
settings: settings,
|
|
|
|
msgs: make(chan string, 50),
|
|
|
|
}
|
|
|
|
e.ctx, e.shutdown = context.WithCancel(context.Background())
|
|
|
|
return e
|
|
|
|
}
|