qbittorrent source files

This commit is contained in:
royalcat 2024-10-19 04:24:14 +03:00
parent 63e63c1c37
commit aa0affb019
30 changed files with 1338 additions and 242 deletions
cmd/tstor

View file

@ -17,6 +17,7 @@ import (
wnfs "git.kmsign.ru/royalcat/tstor/pkg/go-nfs"
"git.kmsign.ru/royalcat/tstor/pkg/rlog"
"git.kmsign.ru/royalcat/tstor/src/config"
"git.kmsign.ru/royalcat/tstor/src/delivery"
"git.kmsign.ru/royalcat/tstor/src/sources"
"git.kmsign.ru/royalcat/tstor/src/sources/qbittorrent"
"git.kmsign.ru/royalcat/tstor/src/sources/ytdlp"
@ -103,14 +104,14 @@ func run(configPath string) error {
return err
}
qtsrv, err := qbittorrent.NewDaemon(conf.Sources.QBittorrent)
qtdaemon, err := qbittorrent.NewDaemon(conf.Sources.QBittorrent)
if err != nil {
return fmt.Errorf("error creating qbittorrent daemon: %w", err)
}
sfs := sources.NewHostedFS(
vfs.NewCtxBillyFs("/", ctxbilly.WrapFileSystem(sourceFs)),
qtsrv, ytdlpsrv,
qtdaemon, ytdlpsrv,
)
sfs, err = vfs.WrapLogFS(sfs)
if err != nil {
@ -187,12 +188,19 @@ func run(configPath string) error {
}
}()
go func() {
err := delivery.Run(nil, qtdaemon, sfs, conf)
if err != nil {
log.Error(ctx, "error initializing HTTP server", rlog.Error(err))
}
}()
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
<-sigChan
return errors.Join(
// tsrv.Close(ctx),
qtsrv.Close(ctx),
qtdaemon.Close(ctx),
)
}