mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 21:13:58 +02:00
Pull DownloadClientItemClientInfo part of 824d315a
This commit is contained in:
parent
cedc026710
commit
3e4ebe8aca
30 changed files with 88 additions and 48 deletions
|
|
@ -61,7 +61,9 @@ protected virtual RemoteBook CreateRemoteAlbum()
|
||||||
|
|
||||||
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 @@ public void should_track_downloads_using_the_source_title_if_it_cannot_be_found_
|
||||||
{
|
{
|
||||||
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 @@ public void should_unmap_tracked_download_if_album_deleted()
|
||||||
{
|
{
|
||||||
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.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 @@ public void Setup()
|
||||||
{
|
{
|
||||||
_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 @@ public void should_return_docker_path_mapping_error_if_on_docker_and_root_missin
|
||||||
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 LocalBook(), new BookFile(), new List<BookFile>(), true, new DownloadClientItem());
|
var importEvent = new TrackImportedEvent(new LocalBook(), new BookFile(), new List<BookFile>(), true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() });
|
||||||
|
|
||||||
Subject.Check(importEvent).ShouldBeOk();
|
Subject.Check(importEvent).ShouldBeOk();
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +186,7 @@ public void should_return_permissions_error_on_track_import_failed_event_if_file
|
||||||
};
|
};
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
using NzbDrone.Core.Books;
|
using NzbDrone.Core.Books;
|
||||||
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.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
@ -56,7 +57,12 @@ public void should_use_file_name_for_source_title_if_scene_name_is_null()
|
||||||
|
|
||||||
var downloadClientItem = new DownloadClientItem
|
var downloadClientItem = new DownloadClientItem
|
||||||
{
|
{
|
||||||
DownloadClient = "sab",
|
DownloadClientInfo = new DownloadClientItemClientInfo
|
||||||
|
{
|
||||||
|
Protocol = DownloadProtocol.Usenet,
|
||||||
|
Id = 1,
|
||||||
|
Name = "sab"
|
||||||
|
},
|
||||||
DownloadId = "abcd"
|
DownloadId = "abcd"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ public class ImportApprovedTracksFixture : CoreTest<ImportApprovedBooks>
|
||||||
private List<ImportDecision<LocalBook>> _approvedDecisions;
|
private List<ImportDecision<LocalBook>> _approvedDecisions;
|
||||||
|
|
||||||
private DownloadClientItem _downloadClientItem;
|
private DownloadClientItem _downloadClientItem;
|
||||||
|
private DownloadClientItemClientInfo _clientInfo;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
|
|
@ -74,7 +75,8 @@ public void Setup()
|
||||||
.Setup(s => s.UpgradeBookFile(It.IsAny<BookFile>(), It.IsAny<LocalBook>(), It.IsAny<bool>()))
|
.Setup(s => s.UpgradeBookFile(It.IsAny<BookFile>(), It.IsAny<LocalBook>(), It.IsAny<bool>()))
|
||||||
.Returns(new BookFileMoveResult());
|
.Returns(new BookFileMoveResult());
|
||||||
|
|
||||||
_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.GetFilesByBook(It.IsAny<int>()))
|
.Setup(s => s.GetFilesByBook(It.IsAny<int>()))
|
||||||
|
|
@ -186,7 +188,7 @@ public void should_import_larger_files_first()
|
||||||
[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<LocalBook>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false });
|
Subject.Import(new List<ImportDecision<LocalBook>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false, DownloadClientInfo = _clientInfo });
|
||||||
|
|
||||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||||
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, true), Times.Once());
|
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, true), Times.Once());
|
||||||
|
|
@ -195,7 +197,7 @@ public void should_copy_when_cannot_move_files_downloads()
|
||||||
[Test]
|
[Test]
|
||||||
public void should_use_override_importmode()
|
public void should_use_override_importmode()
|
||||||
{
|
{
|
||||||
Subject.Import(new List<ImportDecision<LocalBook>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false }, ImportMode.Move);
|
Subject.Import(new List<ImportDecision<LocalBook>> { _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.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false), Times.Once());
|
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false), Times.Once());
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Books;
|
using NzbDrone.Core.Books;
|
||||||
|
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.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
@ -22,8 +23,11 @@ public class QueueServiceFixture : CoreTest<QueueService>
|
||||||
[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<Author>.CreateNew()
|
var artist = Builder<Author>.CreateNew()
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
{
|
{
|
||||||
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 = "Readarr",
|
Category = "Readarr",
|
||||||
Title = item.Title,
|
Title = item.Title,
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
{
|
{
|
||||||
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 = "Readarr",
|
Category = "Readarr",
|
||||||
Title = item.Title,
|
Title = item.Title,
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
|
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
{
|
{
|
||||||
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 @@ private IEnumerable<DownloadClientItem> GetQueue()
|
||||||
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 @@ private IEnumerable<DownloadClientItem> GetHistory()
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
|
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
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 @@ private IEnumerable<DownloadClientItem> GetQueue()
|
||||||
}
|
}
|
||||||
|
|
||||||
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 @@ private IEnumerable<DownloadClientItem> GetHistory()
|
||||||
|
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
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 @@ public override IEnumerable<DownloadClientItem> GetItems()
|
||||||
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.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 @@ public class DownloadClientItem
|
||||||
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 @@ public class DownloadClientItemClientInfo
|
||||||
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 @@ private void RemoveFromDownloadClient(TrackedDownload trackedDownload)
|
||||||
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 @@ private void MarkItemAsImported(TrackedDownload trackedDownload)
|
||||||
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 @@ public class DownloadIgnoredEvent : IEvent
|
||||||
public List<int> BookIds { get; set; }
|
public List<int> BookIds { 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; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,15 +35,15 @@ public bool IgnoreDownload(TrackedDownload trackedDownload)
|
||||||
}
|
}
|
||||||
|
|
||||||
var downloadIgnoredEvent = new DownloadIgnoredEvent
|
var downloadIgnoredEvent = new DownloadIgnoredEvent
|
||||||
{
|
{
|
||||||
AuthorId = author.Id,
|
AuthorId = author.Id,
|
||||||
BookIds = books.Select(e => e.Id).ToList(),
|
BookIds = books.Select(e => e.Id).ToList(),
|
||||||
Quality = trackedDownload.RemoteBook.ParsedBookInfo.Quality,
|
Quality = trackedDownload.RemoteBook.ParsedBookInfo.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"
|
||||||
};
|
};
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(downloadIgnoredEvent);
|
_eventAggregator.PublishEvent(downloadIgnoredEvent);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ private void LogItemChange(TrackedDownload trackedDownload, DownloadClientItem e
|
||||||
existingItem.CanMoveFiles != downloadItem.CanMoveFiles)
|
existingItem.CanMoveFiles != downloadItem.CanMoveFiles)
|
||||||
{
|
{
|
||||||
_logger.Debug("Tracking '{0}:{1}': ClientState={2}{3} ReadarrStage={4} Book='{5}' OutputPath={6}.",
|
_logger.Debug("Tracking '{0}:{1}': ClientState={2}{3} ReadarrStage={4} Book='{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)",
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ public void Handle(DownloadIgnoredEvent message)
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public BookImportedEvent(Author author, Book book, List<BookFile> importedBooks,
|
||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
DownloadClient = downloadClientItem.DownloadClient;
|
DownloadClient = downloadClientItem.DownloadClientInfo.Name;
|
||||||
DownloadId = downloadClientItem.DownloadId;
|
DownloadId = downloadClientItem.DownloadId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public TrackImportFailedEvent(Exception exception, LocalBook bookInfo, bool newD
|
||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
DownloadClient = downloadClientItem.DownloadClient;
|
DownloadClient = downloadClientItem.DownloadClientInfo.Name;
|
||||||
DownloadId = downloadClientItem.DownloadId;
|
DownloadId = downloadClientItem.DownloadId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public TrackImportedEvent(LocalBook bookInfo, BookFile importedBook, List<BookFi
|
||||||
|
|
||||||
if (downloadClientItem != null)
|
if (downloadClientItem != null)
|
||||||
{
|
{
|
||||||
DownloadClient = downloadClientItem.DownloadClient;
|
DownloadClient = downloadClientItem.DownloadClientInfo.Name;
|
||||||
DownloadId = downloadClientItem.DownloadId;
|
DownloadId = downloadClientItem.DownloadId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ private Queue MapQueueItem(TrackedDownload trackedDownload, Book book)
|
||||||
RemoteBook = trackedDownload.RemoteBook,
|
RemoteBook = trackedDownload.RemoteBook,
|
||||||
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…
Reference in a new issue