feat(actions): rtorrent add folder rename toggle (#756)

* feat(actions): rtorrent add folder rename toggle

* refactor: use content layout
This commit is contained in:
metonym 2023-03-19 13:25:53 -07:00 committed by GitHub
parent 4449df66aa
commit 9fed6b3735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 9 deletions

View file

@ -41,10 +41,17 @@ func (s *service) rtorrent(ctx context.Context, action *domain.Action, release d
})
}
if action.SavePath != "" {
args = append(args, &rtorrent.FieldValue{
Field: rtorrent.DDirectory,
Value: action.SavePath,
})
if action.ContentLayout == domain.ActionContentLayoutSubfolderNone {
args = append(args, &rtorrent.FieldValue{
Field: "d.directory_base",
Value: action.SavePath,
})
} else {
args = append(args, &rtorrent.FieldValue{
Field: rtorrent.DDirectory,
Value: action.SavePath,
})
}
}
if err := rt.Add(release.MagnetURI, args...); err != nil {
@ -77,10 +84,17 @@ func (s *service) rtorrent(ctx context.Context, action *domain.Action, release d
})
}
if action.SavePath != "" {
args = append(args, &rtorrent.FieldValue{
Field: rtorrent.DDirectory,
Value: action.SavePath,
})
if action.ContentLayout == domain.ActionContentLayoutSubfolderNone {
args = append(args, &rtorrent.FieldValue{
Field: "d.directory_base",
Value: action.SavePath,
})
} else {
args = append(args, &rtorrent.FieldValue{
Field: rtorrent.DDirectory,
Value: action.SavePath,
})
}
}
if err := rt.AddTorrent(tmpFile, args...); err != nil {