mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-16 23:39:44 +02:00
New: Add qBittorrent sequential order and first and last piece priority options
Fixes #7057
This commit is contained in:
parent
356013a84e
commit
8bb3764708
@ -142,20 +142,8 @@ public void AddTorrentFromUrl(string torrentUrl, TorrentSeedConfiguration seedCo
|
|||||||
var request = BuildRequest(settings).Resource("/api/v2/torrents/add")
|
var request = BuildRequest(settings).Resource("/api/v2/torrents/add")
|
||||||
.Post()
|
.Post()
|
||||||
.AddFormParameter("urls", torrentUrl);
|
.AddFormParameter("urls", torrentUrl);
|
||||||
if (settings.MovieCategory.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
request.AddFormParameter("category", settings.MovieCategory);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: ForceStart is handled by separate api call
|
AddTorrentDownloadFormParameters(request, settings);
|
||||||
if ((QBittorrentState)settings.InitialState == QBittorrentState.Start)
|
|
||||||
{
|
|
||||||
request.AddFormParameter("paused", false);
|
|
||||||
}
|
|
||||||
else if ((QBittorrentState)settings.InitialState == QBittorrentState.Pause)
|
|
||||||
{
|
|
||||||
request.AddFormParameter("paused", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seedConfiguration != null)
|
if (seedConfiguration != null)
|
||||||
{
|
{
|
||||||
@ -177,20 +165,7 @@ public void AddTorrentFromFile(string fileName, byte[] fileContent, TorrentSeedC
|
|||||||
.Post()
|
.Post()
|
||||||
.AddFormUpload("torrents", fileName, fileContent);
|
.AddFormUpload("torrents", fileName, fileContent);
|
||||||
|
|
||||||
if (settings.MovieCategory.IsNotNullOrWhiteSpace())
|
AddTorrentDownloadFormParameters(request, settings);
|
||||||
{
|
|
||||||
request.AddFormParameter("category", settings.MovieCategory);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: ForceStart is handled by separate api call
|
|
||||||
if ((QBittorrentState)settings.InitialState == QBittorrentState.Start)
|
|
||||||
{
|
|
||||||
request.AddFormParameter("paused", false);
|
|
||||||
}
|
|
||||||
else if ((QBittorrentState)settings.InitialState == QBittorrentState.Pause)
|
|
||||||
{
|
|
||||||
request.AddFormParameter("paused", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seedConfiguration != null)
|
if (seedConfiguration != null)
|
||||||
{
|
{
|
||||||
@ -259,6 +234,34 @@ private void AddTorrentSeedingFormParameters(HttpRequestBuilder request, Torrent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddTorrentDownloadFormParameters(HttpRequestBuilder request, QBittorrentSettings settings)
|
||||||
|
{
|
||||||
|
if (settings.MovieCategory.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
request.AddFormParameter("category", settings.MovieCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: ForceStart is handled by separate api call
|
||||||
|
if ((QBittorrentState)settings.InitialState == QBittorrentState.Start)
|
||||||
|
{
|
||||||
|
request.AddFormParameter("paused", false);
|
||||||
|
}
|
||||||
|
else if ((QBittorrentState)settings.InitialState == QBittorrentState.Pause)
|
||||||
|
{
|
||||||
|
request.AddFormParameter("paused", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.SequentialOrder)
|
||||||
|
{
|
||||||
|
request.AddFormParameter("sequentialDownload", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.FirstAndLast)
|
||||||
|
{
|
||||||
|
request.AddFormParameter("firstLastPiecePrio", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTorrentSeedingConfiguration(string hash, TorrentSeedConfiguration seedConfiguration, QBittorrentSettings settings)
|
public void SetTorrentSeedingConfiguration(string hash, TorrentSeedConfiguration seedConfiguration, QBittorrentSettings settings)
|
||||||
{
|
{
|
||||||
var request = BuildRequest(settings).Resource("/api/v2/torrents/setShareLimits")
|
var request = BuildRequest(settings).Resource("/api/v2/torrents/setShareLimits")
|
||||||
|
@ -63,6 +63,12 @@ public QBittorrentSettings()
|
|||||||
[FieldDefinition(10, Label = "Initial State", Type = FieldType.Select, SelectOptions = typeof(QBittorrentState), HelpText = "Initial state for torrents added to qBittorrent. Note that Forced Torrents do not abide by seed restrictions")]
|
[FieldDefinition(10, Label = "Initial State", Type = FieldType.Select, SelectOptions = typeof(QBittorrentState), HelpText = "Initial state for torrents added to qBittorrent. Note that Forced Torrents do not abide by seed restrictions")]
|
||||||
public int InitialState { get; set; }
|
public int InitialState { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(11, Label = "Sequential Order", Type = FieldType.Checkbox, HelpText = "Download in sequential order (qBittorrent 4.1.0+)")]
|
||||||
|
public bool SequentialOrder { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(12, Label = "First and Last First", Type = FieldType.Checkbox, HelpText = "Download first and last pieces first (qBittorrent 4.1.0+)")]
|
||||||
|
public bool FirstAndLast { get; set; }
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
Loading…
Reference in New Issue
Block a user