@ -80,20 +80,14 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
}
}
}
}
public override ProviderMessage Message
{
get
{
return new ProviderMessage ( "Sonarr is unable to remove torrents that have finished seeding when using qBittorrent" , ProviderMessageType . Warning ) ;
}
}
public override IEnumerable < DownloadClientItem > GetItems ( )
public override IEnumerable < DownloadClientItem > GetItems ( )
{
{
QBittorrentPreferences config ;
List < QBittorrentTorrent > torrents ;
List < QBittorrentTorrent > torrents ;
try
try
{
{
config = _proxy . GetConfig ( Settings ) ;
torrents = _proxy . GetTorrents ( Settings ) ;
torrents = _proxy . GetTorrents ( Settings ) ;
}
}
catch ( DownloadClientException ex )
catch ( DownloadClientException ex )
@ -116,11 +110,10 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
item . RemainingTime = TimeSpan . FromSeconds ( torrent . Eta ) ;
item . RemainingTime = TimeSpan . FromSeconds ( torrent . Eta ) ;
item . OutputPath = _remotePathMappingService . RemapRemoteToLocal ( Settings . Host , new OsPath ( torrent . SavePath ) ) ;
item . OutputPath = _remotePathMappingService . RemapRemoteToLocal ( Settings . Host , new OsPath ( torrent . SavePath ) ) ;
// At the moment there isn't an easy way to detect if the torrent has
// Avoid removing torrents that haven't reached the global max ratio.
// reached the seeding limit, We would need to check the preferences
// Removal also requires the torrent to be paused, in case a higher max ratio was set on the torrent itself (which is not exposed by the api).
// and still not be completely sure if that torrent has a limit set for it
item . IsReadOnly = ( config . MaxRatioEnabled & & config . MaxRatio > torrent . Ratio ) | | torrent . State ! = "pausedUP" ;
item . IsReadOnly = true ;
if ( ! item . OutputPath . IsEmpty & & item . OutputPath . FileName ! = torrent . Name )
if ( ! item . OutputPath . IsEmpty & & item . OutputPath . FileName ! = torrent . Name )
{
{
@ -178,7 +171,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
{
{
var config = _proxy . GetConfig ( Settings ) ;
var config = _proxy . GetConfig ( Settings ) ;
var destDir = new OsPath ( ( string ) config . GetValueOrDefault ( "save_path" ) ) ;
var destDir = new OsPath ( config . SavePath ) ;
return new DownloadClientStatus
return new DownloadClientStatus
{
{
@ -227,6 +220,16 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
DetailedDescription = "Sonarr will not attempt to import completed downloads without a category."
DetailedDescription = "Sonarr will not attempt to import completed downloads without a category."
} ;
} ;
}
}
// Complain if qBittorrent is configured to remove torrents on max ratio
var config = _proxy . GetConfig ( Settings ) ;
if ( config . MaxRatioEnabled & & config . RemoveOnMaxRatio )
{
return new NzbDroneValidationFailure ( String . Empty , "QBittorrent is configured to remove torrents when they reach their Share Ratio Limit" )
{
DetailedDescription = "Sonarr will be unable to perform Completed Download Handling as configured. You can fix this in qBittorrent ('Tools -> Options...' in the menu) by changing 'Options -> BitTorrent -> Share Ratio Limiting' from 'Remove them' to 'Pause them'."
} ;
}
}
}
catch ( DownloadClientAuthenticationException ex )
catch ( DownloadClientAuthenticationException ex )
{
{