feat(downloadclient): set downloadClientId for arr clients (#1081)

feat(downloadclient): arrs set downloadClientId
This commit is contained in:
ze0s 2023-09-03 15:34:55 +02:00 committed by GitHub
parent 1bfbe38335
commit 0d3e10f094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 154 additions and 66 deletions

View file

@ -42,19 +42,28 @@ func (s *service) readarr(ctx context.Context, action *domain.Action, release do
cfg.Password = client.Settings.Basic.Password
}
arr := readarr.New(cfg)
externalId := 0
if client.Settings.ExternalDownloadClientId > 0 {
externalId = client.Settings.ExternalDownloadClientId
} else if action.ExternalDownloadClientID > 0 {
externalId = int(action.ExternalDownloadClientID)
}
r := readarr.Release{
Title: release.TorrentName,
InfoUrl: release.InfoURL,
DownloadUrl: release.DownloadURL,
MagnetUrl: release.MagnetURI,
Size: int64(release.Size),
Indexer: release.Indexer,
DownloadProtocol: "torrent",
Protocol: "torrent",
DownloadClientId: externalId,
DownloadProtocol: string(release.Protocol),
Protocol: string(release.Protocol),
PublishDate: time.Now().Format(time.RFC3339),
}
arr := readarr.New(cfg)
rejections, err := arr.Push(ctx, r)
if err != nil {
return nil, errors.Wrap(err, "readarr: failed to push release: %v", r)