@ -142,20 +142,8 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
var request = BuildRequest ( settings ) . Resource ( "/api/v2/torrents/add" )
. Post ( )
. AddFormParameter ( "urls" , torrentUrl ) ;
if ( settings . MusicCategory . IsNotNullOrWhiteSpace ( ) )
{
request . AddFormParameter ( "category" , settings . MusicCategory ) ;
}
// 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 ) ;
}
AddTorrentDownloadFormParameters ( request , settings ) ;
if ( seedConfiguration ! = null )
{
@ -177,20 +165,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
. Post ( )
. AddFormUpload ( "torrents" , fileName , fileContent ) ;
if ( settings . MusicCategory . IsNotNullOrWhiteSpace ( ) )
{
request . AddFormParameter ( "category" , settings . MusicCategory ) ;
}
// 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 ) ;
}
AddTorrentDownloadFormParameters ( request , settings ) ;
if ( seedConfiguration ! = null )
{
@ -259,6 +234,34 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
}
}
private void AddTorrentDownloadFormParameters ( HttpRequestBuilder request , QBittorrentSettings settings )
{
if ( settings . MusicCategory . IsNotNullOrWhiteSpace ( ) )
{
request . AddFormParameter ( "category" , settings . MusicCategory ) ;
}
// 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 )
{
var request = BuildRequest ( settings ) . Resource ( "/api/v2/torrents/setShareLimits" )