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`
|
|
|
|
|
2022-03-25 01:27:42 +03:00
|
|
|
const defaultMaxReadaheadBytes = 20 * 1024 * 1024
|
|
|
|
|
2022-03-20 00:11:19 +03:00
|
|
|
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
|
|
|
|
}
|