Change observability service ports and add Arrtrix content management
- Update ports for Alloy, Grafana, Loki, Prometheus, Promtail, Tempo, and Uptime Kuma to new ranges - Add Arrtrix content management commands and subscriptions - Implement Radarr and Sonarr client logic for movie and series management - Add matrix commands for download and subscription management - Add subscription repository with database schema and logic - Update Arrtrix config and example config for content section - Update help text and command processor to include new commands - Update vendor hash for Arrtrix package
This commit is contained in:
parent
9b93f017b6
commit
e26e25b566
24 changed files with 1340 additions and 82 deletions
|
|
@ -8,13 +8,23 @@ import (
|
|||
up "go.mau.fi/util/configupgrade"
|
||||
"maunium.net/go/mautrix/bridgev2"
|
||||
|
||||
"sneeuwvlok/packages/arrtrix/pkg/arr"
|
||||
"sneeuwvlok/packages/arrtrix/pkg/arrclient"
|
||||
"sneeuwvlok/packages/arrtrix/pkg/subscriptions"
|
||||
"sneeuwvlok/packages/arrtrix/pkg/webhook"
|
||||
)
|
||||
|
||||
//go:embed example-config.yaml
|
||||
var ExampleConfig string
|
||||
|
||||
type Config struct{}
|
||||
type Config struct {
|
||||
Content ContentConfig `yaml:"content"`
|
||||
}
|
||||
|
||||
type ContentConfig struct {
|
||||
Movies arrclient.RadarrConfig `yaml:"movies"`
|
||||
Series arrclient.SonarrConfig `yaml:"series"`
|
||||
}
|
||||
|
||||
func upgradeConfig(helper up.Helper) {}
|
||||
|
||||
|
|
@ -23,6 +33,14 @@ func (s *ArrtrixConnector) GetConfig() (string, any, up.Upgrader) {
|
|||
}
|
||||
|
||||
func (s *ArrtrixConnector) ValidateConfig() error {
|
||||
s.Config.Content.Movies.ApplyDefaults()
|
||||
s.Config.Content.Series.ApplyDefaults()
|
||||
if err := s.Config.Content.Movies.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Config.Content.Series.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +48,27 @@ func (s *ArrtrixConnector) MountRoutes(router *http.ServeMux) error {
|
|||
if s.Bridge == nil {
|
||||
return fmt.Errorf("bridge is not initialized")
|
||||
}
|
||||
return webhook.MountArr(router, s.Bridge)
|
||||
return webhook.MountArr(router, s.Bridge, s.Subscriptions())
|
||||
}
|
||||
|
||||
var _ bridgev2.ConfigValidatingNetwork = (*ArrtrixConnector)(nil)
|
||||
var _ webhook.SubscriptionFilter = (*subscriptions.Repository)(nil)
|
||||
|
||||
func (c ContentConfig) Client(contentType arr.ContentType) (arrclient.Client, bool, error) {
|
||||
switch contentType {
|
||||
case arr.ContentTypeMovies:
|
||||
if !c.Movies.Enabled() {
|
||||
return nil, false, nil
|
||||
}
|
||||
client, err := arrclient.NewRadarrClient(c.Movies)
|
||||
return client, true, err
|
||||
case arr.ContentTypeSeries:
|
||||
if !c.Series.Enabled() {
|
||||
return nil, false, nil
|
||||
}
|
||||
client, err := arrclient.NewSonarrClient(c.Series)
|
||||
return client, true, err
|
||||
default:
|
||||
return nil, false, fmt.Errorf("unsupported content type %q", contentType)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue