Use DownloadClientIds to find matching series/episodes instead of relying solely on release name

Fixed: Show a warning in Queue when drone is unable to import due to a name mismatch
Fixed: Better UI messages for Queue when there is an error or warning
This commit is contained in:
Mark McDowall
2014-09-13 16:13:00 -07:00
parent 3f11fcf2e1
commit caa6a3858b
26 changed files with 292 additions and 149 deletions
@@ -9,11 +9,13 @@ using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download;
using NzbDrone.Core.History;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Test.Common;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Test.Download
@@ -27,15 +29,18 @@ namespace NzbDrone.Core.Test.Download
public void Setup()
{
_completed = Builder<DownloadClientItem>.CreateListOfSize(1)
.All()
.With(h => h.Status = DownloadItemStatus.Completed)
.With(h => h.OutputPath = @"C:\DropFolder\MyDownload".AsOsAgnostic())
.With(h => h.RemoteEpisode = new RemoteEpisode
{
Episodes = new List<Episode> { new Episode { Id = 1 } }
})
.Build()
.ToList();
.All()
.With(h => h.Status = DownloadItemStatus.Completed)
.With(h => h.OutputPath = @"C:\DropFolder\MyDownload".AsOsAgnostic())
.With(h => h.Title = "Drone.S01E01.HDTV")
.Build()
.ToList();
var remoteEpisode = new RemoteEpisode
{
Series = new Series(),
Episodes = new List<Episode> {new Episode {Id = 1}}
};
Mocker.GetMock<IProvideDownloadClient>()
.Setup(c => c.GetDownloadClients())
@@ -43,7 +48,7 @@ namespace NzbDrone.Core.Test.Download
Mocker.GetMock<IDownloadClient>()
.SetupGet(c => c.Definition)
.Returns(new Core.Download.DownloadClientDefinition { Id = 1, Name = "testClient" });
.Returns(new DownloadClientDefinition { Id = 1, Name = "testClient" });
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.EnableCompletedDownloadHandling)
@@ -56,6 +61,14 @@ namespace NzbDrone.Core.Test.Download
Mocker.GetMock<IHistoryService>()
.Setup(s => s.Failed())
.Returns(new List<History.History>());
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Int32>(), It.IsAny<IEnumerable<Int32>>()))
.Returns(remoteEpisode);
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Int32>(), (SearchCriteriaBase)null))
.Returns(remoteEpisode);
Mocker.SetConstant<ICompletedDownloadService>(Mocker.Resolve<CompletedDownloadService>());
}
@@ -311,10 +324,7 @@ namespace NzbDrone.Core.Test.Download
.All()
.With(h => h.Status = DownloadItemStatus.Completed)
.With(h => h.OutputPath = @"C:\DropFolder\MyDownload".AsOsAgnostic())
.With(h => h.RemoteEpisode = new RemoteEpisode
{
Episodes = new List<Episode> { new Episode { Id = 1 } }
})
.With(h => h.Title = "Drone.S01E01.HDTV")
.Build());
var grabbedHistory = Builder<History.History>.CreateListOfSize(2)
@@ -5,6 +5,7 @@ using Moq;
using NUnit.Framework;
using FluentAssertions;
using NzbDrone.Common.Http;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Parser;
@@ -30,7 +31,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
.Returns(30);
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), null))
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), (SearchCriteriaBase)null))
.Returns(() => CreateRemoteEpisode());
Mocker.GetMock<IHttpClient>()
@@ -64,11 +65,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
downloadClientItem.DownloadClient.Should().Be(Subject.Definition.Name);
downloadClientItem.DownloadClientId.Should().NotBeNullOrEmpty();
downloadClientItem.Title.Should().NotBeNullOrEmpty();
downloadClientItem.RemoteEpisode.Should().NotBeNull();
}
protected void VerifyQueued(DownloadClientItem downloadClientItem)
@@ -7,8 +7,12 @@ using NUnit.Framework;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download;
using NzbDrone.Core.History;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.Download
@@ -23,16 +27,24 @@ namespace NzbDrone.Core.Test.Download
public void Setup()
{
_completed = Builder<DownloadClientItem>.CreateListOfSize(5)
.All()
.With(h => h.Status = DownloadItemStatus.Completed)
.Build()
.ToList();
.All()
.With(h => h.Status = DownloadItemStatus.Completed)
.With(h => h.Title = "Drone.S01E01.HDTV")
.Build()
.ToList();
_failed = Builder<DownloadClientItem>.CreateListOfSize(1)
.All()
.With(h => h.Status = DownloadItemStatus.Failed)
.Build()
.ToList();
.All()
.With(h => h.Status = DownloadItemStatus.Failed)
.With(h => h.Title = "Drone.S01E01.HDTV")
.Build()
.ToList();
var remoteEpisode = new RemoteEpisode
{
Series = new Series(),
Episodes = new List<Episode> { new Episode { Id = 1 } }
};
Mocker.GetMock<IProvideDownloadClient>()
.Setup(c => c.GetDownloadClients())
@@ -40,7 +52,7 @@ namespace NzbDrone.Core.Test.Download
Mocker.GetMock<IDownloadClient>()
.SetupGet(c => c.Definition)
.Returns(new Core.Download.DownloadClientDefinition { Id = 1, Name = "testClient" });
.Returns(new DownloadClientDefinition { Id = 1, Name = "testClient" });
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.EnableFailedDownloadHandling)
@@ -50,6 +62,14 @@ namespace NzbDrone.Core.Test.Download
.Setup(s => s.Imported())
.Returns(new List<History.History>());
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Int32>(), It.IsAny<IEnumerable<Int32>>()))
.Returns(remoteEpisode);
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<Int32>(), (SearchCriteriaBase)null))
.Returns(remoteEpisode);
Mocker.SetConstant<IFailedDownloadService>(Mocker.Resolve<FailedDownloadService>());
}