mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
Add support for using freeleech tokens if available
This commit is contained in:
parent
74f777340e
commit
1242c19883
21 changed files with 88 additions and 34 deletions
|
@ -20,13 +20,13 @@ import (
|
|||
|
||||
type APIService interface {
|
||||
TestConnection(ctx context.Context, req domain.IndexerTestApiRequest) (bool, error)
|
||||
GetTorrentByID(ctx context.Context, indexer string, torrentID string) (*domain.TorrentBasic, error)
|
||||
GetTorrentByID(ctx context.Context, indexer string, torrentID string, freeleechToken bool) (*domain.TorrentBasic, error)
|
||||
AddClient(indexer string, settings map[string]string) error
|
||||
RemoveClient(indexer string) error
|
||||
}
|
||||
|
||||
type apiClient interface {
|
||||
GetTorrentByID(ctx context.Context, torrentID string) (*domain.TorrentBasic, error)
|
||||
GetTorrentByID(ctx context.Context, torrentID string, freeleechToken bool) (*domain.TorrentBasic, error)
|
||||
TestAPI(ctx context.Context) (bool, error)
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ func NewAPIService(log logger.Logger) APIService {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *apiService) GetTorrentByID(ctx context.Context, indexer string, torrentID string) (*domain.TorrentBasic, error) {
|
||||
func (s *apiService) GetTorrentByID(ctx context.Context, indexer string, torrentID string, freeleechToken bool) (*domain.TorrentBasic, error) {
|
||||
client, err := s.getApiClient(indexer)
|
||||
if err != nil {
|
||||
s.log.Error().Stack().Err(err).Msgf("could not get api client for: %s", indexer)
|
||||
|
@ -51,7 +51,7 @@ func (s *apiService) GetTorrentByID(ctx context.Context, indexer string, torrent
|
|||
|
||||
s.log.Trace().Str("method", "GetTorrentByID").Msgf("%s fetching torrent from api...", indexer)
|
||||
|
||||
torrent, err := client.GetTorrentByID(ctx, torrentID)
|
||||
torrent, err := client.GetTorrentByID(ctx, torrentID, freeleechToken)
|
||||
if err != nil {
|
||||
s.log.Error().Stack().Err(err).Msgf("could not get torrent: %s from: %s", torrentID, indexer)
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue