mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(downloadclients): Porla support preset (#978)
* Correctly omit download/upload limits * Prefix JWT correctly * Allow setting Porla preset
This commit is contained in:
parent
956225c108
commit
3d9839d234
4 changed files with 49 additions and 27 deletions
|
@ -51,20 +51,32 @@ func (s *service) porla(ctx context.Context, action *domain.Action, release doma
|
|||
return rejections, nil
|
||||
}
|
||||
|
||||
var downloadLimit *int64 = nil
|
||||
var uploadLimit *int64 = nil
|
||||
|
||||
if action.LimitDownloadSpeed > 0 {
|
||||
dlValue := action.LimitDownloadSpeed * 1000
|
||||
downloadLimit = &dlValue
|
||||
}
|
||||
|
||||
if action.LimitUploadSpeed > 0 {
|
||||
ulValue := action.LimitUploadSpeed * 1000
|
||||
uploadLimit = &ulValue
|
||||
}
|
||||
|
||||
var preset *string = nil
|
||||
|
||||
if action.Label != "" {
|
||||
preset = &action.Label
|
||||
}
|
||||
|
||||
if release.HasMagnetUri() {
|
||||
opts := &porla.TorrentsAddReq{
|
||||
DownloadLimit: -1,
|
||||
UploadLimit: -1,
|
||||
SavePath: action.SavePath,
|
||||
DownloadLimit: downloadLimit,
|
||||
MagnetUri: release.MagnetURI,
|
||||
}
|
||||
|
||||
if action.LimitDownloadSpeed > 0 {
|
||||
opts.DownloadLimit = action.LimitDownloadSpeed * 1000
|
||||
}
|
||||
|
||||
if action.LimitUploadSpeed > 0 {
|
||||
opts.UploadLimit = action.LimitUploadSpeed * 1000
|
||||
SavePath: action.SavePath,
|
||||
UploadLimit: uploadLimit,
|
||||
Preset: preset,
|
||||
}
|
||||
|
||||
if err = prl.TorrentsAdd(ctx, opts); err != nil {
|
||||
|
@ -94,18 +106,11 @@ func (s *service) porla(ctx context.Context, action *domain.Action, release doma
|
|||
}
|
||||
|
||||
opts := &porla.TorrentsAddReq{
|
||||
DownloadLimit: -1,
|
||||
DownloadLimit: downloadLimit,
|
||||
SavePath: action.SavePath,
|
||||
Ti: base64.StdEncoding.EncodeToString(content),
|
||||
UploadLimit: -1,
|
||||
}
|
||||
|
||||
if action.LimitDownloadSpeed > 0 {
|
||||
opts.DownloadLimit = action.LimitDownloadSpeed * 1000
|
||||
}
|
||||
|
||||
if action.LimitUploadSpeed > 0 {
|
||||
opts.UploadLimit = action.LimitUploadSpeed * 1000
|
||||
UploadLimit: uploadLimit,
|
||||
Preset: preset,
|
||||
}
|
||||
|
||||
if err = prl.TorrentsAdd(ctx, opts); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue