mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Pull DownloadClientItemClientInfo part of 824d315a
This commit is contained in:
parent
1058b03f46
commit
4eac1c5663
30 changed files with 88 additions and 48 deletions
|
@ -60,7 +60,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||||
|
|
||||||
protected void VerifyIdentifiable(DownloadClientItem downloadClientItem)
|
protected void VerifyIdentifiable(DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
downloadClientItem.DownloadClient.Should().Be(Subject.Definition.Name);
|
downloadClientItem.DownloadClientInfo.Protocol.Should().Be(Subject.Protocol);
|
||||||
|
downloadClientItem.DownloadClientInfo.Id.Should().Be(Subject.Definition.Id);
|
||||||
|
downloadClientItem.DownloadClientInfo.Name.Should().Be(Subject.Definition.Name);
|
||||||
downloadClientItem.DownloadId.Should().NotBeNullOrEmpty();
|
downloadClientItem.DownloadId.Should().NotBeNullOrEmpty();
|
||||||
downloadClientItem.Title.Should().NotBeNullOrEmpty();
|
downloadClientItem.Title.Should().NotBeNullOrEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,12 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||||
{
|
{
|
||||||
Title = "The torrent release folder",
|
Title = "The torrent release folder",
|
||||||
DownloadId = "35238",
|
DownloadId = "35238",
|
||||||
|
DownloadClientInfo = new DownloadClientItemClientInfo
|
||||||
|
{
|
||||||
|
Protocol = client.Protocol,
|
||||||
|
Id = client.Id,
|
||||||
|
Name = client.Name
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var trackedDownload = Subject.TrackDownload(client, item);
|
var trackedDownload = Subject.TrackDownload(client, item);
|
||||||
|
@ -105,6 +111,12 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||||
{
|
{
|
||||||
Title = "Audio Artist - Audio Album [2018 - FLAC]",
|
Title = "Audio Artist - Audio Album [2018 - FLAC]",
|
||||||
DownloadId = "35238",
|
DownloadId = "35238",
|
||||||
|
DownloadClientInfo = new DownloadClientItemClientInfo
|
||||||
|
{
|
||||||
|
Protocol = client.Protocol,
|
||||||
|
Id = client.Id,
|
||||||
|
Name = client.Name
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// get a tracked download in place
|
// get a tracked download in place
|
||||||
|
|
|
@ -9,6 +9,7 @@ using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Download.Clients;
|
using NzbDrone.Core.Download.Clients;
|
||||||
using NzbDrone.Core.HealthCheck.Checks;
|
using NzbDrone.Core.HealthCheck.Checks;
|
||||||
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
@ -39,7 +40,12 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
{
|
{
|
||||||
_downloadItem = new DownloadClientItem
|
_downloadItem = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = "Test",
|
DownloadClientInfo = new DownloadClientItemClientInfo
|
||||||
|
{
|
||||||
|
Protocol = DownloadProtocol.Usenet,
|
||||||
|
Id = 1,
|
||||||
|
Name = "Test"
|
||||||
|
},
|
||||||
DownloadId = "TestId",
|
DownloadId = "TestId",
|
||||||
OutputPath = new OsPath(_downloadItemPath)
|
OutputPath = new OsPath(_downloadItemPath)
|
||||||
};
|
};
|
||||||
|
@ -166,7 +172,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
public void should_return_ok_on_track_imported_event()
|
public void should_return_ok_on_track_imported_event()
|
||||||
{
|
{
|
||||||
GivenFolderExists(_downloadRootPath);
|
GivenFolderExists(_downloadRootPath);
|
||||||
var importEvent = new TrackImportedEvent(new LocalTrack(), new TrackFile(), new List<TrackFile>(), true, new DownloadClientItem());
|
var importEvent = new TrackImportedEvent(new LocalTrack(), new TrackFile(), new List<TrackFile>(), true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() });
|
||||||
|
|
||||||
Subject.Check(importEvent).ShouldBeOk();
|
Subject.Check(importEvent).ShouldBeOk();
|
||||||
}
|
}
|
||||||
|
@ -180,7 +186,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
};
|
};
|
||||||
GivenFileExists(localTrack.Path);
|
GivenFileExists(localTrack.Path);
|
||||||
|
|
||||||
var importEvent = new TrackImportFailedEvent(new Exception(), localTrack, true, new DownloadClientItem());
|
var importEvent = new TrackImportFailedEvent(new Exception(), localTrack, true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() });
|
||||||
|
|
||||||
Subject.Check(importEvent).ShouldBeError(wikiFragment: "permissions-error");
|
Subject.Check(importEvent).ShouldBeError(wikiFragment: "permissions-error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Music;
|
using NzbDrone.Core.Music;
|
||||||
|
@ -58,7 +59,12 @@ namespace NzbDrone.Core.Test.HistoryTests
|
||||||
|
|
||||||
var downloadClientItem = new DownloadClientItem
|
var downloadClientItem = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = "sab",
|
DownloadClientInfo = new DownloadClientItemClientInfo
|
||||||
|
{
|
||||||
|
Protocol = DownloadProtocol.Usenet,
|
||||||
|
Id = 1,
|
||||||
|
Name = "sab"
|
||||||
|
},
|
||||||
DownloadId = "abcd"
|
DownloadId = "abcd"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
private List<ImportDecision<LocalTrack>> _approvedDecisions;
|
private List<ImportDecision<LocalTrack>> _approvedDecisions;
|
||||||
|
|
||||||
private DownloadClientItem _downloadClientItem;
|
private DownloadClientItem _downloadClientItem;
|
||||||
|
private DownloadClientItemClientInfo _clientInfo;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
|
@ -79,7 +80,8 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
.Setup(s => s.UpgradeTrackFile(It.IsAny<TrackFile>(), It.IsAny<LocalTrack>(), It.IsAny<bool>()))
|
.Setup(s => s.UpgradeTrackFile(It.IsAny<TrackFile>(), It.IsAny<LocalTrack>(), It.IsAny<bool>()))
|
||||||
.Returns(new TrackFileMoveResult());
|
.Returns(new TrackFileMoveResult());
|
||||||
|
|
||||||
_downloadClientItem = Builder<DownloadClientItem>.CreateNew().Build();
|
_clientInfo = Builder<DownloadClientItemClientInfo>.CreateNew().Build();
|
||||||
|
_downloadClientItem = Builder<DownloadClientItem>.CreateNew().With(x => x.DownloadClientInfo = _clientInfo).Build();
|
||||||
|
|
||||||
Mocker.GetMock<IMediaFileService>()
|
Mocker.GetMock<IMediaFileService>()
|
||||||
.Setup(s => s.GetFilesByAlbum(It.IsAny<int>()))
|
.Setup(s => s.GetFilesByAlbum(It.IsAny<int>()))
|
||||||
|
@ -187,7 +189,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
[Test]
|
[Test]
|
||||||
public void should_copy_when_cannot_move_files_downloads()
|
public void should_copy_when_cannot_move_files_downloads()
|
||||||
{
|
{
|
||||||
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false });
|
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false, DownloadClientInfo = _clientInfo });
|
||||||
|
|
||||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||||
.Verify(v => v.UpgradeTrackFile(It.IsAny<TrackFile>(), _approvedDecisions.First().Item, true), Times.Once());
|
.Verify(v => v.UpgradeTrackFile(It.IsAny<TrackFile>(), _approvedDecisions.First().Item, true), Times.Once());
|
||||||
|
@ -196,7 +198,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
[Test]
|
[Test]
|
||||||
public void should_use_override_importmode()
|
public void should_use_override_importmode()
|
||||||
{
|
{
|
||||||
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false }, ImportMode.Move);
|
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false, DownloadClientInfo = _clientInfo }, ImportMode.Move);
|
||||||
|
|
||||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||||
.Verify(v => v.UpgradeTrackFile(It.IsAny<TrackFile>(), _approvedDecisions.First().Item, false), Times.Once());
|
.Verify(v => v.UpgradeTrackFile(It.IsAny<TrackFile>(), _approvedDecisions.First().Item, false), Times.Once());
|
||||||
|
|
|
@ -5,6 +5,7 @@ using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Download.TrackedDownloads;
|
using NzbDrone.Core.Download.TrackedDownloads;
|
||||||
using NzbDrone.Core.History;
|
using NzbDrone.Core.History;
|
||||||
using NzbDrone.Core.Music;
|
using NzbDrone.Core.Music;
|
||||||
|
@ -22,8 +23,11 @@ namespace NzbDrone.Core.Test.QueueTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
|
var downloadClientInfo = Builder<DownloadClientItemClientInfo>.CreateNew().Build();
|
||||||
|
|
||||||
var downloadItem = Builder<NzbDrone.Core.Download.DownloadClientItem>.CreateNew()
|
var downloadItem = Builder<NzbDrone.Core.Download.DownloadClientItem>.CreateNew()
|
||||||
.With(v => v.RemainingTime = TimeSpan.FromSeconds(10))
|
.With(v => v.RemainingTime = TimeSpan.FromSeconds(10))
|
||||||
|
.With(v => v.DownloadClientInfo = downloadClientInfo)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var artist = Builder<Artist>.CreateNew()
|
var artist = Builder<Artist>.CreateNew()
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
|
||||||
{
|
{
|
||||||
yield return new DownloadClientItem
|
yield return new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = Definition.Name + "_" + item.DownloadId,
|
DownloadId = Definition.Name + "_" + item.DownloadId,
|
||||||
Category = "Lidarr",
|
Category = "Lidarr",
|
||||||
Title = item.Title,
|
Title = item.Title,
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
|
||||||
{
|
{
|
||||||
yield return new DownloadClientItem
|
yield return new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = Definition.Name + "_" + item.DownloadId,
|
DownloadId = Definition.Name + "_" + item.DownloadId,
|
||||||
Category = "Lidarr",
|
Category = "Lidarr",
|
||||||
Title = item.Title,
|
Title = item.Title,
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
||||||
item.Title = torrent.Name;
|
item.Title = torrent.Name;
|
||||||
item.Category = Settings.MusicCategory;
|
item.Category = Settings.MusicCategory;
|
||||||
|
|
||||||
item.DownloadClient = Definition.Name;
|
item.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
|
|
||||||
var outputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.DownloadPath));
|
var outputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.DownloadPath));
|
||||||
item.OutputPath = outputPath + torrent.Name;
|
item.OutputPath = outputPath + torrent.Name;
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||||
var item = new DownloadClientItem()
|
var item = new DownloadClientItem()
|
||||||
{
|
{
|
||||||
Category = Settings.MusicCategory,
|
Category = Settings.MusicCategory,
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = CreateDownloadId(torrent.Id, serialNumber),
|
DownloadId = CreateDownloadId(torrent.Id, serialNumber),
|
||||||
Title = torrent.Title,
|
Title = torrent.Title,
|
||||||
TotalSize = torrent.Size,
|
TotalSize = torrent.Size,
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
||||||
var item = new DownloadClientItem()
|
var item = new DownloadClientItem()
|
||||||
{
|
{
|
||||||
Category = Settings.MusicCategory,
|
Category = Settings.MusicCategory,
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = CreateDownloadId(nzb.Id, serialNumber),
|
DownloadId = CreateDownloadId(nzb.Id, serialNumber),
|
||||||
Title = nzb.Title,
|
Title = nzb.Title,
|
||||||
TotalSize = nzb.Size,
|
TotalSize = nzb.Size,
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
|
||||||
|
|
||||||
var item = new DownloadClientItem
|
var item = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = torrent.InfoHash.ToUpper(),
|
DownloadId = torrent.InfoHash.ToUpper(),
|
||||||
OutputPath = outputPath + torrent.Name,
|
OutputPath = outputPath + torrent.Name,
|
||||||
RemainingSize = torrent.TotalSize - torrent.DownloadedBytes,
|
RemainingSize = torrent.TotalSize - torrent.DownloadedBytes,
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex
|
||||||
{
|
{
|
||||||
var queueItem = new DownloadClientItem();
|
var queueItem = new DownloadClientItem();
|
||||||
|
|
||||||
queueItem.DownloadClient = Definition.Name;
|
queueItem.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
queueItem.DownloadId = vortexQueueItem.AddUUID ?? vortexQueueItem.Id.ToString();
|
queueItem.DownloadId = vortexQueueItem.AddUUID ?? vortexQueueItem.Id.ToString();
|
||||||
queueItem.Category = vortexQueueItem.GroupName;
|
queueItem.Category = vortexQueueItem.GroupName;
|
||||||
queueItem.Title = vortexQueueItem.UiTitle;
|
queueItem.Title = vortexQueueItem.UiTitle;
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
queueItem.Title = item.NzbName;
|
queueItem.Title = item.NzbName;
|
||||||
queueItem.TotalSize = totalSize;
|
queueItem.TotalSize = totalSize;
|
||||||
queueItem.Category = item.Category;
|
queueItem.Category = item.Category;
|
||||||
queueItem.DownloadClient = Definition.Name;
|
queueItem.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
queueItem.CanMoveFiles = true;
|
queueItem.CanMoveFiles = true;
|
||||||
queueItem.CanBeRemoved = true;
|
queueItem.CanBeRemoved = true;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
var historyItem = new DownloadClientItem();
|
var historyItem = new DownloadClientItem();
|
||||||
var itemDir = item.FinalDir.IsNullOrWhiteSpace() ? item.DestDir : item.FinalDir;
|
var itemDir = item.FinalDir.IsNullOrWhiteSpace() ? item.DestDir : item.FinalDir;
|
||||||
|
|
||||||
historyItem.DownloadClient = Definition.Name;
|
historyItem.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
historyItem.DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString();
|
historyItem.DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString();
|
||||||
historyItem.Title = item.Name;
|
historyItem.Title = item.Name;
|
||||||
historyItem.TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo);
|
historyItem.TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo);
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
|
||||||
|
|
||||||
var historyItem = new DownloadClientItem
|
var historyItem = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = GetDownloadClientId(file),
|
DownloadId = GetDownloadClientId(file),
|
||||||
Title = title,
|
Title = title,
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||||
Category = torrent.Category.IsNotNullOrWhiteSpace() ? torrent.Category : torrent.Label,
|
Category = torrent.Category.IsNotNullOrWhiteSpace() ? torrent.Category : torrent.Label,
|
||||||
Title = torrent.Name,
|
Title = torrent.Name,
|
||||||
TotalSize = torrent.Size,
|
TotalSize = torrent.Size,
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
RemainingSize = (long)(torrent.Size * (1.0 - torrent.Progress)),
|
RemainingSize = (long)(torrent.Size * (1.0 - torrent.Progress)),
|
||||||
RemainingTime = GetRemainingTime(torrent),
|
RemainingTime = GetRemainingTime(torrent),
|
||||||
SeedRatio = torrent.Ratio
|
SeedRatio = torrent.Ratio
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
}
|
}
|
||||||
|
|
||||||
var queueItem = new DownloadClientItem();
|
var queueItem = new DownloadClientItem();
|
||||||
queueItem.DownloadClient = Definition.Name;
|
queueItem.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
queueItem.DownloadId = sabQueueItem.Id;
|
queueItem.DownloadId = sabQueueItem.Id;
|
||||||
queueItem.Category = sabQueueItem.Category;
|
queueItem.Category = sabQueueItem.Category;
|
||||||
queueItem.Title = sabQueueItem.Title;
|
queueItem.Title = sabQueueItem.Title;
|
||||||
|
@ -117,7 +117,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
|
|
||||||
var historyItem = new DownloadClientItem
|
var historyItem = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = Definition.Name,
|
DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this),
|
||||||
DownloadId = sabHistoryItem.Id,
|
DownloadId = sabHistoryItem.Id,
|
||||||
Category = sabHistoryItem.Category,
|
Category = sabHistoryItem.Category,
|
||||||
Title = sabHistoryItem.Title,
|
Title = sabHistoryItem.Title,
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
||||||
item.Category = Settings.MusicCategory;
|
item.Category = Settings.MusicCategory;
|
||||||
item.Title = torrent.Name;
|
item.Title = torrent.Name;
|
||||||
|
|
||||||
item.DownloadClient = Definition.Name;
|
item.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
|
|
||||||
item.OutputPath = GetOutputPath(outputPath, torrent);
|
item.OutputPath = GetOutputPath(outputPath, torrent);
|
||||||
item.TotalSize = torrent.TotalSize;
|
item.TotalSize = torrent.TotalSize;
|
||||||
|
|
|
@ -120,7 +120,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = new DownloadClientItem();
|
var item = new DownloadClientItem();
|
||||||
item.DownloadClient = Definition.Name;
|
item.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
item.Title = torrent.Name;
|
item.Title = torrent.Name;
|
||||||
item.DownloadId = torrent.Hash;
|
item.DownloadId = torrent.Hash;
|
||||||
item.OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.Path));
|
item.OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.Path));
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
item.Title = torrent.Name;
|
item.Title = torrent.Name;
|
||||||
item.TotalSize = torrent.Size;
|
item.TotalSize = torrent.Size;
|
||||||
item.Category = torrent.Label;
|
item.Category = torrent.Label;
|
||||||
item.DownloadClient = Definition.Name;
|
item.DownloadClientInfo = DownloadClientItemClientInfo.FromDownloadClient(this);
|
||||||
item.RemainingSize = torrent.Remaining;
|
item.RemainingSize = torrent.Remaining;
|
||||||
item.SeedRatio = torrent.Ratio;
|
item.SeedRatio = torrent.Ratio;
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,14 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Download
|
namespace NzbDrone.Core.Download
|
||||||
{
|
{
|
||||||
[DebuggerDisplay("{DownloadClient}:{Title}")]
|
[DebuggerDisplay("{DownloadClientName}:{Title}")]
|
||||||
public class DownloadClientItem
|
public class DownloadClientItem
|
||||||
{
|
{
|
||||||
public string DownloadClient { get; set; }
|
public DownloadClientItemClientInfo DownloadClientInfo { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
@ -17,13 +18,10 @@ namespace NzbDrone.Core.Download
|
||||||
public long RemainingSize { get; set; }
|
public long RemainingSize { get; set; }
|
||||||
public TimeSpan? RemainingTime { get; set; }
|
public TimeSpan? RemainingTime { get; set; }
|
||||||
public double? SeedRatio { get; set; }
|
public double? SeedRatio { get; set; }
|
||||||
|
|
||||||
public OsPath OutputPath { get; set; }
|
public OsPath OutputPath { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
public DownloadItemStatus Status { get; set; }
|
public DownloadItemStatus Status { get; set; }
|
||||||
public bool IsEncrypted { get; set; }
|
public bool IsEncrypted { get; set; }
|
||||||
|
|
||||||
public bool CanMoveFiles { get; set; }
|
public bool CanMoveFiles { get; set; }
|
||||||
public bool CanBeRemoved { get; set; }
|
public bool CanBeRemoved { get; set; }
|
||||||
public bool Removed { get; set; }
|
public bool Removed { get; set; }
|
||||||
|
@ -41,6 +39,16 @@ namespace NzbDrone.Core.Download
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public bool Removed { get; set; }
|
public static DownloadClientItemClientInfo FromDownloadClient<TSettings>(DownloadClientBase<TSettings> downloadClient)
|
||||||
|
where TSettings : IProviderConfig, new()
|
||||||
|
{
|
||||||
|
return new DownloadClientItemClientInfo
|
||||||
|
{
|
||||||
|
Protocol = downloadClient.Protocol,
|
||||||
|
Type = downloadClient.Name,
|
||||||
|
Id = downloadClient.Definition.Id,
|
||||||
|
Name = downloadClient.Definition.Name
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Download
|
||||||
var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
|
var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Debug("[{0}] Removing download from {1} history", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClient);
|
_logger.Debug("[{0}] Removing download from {1} history", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClientInfo.Name);
|
||||||
downloadClient.RemoveItem(trackedDownload.DownloadItem.DownloadId, true);
|
downloadClient.RemoveItem(trackedDownload.DownloadItem.DownloadId, true);
|
||||||
trackedDownload.DownloadItem.Removed = true;
|
trackedDownload.DownloadItem.Removed = true;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ namespace NzbDrone.Core.Download
|
||||||
var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
|
var downloadClient = _downloadClientProvider.Get(trackedDownload.DownloadClient);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Debug("[{0}] Marking download as imported from {1}", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClient);
|
_logger.Debug("[{0}] Marking download as imported from {1}", trackedDownload.DownloadItem.Title, trackedDownload.DownloadItem.DownloadClientInfo.Name);
|
||||||
downloadClient.MarkItemAsImported(trackedDownload.DownloadItem);
|
downloadClient.MarkItemAsImported(trackedDownload.DownloadItem);
|
||||||
}
|
}
|
||||||
catch (NotSupportedException e)
|
catch (NotSupportedException e)
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.Download
|
||||||
public List<int> AlbumIds { get; set; }
|
public List<int> AlbumIds { get; set; }
|
||||||
public QualityModel Quality { get; set; }
|
public QualityModel Quality { get; set; }
|
||||||
public string SourceTitle { get; set; }
|
public string SourceTitle { get; set; }
|
||||||
public string DownloadClient { get; set; }
|
public DownloadClientItemClientInfo DownloadClientInfo { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Download
|
||||||
AlbumIds = albums.Select(e => e.Id).ToList(),
|
AlbumIds = albums.Select(e => e.Id).ToList(),
|
||||||
Quality = trackedDownload.RemoteAlbum.ParsedAlbumInfo.Quality,
|
Quality = trackedDownload.RemoteAlbum.ParsedAlbumInfo.Quality,
|
||||||
SourceTitle = trackedDownload.DownloadItem.Title,
|
SourceTitle = trackedDownload.DownloadItem.Title,
|
||||||
DownloadClient = trackedDownload.DownloadItem.DownloadClient,
|
DownloadClientInfo = trackedDownload.DownloadItem.DownloadClientInfo,
|
||||||
DownloadId = trackedDownload.DownloadItem.DownloadId,
|
DownloadId = trackedDownload.DownloadItem.DownloadId,
|
||||||
Message = "Manually ignored"
|
Message = "Manually ignored"
|
||||||
};
|
};
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
||||||
existingItem.CanMoveFiles != downloadItem.CanMoveFiles)
|
existingItem.CanMoveFiles != downloadItem.CanMoveFiles)
|
||||||
{
|
{
|
||||||
_logger.Debug("Tracking '{0}:{1}': ClientState={2}{3} LidarrStage={4} Album='{5}' OutputPath={6}.",
|
_logger.Debug("Tracking '{0}:{1}': ClientState={2}{3} LidarrStage={4} Album='{5}' OutputPath={6}.",
|
||||||
downloadItem.DownloadClient,
|
downloadItem.DownloadClientInfo.Name,
|
||||||
downloadItem.Title,
|
downloadItem.Title,
|
||||||
downloadItem.Status,
|
downloadItem.Status,
|
||||||
downloadItem.CanBeRemoved ? "" : downloadItem.CanMoveFiles ? " (busy)" : " (readonly)",
|
downloadItem.CanBeRemoved ? "" : downloadItem.CanMoveFiles ? " (busy)" : " (readonly)",
|
||||||
|
|
|
@ -386,7 +386,7 @@ namespace NzbDrone.Core.History
|
||||||
DownloadId = message.DownloadId
|
DownloadId = message.DownloadId
|
||||||
};
|
};
|
||||||
|
|
||||||
history.Data.Add("DownloadClient", message.DownloadClient);
|
history.Data.Add("DownloadClient", message.DownloadClientInfo.Name);
|
||||||
history.Data.Add("Message", message.Message);
|
history.Data.Add("Message", message.Message);
|
||||||
|
|
||||||
historyToAdd.Add(history);
|
historyToAdd.Add(history);
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace NzbDrone.Core.MediaFiles.Events
|
||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
DownloadClient = downloadClientItem.DownloadClient;
|
DownloadClient = downloadClientItem.DownloadClientInfo.Name;
|
||||||
DownloadId = downloadClientItem.DownloadId;
|
DownloadId = downloadClientItem.DownloadId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace NzbDrone.Core.MediaFiles.Events
|
||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
DownloadClient = downloadClientItem.DownloadClient;
|
DownloadClient = downloadClientItem.DownloadClientInfo.Name;
|
||||||
DownloadId = downloadClientItem.DownloadId;
|
DownloadId = downloadClientItem.DownloadId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace NzbDrone.Core.MediaFiles.Events
|
||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
DownloadClient = downloadClientItem.DownloadClient;
|
DownloadClient = downloadClientItem.DownloadClientInfo.Name;
|
||||||
DownloadId = downloadClientItem.DownloadId;
|
DownloadId = downloadClientItem.DownloadId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Queue
|
||||||
RemoteAlbum = trackedDownload.RemoteAlbum,
|
RemoteAlbum = trackedDownload.RemoteAlbum,
|
||||||
DownloadId = trackedDownload.DownloadItem.DownloadId,
|
DownloadId = trackedDownload.DownloadItem.DownloadId,
|
||||||
Protocol = trackedDownload.Protocol,
|
Protocol = trackedDownload.Protocol,
|
||||||
DownloadClient = trackedDownload.DownloadItem.DownloadClient,
|
DownloadClient = trackedDownload.DownloadItem.DownloadClientInfo.Name,
|
||||||
Indexer = trackedDownload.Indexer,
|
Indexer = trackedDownload.Indexer,
|
||||||
OutputPath = trackedDownload.DownloadItem.OutputPath.ToString(),
|
OutputPath = trackedDownload.DownloadItem.OutputPath.ToString(),
|
||||||
DownloadForced = downloadForced
|
DownloadForced = downloadForced
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue