mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00

* feat(web): add and update download client rules * feat: add and update download client rules * feat: add active downloads check * chore: update pkg * feat: deluge max active downloads * feat: use basic rules for deluge * feat: add as paused * refactor: download file if needed * feat: better errors qbit
41 lines
915 B
Go
41 lines
915 B
Go
package release
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
"github.com/autobrr/autobrr/internal/action"
|
|
"github.com/autobrr/autobrr/internal/domain"
|
|
)
|
|
|
|
type Service interface {
|
|
Process(announce domain.Announce) error
|
|
}
|
|
|
|
type service struct {
|
|
actionSvc action.Service
|
|
}
|
|
|
|
func NewService(actionService action.Service) Service {
|
|
return &service{actionSvc: actionService}
|
|
}
|
|
|
|
func (s *service) Process(announce domain.Announce) error {
|
|
log.Trace().Msgf("start to process release: %+v", announce)
|
|
|
|
if announce.Filter.Actions == nil {
|
|
return fmt.Errorf("no actions for filter: %v", announce.Filter.Name)
|
|
}
|
|
|
|
// smart episode?
|
|
|
|
// run actions (watchFolder, test, exec, qBittorrent, Deluge etc.)
|
|
err := s.actionSvc.RunActions(announce.Filter.Actions, announce)
|
|
if err != nil {
|
|
log.Error().Stack().Err(err).Msgf("error running actions for filter: %v", announce.Filter.Name)
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|