mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(indexers): add API support for Orpheus to fetch size (#944)
* feat(indexers): add API support for Orpheus * feat(filters): add ops to AdditionalSizeCheck
This commit is contained in:
parent
8bef297841
commit
8925266104
9 changed files with 481 additions and 3 deletions
|
@ -6,16 +6,17 @@ package indexer
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/internal/logger"
|
||||
"github.com/autobrr/autobrr/internal/mock"
|
||||
"github.com/autobrr/autobrr/pkg/btn"
|
||||
"github.com/autobrr/autobrr/pkg/errors"
|
||||
"github.com/autobrr/autobrr/pkg/ggn"
|
||||
"github.com/autobrr/autobrr/pkg/ops"
|
||||
"github.com/autobrr/autobrr/pkg/ptp"
|
||||
"github.com/autobrr/autobrr/pkg/red"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type APIService interface {
|
||||
|
@ -115,6 +116,13 @@ func (s *apiService) AddClient(indexer string, settings map[string]string) error
|
|||
}
|
||||
s.apiClients[indexer] = red.NewClient(key)
|
||||
|
||||
case "ops":
|
||||
key, ok := settings["api_key"]
|
||||
if !ok || key == "" {
|
||||
return errors.New("api.Service.AddClient: could not initialize orpheus client: missing var 'api_key'")
|
||||
}
|
||||
s.apiClients[indexer] = ops.NewClient(key)
|
||||
|
||||
case "mock":
|
||||
s.apiClients[indexer] = mock.NewMockClient("", "mock")
|
||||
|
||||
|
@ -166,6 +174,12 @@ func (s *apiService) getClientForTest(req domain.IndexerTestApiRequest) (apiClie
|
|||
}
|
||||
return red.NewClient(req.ApiKey), nil
|
||||
|
||||
case "ops":
|
||||
if req.ApiKey == "" {
|
||||
return nil, errors.New("api.Service.AddClient: could not initialize orpheus client: missing var 'api_key'")
|
||||
}
|
||||
return ops.NewClient(req.ApiKey), nil
|
||||
|
||||
case "mock":
|
||||
return mock.NewMockClient("", "mock"), nil
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue