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
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ urls:
|
|||
privacy: private
|
||||
protocol: torrent
|
||||
supports:
|
||||
- api
|
||||
- irc
|
||||
- rss
|
||||
source: gazelle
|
||||
|
@ -19,6 +20,24 @@ settings:
|
|||
label: Torrent pass
|
||||
help: Right click DL on a torrent and get the torrent_pass.
|
||||
|
||||
- name: api_key
|
||||
type: secret
|
||||
required: true
|
||||
label: API Key
|
||||
help: Settings -> Access Settings -> API Keys - Create a new api token.
|
||||
|
||||
api:
|
||||
url: https://orpheus.network/ajax.php
|
||||
type: json
|
||||
limits:
|
||||
max: 5
|
||||
per: 10 seconds
|
||||
settings:
|
||||
- name: api_key
|
||||
type: secret
|
||||
label: API Key
|
||||
help: Settings -> Access Settings -> API Keys - Create a new api token.
|
||||
|
||||
irc:
|
||||
network: Orpheus
|
||||
server: irc.orpheus.network
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue