2018-04-16 22:22:54 +00:00
|
|
|
using FluentValidation.Results;
|
2016-05-03 07:58:28 +00:00
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common.Disk;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.Download.Clients.Transmission;
|
|
|
|
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
2018-04-16 22:22:54 +00:00
|
|
|
using NzbDrone.Core.Organizer;
|
2016-05-03 07:58:28 +00:00
|
|
|
using NzbDrone.Core.RemotePathMappings;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Download.Clients.Vuze
|
|
|
|
{
|
|
|
|
public class Vuze : TransmissionBase
|
|
|
|
{
|
|
|
|
private const int MINIMUM_SUPPORTED_PROTOCOL_VERSION = 14;
|
|
|
|
|
|
|
|
public Vuze(ITransmissionProxy proxy,
|
|
|
|
ITorrentFileInfoReader torrentFileInfoReader,
|
|
|
|
IHttpClient httpClient,
|
|
|
|
IConfigService configService,
|
2018-04-16 22:22:54 +00:00
|
|
|
INamingConfigService namingConfigService,
|
2016-05-03 07:58:28 +00:00
|
|
|
IDiskProvider diskProvider,
|
|
|
|
IRemotePathMappingService remotePathMappingService,
|
|
|
|
Logger logger)
|
2018-04-16 22:22:54 +00:00
|
|
|
: base(proxy, torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger)
|
2016-05-03 07:58:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent torrent)
|
|
|
|
{
|
2017-04-30 08:37:51 +00:00
|
|
|
// Vuze has similar behavior as uTorrent:
|
|
|
|
// - A multi-file torrent is downloaded in a job folder and 'outputPath' points to that directory directly.
|
|
|
|
// - A single-file torrent is downloaded in the root folder and 'outputPath' poinst to that root folder.
|
|
|
|
// We have to make sure the return value points to the job folder OR file.
|
2019-06-14 03:54:25 +00:00
|
|
|
if (outputPath == null || outputPath.FileName == torrent.Name || torrent.FileCount > 1)
|
2017-04-30 08:37:51 +00:00
|
|
|
{
|
|
|
|
_logger.Trace("Vuze output directory: {0}", outputPath);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
outputPath = outputPath + torrent.Name;
|
|
|
|
_logger.Trace("Vuze output file: {0}", outputPath);
|
|
|
|
}
|
2016-05-03 07:58:28 +00:00
|
|
|
|
|
|
|
return outputPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override ValidationFailure ValidateVersion()
|
|
|
|
{
|
|
|
|
var versionString = _proxy.GetProtocolVersion(Settings);
|
|
|
|
|
|
|
|
_logger.Debug("Vuze protocol version information: {0}", versionString);
|
|
|
|
|
|
|
|
int version;
|
|
|
|
if (!int.TryParse(versionString, out version) || version < MINIMUM_SUPPORTED_PROTOCOL_VERSION)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return new ValidationFailure(string.Empty, "Protocol version not supported, use Vuze 5.0.0.0 or higher with Vuze Web Remote plugin.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-12-09 06:54:15 +00:00
|
|
|
public override string Name => "Vuze";
|
2016-05-03 07:58:28 +00:00
|
|
|
}
|
2017-04-30 08:37:51 +00:00
|
|
|
}
|