mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(lists): integrate Omegabrr (#1885)
* feat(lists): integrate Omegabrr * feat(lists): add missing lists index * feat(lists): add db repo * feat(lists): add db migrations * feat(lists): labels * feat(lists): url lists and more arrs * fix(lists): db migrations client_id wrong type * fix(lists): db fields * feat(lists): create list form wip * feat(lists): show in list and create * feat(lists): update and delete * feat(lists): trigger via webhook * feat(lists): add webhook handler * fix(arr): encode json to pointer * feat(lists): rename endpoint to lists * feat(lists): fetch tags from arr * feat(lists): process plaintext lists * feat(lists): add background refresh job * run every 6th hour with a random start delay between 1-35 seconds * feat(lists): refresh on save and improve logging * feat(lists): cast arr client to pointer * feat(lists): improve error handling * feat(lists): reset shows field with match release * feat(lists): filter opts all lists * feat(lists): trigger on update if enabled * feat(lists): update option for lists * feat(lists): show connected filters in list * feat(lists): missing listSvc dep * feat(lists): cleanup * feat(lists): typo arr list * feat(lists): radarr include original * feat(lists): rename ExcludeAlternateTitle to IncludeAlternateTitle * fix(lists): arr client type conversion to pointer * fix(actions): only log panic recover if err not nil * feat(lists): show spinner on save * feat(lists): show icon in filters list * feat(lists): change icon color in filters list * feat(lists): delete relations on filter delete
This commit is contained in:
parent
b68ae334ca
commit
221bc35371
77 changed files with 5025 additions and 254 deletions
|
@ -15,13 +15,13 @@ import (
|
|||
|
||||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/internal/logger"
|
||||
"github.com/autobrr/autobrr/pkg/arr/lidarr"
|
||||
"github.com/autobrr/autobrr/pkg/arr/radarr"
|
||||
"github.com/autobrr/autobrr/pkg/arr/readarr"
|
||||
"github.com/autobrr/autobrr/pkg/arr/sonarr"
|
||||
"github.com/autobrr/autobrr/pkg/errors"
|
||||
"github.com/autobrr/autobrr/pkg/lidarr"
|
||||
"github.com/autobrr/autobrr/pkg/porla"
|
||||
"github.com/autobrr/autobrr/pkg/radarr"
|
||||
"github.com/autobrr/autobrr/pkg/readarr"
|
||||
"github.com/autobrr/autobrr/pkg/sabnzbd"
|
||||
"github.com/autobrr/autobrr/pkg/sonarr"
|
||||
"github.com/autobrr/autobrr/pkg/transmission"
|
||||
"github.com/autobrr/autobrr/pkg/whisparr"
|
||||
|
||||
|
@ -41,6 +41,7 @@ type Service interface {
|
|||
Delete(ctx context.Context, clientID int32) error
|
||||
Test(ctx context.Context, client domain.DownloadClient) error
|
||||
|
||||
GetArrTags(ctx context.Context, id int32) ([]*domain.ArrTag, error)
|
||||
GetClient(ctx context.Context, clientId int32) (*domain.DownloadClient, error)
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,57 @@ func (s *service) FindByID(ctx context.Context, id int32) (*domain.DownloadClien
|
|||
return client, nil
|
||||
}
|
||||
|
||||
func (s *service) GetArrTags(ctx context.Context, id int32) ([]*domain.ArrTag, error) {
|
||||
data := make([]*domain.ArrTag, 0)
|
||||
|
||||
client, err := s.GetClient(ctx, id)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msgf("could not find download client by id: %v", id)
|
||||
return data, nil
|
||||
}
|
||||
|
||||
switch client.Type {
|
||||
case "RADARR":
|
||||
arrClient := client.Client.(*radarr.Client)
|
||||
tags, err := arrClient.GetTags(ctx)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msgf("could not get tags from radarr: %v", id)
|
||||
return data, nil
|
||||
}
|
||||
|
||||
for _, tag := range tags {
|
||||
emt := &domain.ArrTag{
|
||||
ID: tag.ID,
|
||||
Label: tag.Label,
|
||||
}
|
||||
data = append(data, emt)
|
||||
}
|
||||
|
||||
return data, nil
|
||||
|
||||
case "SONARR":
|
||||
arrClient := client.Client.(*sonarr.Client)
|
||||
tags, err := arrClient.GetTags(ctx)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msgf("could not get tags from sonarr: %v", id)
|
||||
return data, nil
|
||||
}
|
||||
|
||||
for _, tag := range tags {
|
||||
emt := &domain.ArrTag{
|
||||
ID: tag.ID,
|
||||
Label: tag.Label,
|
||||
}
|
||||
data = append(data, emt)
|
||||
}
|
||||
|
||||
return data, nil
|
||||
|
||||
default:
|
||||
return data, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s *service) Store(ctx context.Context, client *domain.DownloadClient) error {
|
||||
// basic validation of client
|
||||
if err := client.Validate(); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue