fixed more tests.
This commit is contained in:
parent
48880e4964
commit
048162a0ef
|
@ -54,7 +54,7 @@ namespace Marr.Data
|
||||||
|
|
||||||
// Register a default IReflectionStrategy
|
// Register a default IReflectionStrategy
|
||||||
ReflectionStrategy = new CachedReflectionStrategy();
|
ReflectionStrategy = new CachedReflectionStrategy();
|
||||||
|
|
||||||
// Register a default type converter for Enums
|
// Register a default type converter for Enums
|
||||||
TypeConverters.Add(typeof(Enum), new Converters.EnumStringConverter());
|
TypeConverters.Add(typeof(Enum), new Converters.EnumStringConverter());
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ namespace Marr.Data
|
||||||
|
|
||||||
return Relationships[type];
|
return Relationships[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region - Reflection Strategy -
|
#region - Reflection Strategy -
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace NzbDrone.Api.Calendar
|
||||||
{
|
{
|
||||||
public class CalendarModule : NzbDroneApiModule
|
public class CalendarModule : NzbDroneApiModule
|
||||||
{
|
{
|
||||||
private readonly EpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
|
|
||||||
public CalendarModule(EpisodeService episodeService)
|
public CalendarModule(IEpisodeService episodeService)
|
||||||
: base("/calendar")
|
: base("/calendar")
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
|
|
|
@ -9,9 +9,9 @@ namespace NzbDrone.Api.Episodes
|
||||||
{
|
{
|
||||||
public class EpisodeModule : NzbDroneApiModule
|
public class EpisodeModule : NzbDroneApiModule
|
||||||
{
|
{
|
||||||
private readonly EpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
|
|
||||||
public EpisodeModule(EpisodeService episodeService)
|
public EpisodeModule(IEpisodeService episodeService)
|
||||||
: base("/episodes")
|
: base("/episodes")
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
|
|
|
@ -10,9 +10,9 @@ namespace NzbDrone.Api.Missing
|
||||||
{
|
{
|
||||||
public class MissingModule : NzbDroneApiModule
|
public class MissingModule : NzbDroneApiModule
|
||||||
{
|
{
|
||||||
private readonly EpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
|
|
||||||
public MissingModule(EpisodeService episodeService)
|
public MissingModule(IEpisodeService episodeService)
|
||||||
: base("/missing")
|
: base("/missing")
|
||||||
{
|
{
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace NzbDrone.Api.Series
|
||||||
{
|
{
|
||||||
RuleSet("POST", () =>
|
RuleSet("POST", () =>
|
||||||
{
|
{
|
||||||
RuleFor(s => ((ModelBase)s).Id).GreaterThan(0);
|
RuleFor(s => s.Id).GreaterThan(0);
|
||||||
RuleFor(s => s.Path).NotEmpty().Must(_diskProvider.FolderExists);
|
RuleFor(s => s.Path).NotEmpty().Must(_diskProvider.FolderExists);
|
||||||
RuleFor(s => s.QualityProfileId).GreaterThan(0);
|
RuleFor(s => s.QualityProfileId).GreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -56,8 +56,8 @@ namespace NzbDrone.Common
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
header[6] = (byte)(((ushort)PacketType.Blob & 0xff00) >> 8);
|
header[6] = ((ushort)PacketType.Blob & 0xff00) >> 8;
|
||||||
header[7] = (byte)((ushort)PacketType.Blob & 0x00ff);
|
header[7] = (ushort)PacketType.Blob & 0x00ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
header[8] = (byte)((currentPacket & 0xff000000) >> 24);
|
header[8] = (byte)((currentPacket & 0xff000000) >> 24);
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration />
|
|
@ -19,7 +19,7 @@ using NzbDrone.Core.Test.Framework;
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
||||||
public class UpgradeDiskSpecificationFixture : CoreTest
|
public class UpgradeDiskSpecificationFixture : CoreTest
|
||||||
{
|
{
|
||||||
private UpgradeDiskSpecification _upgradeDisk;
|
private UpgradeDiskSpecification _upgradeDisk;
|
||||||
|
@ -35,8 +35,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
Mocker.Resolve<QualityUpgradableSpecification>();
|
Mocker.Resolve<QualityUpgradableSpecification>();
|
||||||
_upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>();
|
_upgradeDisk = Mocker.Resolve<UpgradeDiskSpecification>();
|
||||||
|
|
||||||
firstFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
|
firstFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, true), DateAdded = DateTime.Now };
|
||||||
secondFile = new EpisodeFile { Quality = Quality.Bluray1080p, Proper = true, DateAdded = DateTime.Now };
|
secondFile = new EpisodeFile { Quality = new QualityModel(Quality.Bluray1080p, true), DateAdded = DateTime.Now };
|
||||||
|
|
||||||
var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } };
|
var singleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = null } };
|
||||||
var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } };
|
var doubleEpisodeList = new List<Episode> { new Episode { EpisodeFile = firstFile }, new Episode { EpisodeFile = secondFile }, new Episode { EpisodeFile = null } };
|
||||||
|
@ -66,12 +66,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
|
|
||||||
private void WithFirstFileUpgradable()
|
private void WithFirstFileUpgradable()
|
||||||
{
|
{
|
||||||
firstFile.Quality = Quality.SDTV;
|
firstFile.Quality = new QualityModel(Quality.SDTV);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithSecondFileUpgradable()
|
private void WithSecondFileUpgradable()
|
||||||
{
|
{
|
||||||
secondFile.Quality = Quality.SDTV;
|
secondFile.Quality = new QualityModel(Quality.SDTV);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -120,8 +120,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_upgradable_if_qualities_are_the_same()
|
public void should_not_be_upgradable_if_qualities_are_the_same()
|
||||||
{
|
{
|
||||||
firstFile.Quality = Quality.WEBDL1080p;
|
firstFile.Quality = new QualityModel(Quality.WEBDL1080p);
|
||||||
firstFile.Proper = false;
|
|
||||||
parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false);
|
parseResultSingle.Quality = new QualityModel(Quality.WEBDL1080p, false);
|
||||||
_upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
|
_upgradeDisk.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -13,7 +9,7 @@ using NzbDrone.Core.Download.Clients;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BlackholeProviderFixture : CoreTest
|
public class BlackholeProviderFixture : CoreTest
|
|
@ -1,19 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetProviderTests
|
||||||
{
|
{
|
||||||
public class DownloadNzbFixture : CoreTest
|
public class DownloadNzbFixture : CoreTest
|
||||||
{
|
{
|
|
@ -1,19 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.NzbgetProviderTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetProviderTests
|
||||||
{
|
{
|
||||||
public class QueueFixture : CoreTest
|
public class QueueFixture : CoreTest
|
||||||
{
|
{
|
|
@ -1,9 +1,5 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -13,7 +9,7 @@ using NzbDrone.Core.Download.Clients;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class PneumaticProviderFixture : CoreTest
|
public class PneumaticProviderFixture : CoreTest
|
|
@ -1,24 +1,19 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Qualities;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
|
@ -1,24 +1,15 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||||
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using FizzWare.NBuilder;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
using NzbDrone.Core.Qualities;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.Download
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class DownloadServiceFixture : CoreTest<DownloadService>
|
||||||
|
{
|
||||||
|
private EpisodeParseResult _parseResult;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
|
.Setup(c => c.GetDownloadClient()).Returns(Mocker.GetMock<IDownloadClient>().Object);
|
||||||
|
|
||||||
|
var episodes = Builder<Episode>.CreateListOfSize(2)
|
||||||
|
.TheFirst(1).With(s => s.Id = 12)
|
||||||
|
.TheNext(1).With(s => s.Id = 99)
|
||||||
|
.All().With(s => s.SeriesId = 5)
|
||||||
|
.Build().ToList();
|
||||||
|
|
||||||
|
_parseResult = Builder<EpisodeParseResult>.CreateNew()
|
||||||
|
.With(c => c.Quality = new QualityModel(Quality.DVD, false))
|
||||||
|
.With(c => c.Series = Builder<Series>.CreateNew().Build())
|
||||||
|
.With(c => c.EpisodeNumbers = new List<int> { 2 })
|
||||||
|
.With(c => c.Episodes = episodes)
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WithSuccessfulAdd()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IDownloadClient>()
|
||||||
|
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
|
||||||
|
.Returns(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WithFailedAdd()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IDownloadClient>()
|
||||||
|
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
|
||||||
|
.Returns(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Download_report_should_publish_on_grab_event()
|
||||||
|
{
|
||||||
|
WithSuccessfulAdd();
|
||||||
|
|
||||||
|
Subject.DownloadReport(_parseResult);
|
||||||
|
|
||||||
|
VerifyEventPublished<EpisodeGrabbedEvent>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Download_report_should_grab_using_client()
|
||||||
|
{
|
||||||
|
WithSuccessfulAdd();
|
||||||
|
|
||||||
|
Subject.DownloadReport(_parseResult);
|
||||||
|
|
||||||
|
Mocker.GetMock<IDownloadClient>()
|
||||||
|
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Download_report_should_not_publish_on_failed_grab_event()
|
||||||
|
{
|
||||||
|
WithFailedAdd();
|
||||||
|
|
||||||
|
Subject.DownloadReport(_parseResult);
|
||||||
|
VerifyEventNotPublished<EpisodeGrabbedEvent>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,10 +18,10 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public TestSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider,
|
public TestSearch(IEpisodeService episodeService, IDownloadService downloadService,
|
||||||
IIndexerService indexerService, ISceneMappingService sceneMappingService,
|
IIndexerService indexerService, ISceneMappingService sceneMappingService,
|
||||||
IDownloadDirector downloadDirector, ISeriesRepository seriesRepository)
|
IDownloadDirector downloadDirector, ISeriesRepository seriesRepository)
|
||||||
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
|
: base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
|
||||||
downloadDirector)
|
downloadDirector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
.Setup(e => e.BuildFilePath(It.IsAny<Series>(), fakeEpisode.First().SeasonNumber, filename, ".avi"))
|
.Setup(e => e.BuildFilePath(It.IsAny<Series>(), fakeEpisode.First().SeasonNumber, filename, ".avi"))
|
||||||
.Returns(fi);
|
.Returns(fi);
|
||||||
|
|
||||||
|
|
||||||
var result = Subject.MoveEpisodeFile(file, false);
|
var result = Subject.MoveEpisodeFile(file, false);
|
||||||
|
|
||||||
|
|
||||||
result.Should().BeNull();
|
result.Should().BeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +85,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
var file = Builder<EpisodeFile>.CreateNew()
|
var file = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(f => f.SeriesId = fakeSeries.Id)
|
.With(f => f.SeriesId = fakeSeries.Id)
|
||||||
.With(f => f.Path = currentFilename)
|
.With(f => f.Path = currentFilename)
|
||||||
.With(f => f.Quality = Quality.WEBDL720p)
|
.With(f => f.Quality = new QualityModel(Quality.WEBDL720p))
|
||||||
.With(f => f.Proper = false)
|
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Mocker.GetMock<ISeriesRepository>()
|
Mocker.GetMock<ISeriesRepository>()
|
||||||
|
@ -137,8 +136,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
var file = Builder<EpisodeFile>.CreateNew()
|
var file = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(f => f.SeriesId = fakeSeries.Id)
|
.With(f => f.SeriesId = fakeSeries.Id)
|
||||||
.With(f => f.Path = currentFilename)
|
.With(f => f.Path = currentFilename)
|
||||||
.With(f => f.Quality = Quality.WEBDL720p)
|
.With(f => f.Quality = new QualityModel(Quality.WEBDL720p))
|
||||||
.With(f => f.Proper = false)
|
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Mocker.GetMock<ISeriesRepository>()
|
Mocker.GetMock<ISeriesRepository>()
|
||||||
|
|
|
@ -4,7 +4,9 @@ using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.MediaFileTests
|
namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
{
|
{
|
||||||
|
@ -17,9 +19,10 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
var files = Builder<EpisodeFile>.CreateListOfSize(10)
|
var files = Builder<EpisodeFile>.CreateListOfSize(10)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.Id = 0)
|
.With(c => c.Id = 0)
|
||||||
|
.With(c => c.Quality =new QualityModel(Quality.Bluray720p))
|
||||||
.Random(4)
|
.Random(4)
|
||||||
.With(s => s.SeriesId = 12)
|
.With(s => s.SeriesId = 12)
|
||||||
.Build();
|
.BuildListOfNew();
|
||||||
|
|
||||||
|
|
||||||
Db.InsertMany(files);
|
Db.InsertMany(files);
|
||||||
|
@ -70,7 +73,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
.With(f => f.Path = path.NormalizePath())
|
.With(f => f.Path = path.NormalizePath())
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Subject.Insert(episodeFile);
|
Subject.Insert(episodeFile);
|
||||||
|
|
||||||
var file = Subject.GetFileByPath(path);
|
var file = Subject.GetFileByPath(path);
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,13 @@
|
||||||
<Compile Include="Datastore\DatabaseRelationshipFixture.cs" />
|
<Compile Include="Datastore\DatabaseRelationshipFixture.cs" />
|
||||||
<Compile Include="Datastore\MappingExtentionFixture.cs" />
|
<Compile Include="Datastore\MappingExtentionFixture.cs" />
|
||||||
<Compile Include="Datastore\ObjectDatabaseFixture.cs" />
|
<Compile Include="Datastore\ObjectDatabaseFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientTests\BlackholeProviderFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientTests\NzbgetProviderTests\DownloadNzbFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientTests\NzbgetProviderTests\QueueFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientTests\PneumaticProviderFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientTests\SabProviderTests\QueueFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientTests\SabProviderTests\SabProviderFixture.cs" />
|
||||||
|
<Compile Include="Download\DownloadServiceFixture.cs" />
|
||||||
<Compile Include="Framework\CoreTest.cs" />
|
<Compile Include="Framework\CoreTest.cs" />
|
||||||
<Compile Include="Framework\DbTest.cs" />
|
<Compile Include="Framework\DbTest.cs" />
|
||||||
<Compile Include="Framework\NBuilderExtensions.cs" />
|
<Compile Include="Framework\NBuilderExtensions.cs" />
|
||||||
|
@ -158,9 +165,6 @@
|
||||||
<Compile Include="MediaFileTests\MediaFileRepositoryFixture.cs" />
|
<Compile Include="MediaFileTests\MediaFileRepositoryFixture.cs" />
|
||||||
<Compile Include="MediaFileTests\EpisodeFileMoverFixture.cs" />
|
<Compile Include="MediaFileTests\EpisodeFileMoverFixture.cs" />
|
||||||
<Compile Include="MetadataSourceTests\TracktProxyFixture.cs" />
|
<Compile Include="MetadataSourceTests\TracktProxyFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DownloadClientTests\NzbgetProviderTests\DownloadNzbFixture.cs" />
|
|
||||||
<Compile Include="ProviderTests\DownloadClientTests\NzbgetProviderTests\QueueFixture.cs" />
|
|
||||||
<Compile Include="ProviderTests\DownloadProviderTests\ContainsRecentEpisode.cs" />
|
|
||||||
<Compile Include="RootFolderTests\FreeSpaceOnDrivesFixture.cs" />
|
<Compile Include="RootFolderTests\FreeSpaceOnDrivesFixture.cs" />
|
||||||
<Compile Include="HelperTests\XElementHelperTests\ConvertToDayOfWeekFixture.cs" />
|
<Compile Include="HelperTests\XElementHelperTests\ConvertToDayOfWeekFixture.cs" />
|
||||||
<Compile Include="Qualities\QualityFixture.cs" />
|
<Compile Include="Qualities\QualityFixture.cs" />
|
||||||
|
@ -176,8 +180,6 @@
|
||||||
<Compile Include="ProviderTests\DiskScanProviderTests\CleanUpDropFolderFixture.cs" />
|
<Compile Include="ProviderTests\DiskScanProviderTests\CleanUpDropFolderFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DiskScanProviderTests\GetVideoFilesFixture.cs" />
|
<Compile Include="ProviderTests\DiskScanProviderTests\GetVideoFilesFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DiskScanProviderTests\ScanFixture.cs" />
|
<Compile Include="ProviderTests\DiskScanProviderTests\ScanFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DownloadClientTests\PneumaticProviderFixture.cs" />
|
|
||||||
<Compile Include="TvTests\EpisodeProviderTests\GetEpisodeBySceneNumberFixture.cs" />
|
|
||||||
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDropDirectoryFixture.cs" />
|
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDropDirectoryFixture.cs" />
|
||||||
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessVideoFileFixture.cs" />
|
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessVideoFileFixture.cs" />
|
||||||
<Compile Include="ProviderTests\RecycleBinProviderTests\CleanupFixture.cs" />
|
<Compile Include="ProviderTests\RecycleBinProviderTests\CleanupFixture.cs" />
|
||||||
|
@ -192,9 +194,7 @@
|
||||||
<Compile Include="DecisionEngineTests\UpgradeDiskSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\UpgradeDiskSpecificationFixture.cs" />
|
||||||
<Compile Include="DecisionEngineTests\QualityUpgradeSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\QualityUpgradeSpecificationFixture.cs" />
|
||||||
<Compile Include="DecisionEngineTests\QualityUpgradableSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\QualityUpgradableSpecificationFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DownloadClientTests\BlackholeProviderFixture.cs" />
|
|
||||||
<Compile Include="ProviderTests\NotificationProviderTests\NotificationProviderFixture.cs" />
|
<Compile Include="ProviderTests\NotificationProviderTests\NotificationProviderFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DownloadClientTests\SabProviderTests\QueueFixture.cs" />
|
|
||||||
<Compile Include="Indexers\NewznabServiceTest.cs" />
|
<Compile Include="Indexers\NewznabServiceTest.cs" />
|
||||||
<Compile Include="ProviderTests\DiskProviderTests\FreeDiskSpaceTest.cs" />
|
<Compile Include="ProviderTests\DiskProviderTests\FreeDiskSpaceTest.cs" />
|
||||||
<Compile Include="ProviderTests\ProwlProviderTest.cs" />
|
<Compile Include="ProviderTests\ProwlProviderTest.cs" />
|
||||||
|
@ -223,7 +223,6 @@
|
||||||
<Compile Include="InstrumentationTests\DatabaseTargetFixture.cs" />
|
<Compile Include="InstrumentationTests\DatabaseTargetFixture.cs" />
|
||||||
<Compile Include="OrganizerTests\GetNewFilenameFixture.cs" />
|
<Compile Include="OrganizerTests\GetNewFilenameFixture.cs" />
|
||||||
<Compile Include="DecisionEngineTests\MonitoredEpisodeSpecificationFixture.cs" />
|
<Compile Include="DecisionEngineTests\MonitoredEpisodeSpecificationFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DownloadProviderTests\DownloadProviderFixture.cs" />
|
|
||||||
<Compile Include="EpisodeStatusTest.cs" />
|
<Compile Include="EpisodeStatusTest.cs" />
|
||||||
<Compile Include="JobTests\DiskScanJobTest.cs" />
|
<Compile Include="JobTests\DiskScanJobTest.cs" />
|
||||||
<Compile Include="IndexerTests\IndexerFixture.cs" />
|
<Compile Include="IndexerTests\IndexerFixture.cs" />
|
||||||
|
@ -240,7 +239,6 @@
|
||||||
<Compile Include="ParserTests\ParserFixture.cs" />
|
<Compile Include="ParserTests\ParserFixture.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Qualities\QualityProfileFixture.cs" />
|
<Compile Include="Qualities\QualityProfileFixture.cs" />
|
||||||
<Compile Include="ProviderTests\DownloadClientTests\SabProviderTests\SabProviderFixture.cs" />
|
|
||||||
<Compile Include="TvTests\SeriesProviderTest.cs" />
|
<Compile Include="TvTests\SeriesProviderTest.cs" />
|
||||||
<Compile Include="XbmcVersionTests.cs" />
|
<Compile Include="XbmcVersionTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -17,7 +17,7 @@ using NzbDrone.Core.Test.Framework;
|
||||||
namespace NzbDrone.Core.Test.OrganizerTests
|
namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
||||||
public class MediaFileProvider_GetNewFilenameTest : CoreTest<FileNameBuilder>
|
public class MediaFileProvider_GetNewFilenameTest : CoreTest<FileNameBuilder>
|
||||||
{
|
{
|
||||||
private Series _series;
|
private Series _series;
|
||||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,17 +62,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Episode_Quality_1x05_Dash()
|
public void GetNewFilename_Episode_Quality_1x05_Dash()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,17 +89,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
|
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Series_Quality_01x05_Space()
|
public void GetNewFilename_Series_Quality_01x05_Space()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,17 +116,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
|
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Series_s01e05_Space()
|
public void GetNewFilename_Series_s01e05_Space()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,17 +144,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("South Park s05e06", result);
|
Assert.AreEqual("South Park s05e06", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Series_Episode_s01e05_Periods()
|
public void GetNewFilename_Series_Episode_s01e05_Periods()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,17 +171,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
|
public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,17 +198,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_S01E05_Dash()
|
public void GetNewFilename_S01E05_Dash()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,17 +226,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("S15E06", result);
|
Assert.AreEqual("S15E06", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,17 +260,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 24)
|
.With(e => e.EpisodeNumber = 24)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result);
|
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,17 +294,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 24)
|
.With(e => e.EpisodeNumber = 24)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result);
|
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,17 +328,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 24)
|
.With(e => e.EpisodeNumber = 24)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result);
|
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -362,17 +362,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 24)
|
.With(e => e.EpisodeNumber = 24)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
|
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,17 +396,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 24)
|
.With(e => e.EpisodeNumber = 24)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,17 +430,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 24)
|
.With(e => e.EpisodeNumber = 24)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("3x23x24", result);
|
Assert.AreEqual("3x23x24", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
|
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -455,17 +455,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p, true) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
|
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -480,17 +480,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
|
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -505,17 +505,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p, true) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("South Park - S15E06 - City Sushi");
|
result.Should().Be("South Park - S15E06 - City Sushi");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
|
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -537,17 +537,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 7)
|
.With(e => e.EpisodeNumber = 7)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -564,17 +564,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
|
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_Episode_Quality_1x05_Period()
|
public void GetNewFilename_Episode_Quality_1x05_Period()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -591,17 +591,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 6)
|
.With(e => e.EpisodeNumber = 6)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
|
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = false;
|
nameSpecification.IncludeSeriesName = false;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -622,17 +622,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = false;
|
nameSpecification.IncludeSeriesName = false;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -653,17 +653,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be(episodeFile.SceneName);
|
result.Should().Be(episodeFile.SceneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -685,17 +685,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 7)
|
.With(e => e.EpisodeNumber = 7)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -717,17 +717,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 7)
|
.With(e => e.EpisodeNumber = 7)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nameSpecification.IncludeSeriesName = true;
|
nameSpecification.IncludeSeriesName = true;
|
||||||
nameSpecification.IncludeEpisodeTitle = true;
|
nameSpecification.IncludeEpisodeTitle = true;
|
||||||
|
@ -755,10 +755,10 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 8)
|
.With(e => e.EpisodeNumber = 8)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|
||||||
string result = Subject.BuildFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
|
||||||
|
|
||||||
|
string result = Subject.BuildFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
|
|
||||||
|
|
||||||
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var result = Subject
|
var result = Subject
|
||||||
.BuildFilename(episodes, series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
.BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]");
|
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,7 +816,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var result = Subject
|
var result = Subject
|
||||||
.BuildFilename(episodes, series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
.BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
|
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,7 +845,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var result = Subject
|
var result = Subject
|
||||||
.BuildFilename(episodes, series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
.BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
||||||
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
{
|
{
|
||||||
|
|
||||||
public class ImportFileFixture : CoreTest
|
public class ImportFileFixture : CoreTest
|
||||||
{
|
{
|
||||||
public static object[] ImportTestCases =
|
public static object[] ImportTestCases =
|
||||||
|
@ -70,10 +70,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
|
||||||
|
|
||||||
|
|
||||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,20 +87,20 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||||
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(g => g.Quality = (Quality)currentFileQuality)
|
.With(g => g.Quality = new QualityModel(currentFileQuality, currentFileProper))
|
||||||
.And(g => g.Proper = currentFileProper).Build()
|
.Build()
|
||||||
).Build();
|
).Build();
|
||||||
|
|
||||||
|
|
||||||
With80MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
|
||||||
|
|
||||||
|
|
||||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||||
.With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
.With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(e => e.Quality = Quality.Bluray720p).Build()
|
.With(e => e.Quality = new QualityModel(Quality.Bluray720p)).Build()
|
||||||
)
|
)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifySkipImport(result, Mocker);
|
VerifySkipImport(result, Mocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,10 +146,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
|
|
||||||
With80MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifySkipImport(result, Mocker);
|
VerifySkipImport(result, Mocker);
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
|
|
||||||
With80MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifySkipImport(result, Mocker);
|
VerifySkipImport(result, Mocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,10 +199,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Returns(new List<Episode>());
|
.Returns(new List<Episode>());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifySkipImport(result, Mocker);
|
VerifySkipImport(result, Mocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||||
.With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
.With(c => c.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(e => e.Quality = Quality.SDTV).Build()
|
.With(e => e.Quality = new QualityModel(Quality.SDTV)).Build()
|
||||||
)
|
)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -228,10 +228,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||||
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
|
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
|
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
|
||||||
.All()
|
.All()
|
||||||
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(f => f.Quality = Quality.SDTV)
|
.With(f => f.Quality = new QualityModel(Quality.SDTV))
|
||||||
.Build())
|
.Build())
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
|
@ -260,10 +260,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifyFileImport(result, Mocker, fakeEpisodes[0], SIZE);
|
VerifyFileImport(result, Mocker, fakeEpisodes[0], SIZE);
|
||||||
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
|
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
|
||||||
}
|
}
|
||||||
|
@ -278,12 +278,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
|
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
|
||||||
.All()
|
.All()
|
||||||
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||||
.With(f => f.Quality = Quality.Bluray720p)
|
.With(f => f.Quality = new QualityModel(Quality.Bluray720p))
|
||||||
.Build())
|
.Build())
|
||||||
.Build().ToList();
|
.Build().ToList();
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
|
|
||||||
With80MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<IMediaFileService>()
|
Mocker.GetMock<IMediaFileService>()
|
||||||
|
@ -293,10 +293,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifySkipImport(result, Mocker);
|
VerifySkipImport(result, Mocker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
|
|
||||||
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
||||||
.All()
|
.All()
|
||||||
.With(e => e.Quality = Quality.SDTV)
|
.With(e => e.Quality = new QualityModel(Quality.SDTV))
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var fakeEpisode1 = Builder<Episode>.CreateNew()
|
var fakeEpisode1 = Builder<Episode>.CreateNew()
|
||||||
|
@ -331,10 +331,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode1, fakeEpisode2 });
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode1, fakeEpisode2 });
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifyFileImport(result, Mocker, fakeEpisode1, SIZE);
|
VerifyFileImport(result, Mocker, fakeEpisode1, SIZE);
|
||||||
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Exactly(2));
|
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Exactly(2));
|
||||||
}
|
}
|
||||||
|
@ -358,12 +358,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Returns(false);
|
.Returns(false);
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
Mocker.GetMock<IEpisodeService>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode});
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
|
||||||
|
|
||||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||||
Mocker.GetMock<DiskProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Never());
|
Mocker.GetMock<DiskProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
||||||
|
|
||||||
With80MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.Download;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class ContainsRecentEpisode : CoreTest
|
|
||||||
{
|
|
||||||
private Episode _recentEpisode;
|
|
||||||
private Episode _oldEpisode;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
_recentEpisode = Builder<Episode>
|
|
||||||
.CreateNew()
|
|
||||||
.With(e => e.AirDate = DateTime.Today)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
_oldEpisode = Builder<Episode>
|
|
||||||
.CreateNew()
|
|
||||||
.With(e => e.AirDate = DateTime.Today.AddDays(-365))
|
|
||||||
.Build();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_episode_aired_recently()
|
|
||||||
{
|
|
||||||
var epr = Builder<EpisodeParseResult>
|
|
||||||
.CreateNew()
|
|
||||||
.With(p => p.Episodes = new List<Episode>
|
|
||||||
{
|
|
||||||
_recentEpisode
|
|
||||||
})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_true_if_one_episode_aired_recently()
|
|
||||||
{
|
|
||||||
var epr = Builder<EpisodeParseResult>
|
|
||||||
.CreateNew()
|
|
||||||
.With(p => p.Episodes = new List<Episode>
|
|
||||||
{
|
|
||||||
_recentEpisode,
|
|
||||||
_oldEpisode
|
|
||||||
})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_false_if_episode_did_not_air_recently()
|
|
||||||
{
|
|
||||||
var epr = Builder<EpisodeParseResult>
|
|
||||||
.CreateNew()
|
|
||||||
.With(p => p.Episodes = new List<Episode>
|
|
||||||
{
|
|
||||||
_oldEpisode
|
|
||||||
})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_false_if_no_episode_aired_recently()
|
|
||||||
{
|
|
||||||
var epr = Builder<EpisodeParseResult>
|
|
||||||
.CreateNew()
|
|
||||||
.With(p => p.Episodes = new List<Episode>
|
|
||||||
{
|
|
||||||
_oldEpisode,
|
|
||||||
_oldEpisode
|
|
||||||
})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Mocker.Resolve<DownloadProvider>().ContainsRecentEpisode(epr).Should().BeFalse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,128 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.Configuration;
|
|
||||||
using NzbDrone.Core.Download;
|
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
|
||||||
using NzbDrone.Core.Qualities;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class DownloadProviderFixture : CoreTest<DownloadProvider>
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private void SetDownloadClient(DownloadClientType clientType)
|
|
||||||
{
|
|
||||||
Mocker.GetMock<IConfigService>()
|
|
||||||
.Setup(c => c.DownloadClient)
|
|
||||||
.Returns(clientType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private EpisodeParseResult SetupParseResult()
|
|
||||||
{
|
|
||||||
var episodes = Builder<Episode>.CreateListOfSize(2)
|
|
||||||
.TheFirst(1).With(s => s.Id = 12)
|
|
||||||
.TheNext(1).With(s => s.Id = 99)
|
|
||||||
.All().With(s => s.SeriesId = 5)
|
|
||||||
.Build().ToList();
|
|
||||||
|
|
||||||
Mocker.GetMock<IEpisodeService>()
|
|
||||||
.Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(episodes);
|
|
||||||
|
|
||||||
return Builder<EpisodeParseResult>.CreateNew()
|
|
||||||
.With(c => c.Quality = new QualityModel(Quality.DVD, false))
|
|
||||||
.With(c => c.Series = Builder<Series>.CreateNew().Build())
|
|
||||||
.With(c => c.EpisodeNumbers = new List<int> { 2 })
|
|
||||||
.With(c => c.Episodes = episodes)
|
|
||||||
.Build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithSuccessfullAdd()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<SabProvider>()
|
|
||||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
|
|
||||||
.Returns(true);
|
|
||||||
|
|
||||||
Mocker.GetMock<BlackholeProvider>()
|
|
||||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<bool>()))
|
|
||||||
.Returns(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WithFailedAdd()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<SabProvider>()
|
|
||||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
|
|
||||||
.Returns(false);
|
|
||||||
|
|
||||||
Mocker.GetMock<BlackholeProvider>()
|
|
||||||
.Setup(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), false))
|
|
||||||
.Returns(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Download_report_should_publish_on_grab_event()
|
|
||||||
{
|
|
||||||
WithSuccessfullAdd();
|
|
||||||
SetDownloadClient(DownloadClientType.Sabnzbd);
|
|
||||||
|
|
||||||
var parseResult = SetupParseResult();
|
|
||||||
|
|
||||||
|
|
||||||
Subject.DownloadReport(parseResult);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mocker.GetMock<SabProvider>()
|
|
||||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Once());
|
|
||||||
|
|
||||||
Mocker.GetMock<BlackholeProvider>()
|
|
||||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Never());
|
|
||||||
|
|
||||||
|
|
||||||
VerifyEventPublished<EpisodeGrabbedEvent>();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase(DownloadClientType.Sabnzbd)]
|
|
||||||
[TestCase(DownloadClientType.Blackhole)]
|
|
||||||
public void Download_report_should_not_publish_grabbed_event(DownloadClientType clientType)
|
|
||||||
{
|
|
||||||
WithFailedAdd();
|
|
||||||
SetDownloadClient(clientType);
|
|
||||||
|
|
||||||
var parseResult = SetupParseResult();
|
|
||||||
|
|
||||||
Subject.DownloadReport(parseResult);
|
|
||||||
|
|
||||||
|
|
||||||
VerifyEventNotPublished<EpisodeGrabbedEvent>();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_sab_as_active_client()
|
|
||||||
{
|
|
||||||
SetDownloadClient(DownloadClientType.Sabnzbd);
|
|
||||||
Subject.GetActiveDownloadClient().Should().BeAssignableTo<SabProvider>();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_blackhole_as_active_client()
|
|
||||||
{
|
|
||||||
SetDownloadClient(DownloadClientType.Blackhole);
|
|
||||||
Subject.GetActiveDownloadClient().Should().BeAssignableTo<BlackholeProvider>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using FizzWare.NBuilder;
|
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
|
|
||||||
public class GetEpisodeBySceneNumberFixture : DbTest
|
|
||||||
{
|
|
||||||
private Series _series;
|
|
||||||
private Episode _episode;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
_series = Builder<Series>
|
|
||||||
.CreateNew()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Db.Insert(_series);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WithNullSceneNumbering()
|
|
||||||
{
|
|
||||||
_episode = Builder<Episode>
|
|
||||||
.CreateNew()
|
|
||||||
.With(e => e.SeriesId = _series.Id)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Db.Insert(_episode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WithSceneNumbering()
|
|
||||||
{
|
|
||||||
_episode = Builder<Episode>
|
|
||||||
.CreateNew()
|
|
||||||
.With(e => e.SeriesId = _series.Id)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
Db.Insert(_episode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_null_if_no_episodes_in_db()
|
|
||||||
{
|
|
||||||
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_null_if_no_matching_episode_is_found()
|
|
||||||
{
|
|
||||||
WithNullSceneNumbering();
|
|
||||||
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.Id, 1, 1).Should().BeNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_episode_if_matching_episode_is_found()
|
|
||||||
{
|
|
||||||
WithSceneNumbering();
|
|
||||||
|
|
||||||
var result = Mocker.Resolve<EpisodeService>()
|
|
||||||
.GetEpisodeBySceneNumbering(_series.Id, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
|
|
||||||
|
|
||||||
result.Id.Should().Be(_episode.Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -68,8 +68,7 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
Create.TableForModel("EpisodeFiles")
|
Create.TableForModel("EpisodeFiles")
|
||||||
.WithColumn("SeriesId").AsInt32()
|
.WithColumn("SeriesId").AsInt32()
|
||||||
.WithColumn("Path").AsString().Unique()
|
.WithColumn("Path").AsString().Unique()
|
||||||
.WithColumn("Quality").AsInt32()
|
.WithColumn("Quality").AsString()
|
||||||
.WithColumn("Proper").AsBoolean()
|
|
||||||
.WithColumn("Size").AsInt64()
|
.WithColumn("Size").AsInt64()
|
||||||
.WithColumn("DateAdded").AsDateTime()
|
.WithColumn("DateAdded").AsDateTime()
|
||||||
.WithColumn("SeasonNumber").AsInt32()
|
.WithColumn("SeasonNumber").AsInt32()
|
||||||
|
|
|
@ -6,13 +6,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
{
|
{
|
||||||
public class NotInQueueSpecification : IFetchableSpecification
|
public class NotInQueueSpecification : IFetchableSpecification
|
||||||
{
|
{
|
||||||
private readonly DownloadProvider _downloadProvider;
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||||
|
|
||||||
|
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider)
|
||||||
public NotInQueueSpecification(DownloadProvider downloadProvider)
|
|
||||||
{
|
{
|
||||||
_downloadProvider = downloadProvider;
|
_downloadClientProvider = downloadClientProvider;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RejectionReason
|
public string RejectionReason
|
||||||
|
@ -25,7 +23,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
|
|
||||||
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
||||||
{
|
{
|
||||||
return !_downloadProvider.GetActiveDownloadClient().IsInQueue(subject);
|
return !_downloadClientProvider.GetDownloadClient().IsInQueue(subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||||
{
|
{
|
||||||
foreach (var file in subject.Episodes.Select(c => c.EpisodeFile).Where(c => c != null))
|
foreach (var file in subject.Episodes.Select(c => c.EpisodeFile).Where(c => c != null))
|
||||||
{
|
{
|
||||||
_logger.Trace("Comparing file quality with report. Existing file is {0} proper:{1}", file.Quality, file.Proper);
|
_logger.Trace("Comparing file quality with report. Existing file is {0}", file.Quality);
|
||||||
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.QualityProfile, new QualityModel { Quality = file.Quality, Proper = file.Proper }, subject.Quality))
|
if (!_qualityUpgradableSpecification.IsUpgradable(subject.Series.QualityProfile, file.Quality, subject.Quality))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (subject.Quality.Proper && file.DateAdded < DateTime.Today.AddDays(-7))
|
if (subject.Quality.Proper && file.DateAdded < DateTime.Today.AddDays(-7))
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Download.Clients;
|
||||||
|
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||||
|
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Download
|
||||||
|
{
|
||||||
|
public interface IProvideDownloadClient
|
||||||
|
{
|
||||||
|
IDownloadClient GetDownloadClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DownloadClientProvider : IProvideDownloadClient
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly SabProvider _sabProvider;
|
||||||
|
private readonly IConfigService _configService;
|
||||||
|
private readonly BlackholeProvider _blackholeProvider;
|
||||||
|
private readonly PneumaticProvider _pneumaticProvider;
|
||||||
|
private readonly NzbgetProvider _nzbgetProvider;
|
||||||
|
|
||||||
|
|
||||||
|
public DownloadClientProvider(SabProvider sabProvider, IConfigService configService,
|
||||||
|
BlackholeProvider blackholeProvider,
|
||||||
|
PneumaticProvider pneumaticProvider,
|
||||||
|
NzbgetProvider nzbgetProvider)
|
||||||
|
{
|
||||||
|
_sabProvider = sabProvider;
|
||||||
|
_configService = configService;
|
||||||
|
_blackholeProvider = blackholeProvider;
|
||||||
|
_pneumaticProvider = pneumaticProvider;
|
||||||
|
_nzbgetProvider = nzbgetProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDownloadClient GetDownloadClient()
|
||||||
|
{
|
||||||
|
switch (_configService.DownloadClient)
|
||||||
|
{
|
||||||
|
case DownloadClientType.Blackhole:
|
||||||
|
return _blackholeProvider;
|
||||||
|
|
||||||
|
case DownloadClientType.Pneumatic:
|
||||||
|
return _pneumaticProvider;
|
||||||
|
|
||||||
|
case DownloadClientType.Nzbget:
|
||||||
|
return _nzbgetProvider;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return _sabProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,92 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using NLog;
|
|
||||||
using NzbDrone.Common.Eventing;
|
|
||||||
using NzbDrone.Core.Configuration;
|
|
||||||
using NzbDrone.Core.Download.Clients;
|
|
||||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
|
||||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
|
||||||
using NzbDrone.Core.Model;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Download
|
|
||||||
{
|
|
||||||
public interface IDownloadProvider
|
|
||||||
{
|
|
||||||
bool DownloadReport(EpisodeParseResult parseResult);
|
|
||||||
IDownloadClient GetActiveDownloadClient();
|
|
||||||
bool ContainsRecentEpisode(EpisodeParseResult parseResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DownloadProvider : IDownloadProvider
|
|
||||||
{
|
|
||||||
private readonly SabProvider _sabProvider;
|
|
||||||
private readonly IConfigService _configService;
|
|
||||||
private readonly BlackholeProvider _blackholeProvider;
|
|
||||||
private readonly PneumaticProvider _pneumaticProvider;
|
|
||||||
private readonly NzbgetProvider _nzbgetProvider;
|
|
||||||
private readonly IEventAggregator _eventAggregator;
|
|
||||||
private readonly Logger _logger;
|
|
||||||
|
|
||||||
|
|
||||||
public DownloadProvider(SabProvider sabProvider, IConfigService configService,
|
|
||||||
BlackholeProvider blackholeProvider,
|
|
||||||
PneumaticProvider pneumaticProvider,
|
|
||||||
NzbgetProvider nzbgetProvider,
|
|
||||||
IEventAggregator eventAggregator, Logger logger)
|
|
||||||
{
|
|
||||||
_sabProvider = sabProvider;
|
|
||||||
_configService = configService;
|
|
||||||
_blackholeProvider = blackholeProvider;
|
|
||||||
_pneumaticProvider = pneumaticProvider;
|
|
||||||
_nzbgetProvider = nzbgetProvider;
|
|
||||||
_eventAggregator = eventAggregator;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public virtual bool DownloadReport(EpisodeParseResult parseResult)
|
|
||||||
{
|
|
||||||
var downloadTitle = parseResult.OriginalString;
|
|
||||||
if (!_configService.DownloadClientUseSceneName)
|
|
||||||
{
|
|
||||||
downloadTitle = parseResult.GetDownloadTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
var provider = GetActiveDownloadClient();
|
|
||||||
var recentEpisode = ContainsRecentEpisode(parseResult);
|
|
||||||
|
|
||||||
bool success = provider.DownloadNzb(parseResult.NzbUrl, downloadTitle, recentEpisode);
|
|
||||||
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
_logger.Trace("Download added to Queue: {0}", downloadTitle);
|
|
||||||
_eventAggregator.Publish(new EpisodeGrabbedEvent(parseResult));
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IDownloadClient GetActiveDownloadClient()
|
|
||||||
{
|
|
||||||
switch (_configService.DownloadClient)
|
|
||||||
{
|
|
||||||
case DownloadClientType.Blackhole:
|
|
||||||
return _blackholeProvider;
|
|
||||||
|
|
||||||
case DownloadClientType.Pneumatic:
|
|
||||||
return _pneumaticProvider;
|
|
||||||
|
|
||||||
case DownloadClientType.Nzbget:
|
|
||||||
return _nzbgetProvider;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return _sabProvider;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool ContainsRecentEpisode(EpisodeParseResult parseResult)
|
|
||||||
{
|
|
||||||
return parseResult.Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-7));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Common.Eventing;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Download
|
||||||
|
{
|
||||||
|
public interface IDownloadService
|
||||||
|
{
|
||||||
|
bool DownloadReport(EpisodeParseResult parseResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DownloadService : IDownloadService
|
||||||
|
{
|
||||||
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||||
|
private readonly IConfigService _configService;
|
||||||
|
private readonly IEventAggregator _eventAggregator;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
|
||||||
|
public DownloadService(IProvideDownloadClient downloadClientProvider, IConfigService configService,
|
||||||
|
IEventAggregator eventAggregator, Logger logger)
|
||||||
|
{
|
||||||
|
_downloadClientProvider = downloadClientProvider;
|
||||||
|
_configService = configService;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool DownloadReport(EpisodeParseResult parseResult)
|
||||||
|
{
|
||||||
|
var downloadTitle = parseResult.OriginalString;
|
||||||
|
if (!_configService.DownloadClientUseSceneName)
|
||||||
|
{
|
||||||
|
downloadTitle = parseResult.GetDownloadTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
var provider = _downloadClientProvider.GetDownloadClient();
|
||||||
|
var recentEpisode = ContainsRecentEpisode(parseResult);
|
||||||
|
|
||||||
|
bool success = provider.DownloadNzb(parseResult.NzbUrl, downloadTitle, recentEpisode);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
_logger.Trace("Download added to Queue: {0}", downloadTitle);
|
||||||
|
_eventAggregator.Publish(new EpisodeGrabbedEvent(parseResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ContainsRecentEpisode(EpisodeParseResult parseResult)
|
||||||
|
{
|
||||||
|
return parseResult.Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-7));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,10 +19,10 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public DailyEpisodeSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
|
public DailyEpisodeSearch(IEpisodeService episodeService, IDownloadService downloadService, IIndexerService indexerService,
|
||||||
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
|
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
|
||||||
ISeriesRepository seriesRepository)
|
ISeriesRepository seriesRepository)
|
||||||
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
|
: base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
|
||||||
downloadDirector)
|
downloadDirector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public EpisodeSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
|
public EpisodeSearch(IEpisodeService episodeService, IDownloadService downloadService, IIndexerService indexerService,
|
||||||
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
|
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
|
||||||
ISeriesRepository seriesRepository)
|
ISeriesRepository seriesRepository)
|
||||||
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
|
: base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
|
||||||
downloadDirector)
|
downloadDirector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
private readonly ISeriesRepository _seriesRepository;
|
private readonly ISeriesRepository _seriesRepository;
|
||||||
private readonly IEpisodeService _episodeService;
|
private readonly IEpisodeService _episodeService;
|
||||||
private readonly IDownloadProvider _downloadProvider;
|
private readonly IDownloadService _downloadService;
|
||||||
private readonly ISceneMappingService _sceneMappingService;
|
private readonly ISceneMappingService _sceneMappingService;
|
||||||
private readonly IDownloadDirector DownloadDirector;
|
private readonly IDownloadDirector DownloadDirector;
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
protected IndexerSearchBase(ISeriesRepository seriesRepository, IEpisodeService episodeService, IDownloadProvider downloadProvider,
|
protected IndexerSearchBase(ISeriesRepository seriesRepository, IEpisodeService episodeService, IDownloadService downloadService,
|
||||||
IIndexerService indexerService, ISceneMappingService sceneMappingService,
|
IIndexerService indexerService, ISceneMappingService sceneMappingService,
|
||||||
IDownloadDirector downloadDirector)
|
IDownloadDirector downloadDirector)
|
||||||
{
|
{
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_episodeService = episodeService;
|
_episodeService = episodeService;
|
||||||
_downloadProvider = downloadProvider;
|
_downloadService = downloadService;
|
||||||
_indexerService = indexerService;
|
_indexerService = indexerService;
|
||||||
_sceneMappingService = sceneMappingService;
|
_sceneMappingService = sceneMappingService;
|
||||||
DownloadDirector = downloadDirector;
|
DownloadDirector = downloadDirector;
|
||||||
|
@ -117,7 +117,7 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
|
logger.Debug("Found '{0}'. Adding to download queue.", episodeParseResult);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_downloadProvider.DownloadReport(episodeParseResult))
|
if (_downloadService.DownloadReport(episodeParseResult))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
{
|
{
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public PartialSeasonSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
|
public PartialSeasonSearch(IEpisodeService episodeService, IDownloadService downloadService, IIndexerService indexerService,
|
||||||
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
|
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
|
||||||
ISeriesRepository seriesRepository)
|
ISeriesRepository seriesRepository)
|
||||||
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
|
: base(seriesRepository, episodeService, downloadService, indexerService, sceneMappingService,
|
||||||
downloadDirector)
|
downloadDirector)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Jobs.Implementations
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_qualityUpgradableSpecification.IsUpgradable(episode.Series.QualityProfile, episode.EpisodeFile.QualityModel))
|
if (!_qualityUpgradableSpecification.IsUpgradable(episode.Series.QualityProfile, episode.EpisodeFile.Quality))
|
||||||
{
|
{
|
||||||
logger.Info("Search for {0} was aborted, file in disk meets or exceeds Profile's Cutoff", episode);
|
logger.Info("Search for {0} was aborted, file in disk meets or exceeds Profile's Cutoff", episode);
|
||||||
notification.CurrentMessage = String.Format("Skipping search for {0}, the file you have is already at cutoff", episode);
|
notification.CurrentMessage = String.Format("Skipping search for {0}, the file you have is already at cutoff", episode);
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace NzbDrone.Core.Jobs.Implementations
|
||||||
{
|
{
|
||||||
public class RssSyncJob : IJob
|
public class RssSyncJob : IJob
|
||||||
{
|
{
|
||||||
private readonly DownloadProvider _downloadProvider;
|
private readonly DownloadService _downloadService;
|
||||||
private readonly IIndexerService _indexerService;
|
private readonly IIndexerService _indexerService;
|
||||||
private readonly IDownloadDirector DownloadDirector;
|
private readonly IDownloadDirector DownloadDirector;
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
|
@ -21,9 +21,9 @@ namespace NzbDrone.Core.Jobs.Implementations
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RssSyncJob(DownloadProvider downloadProvider, IIndexerService indexerService, IDownloadDirector downloadDirector, IConfigService configService)
|
public RssSyncJob(DownloadService downloadService, IIndexerService indexerService, IDownloadDirector downloadDirector, IConfigService configService)
|
||||||
{
|
{
|
||||||
_downloadProvider = downloadProvider;
|
_downloadService = downloadService;
|
||||||
_indexerService = indexerService;
|
_indexerService = indexerService;
|
||||||
DownloadDirector = downloadDirector;
|
DownloadDirector = downloadDirector;
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
|
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Jobs.Implementations
|
||||||
{
|
{
|
||||||
if (DownloadDirector.GetDownloadDecision(episodeParseResult).Approved)
|
if (DownloadDirector.GetDownloadDecision(episodeParseResult).Approved)
|
||||||
{
|
{
|
||||||
_downloadProvider.DownloadReport(episodeParseResult);
|
_downloadService.DownloadReport(episodeParseResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System.Linq;
|
using System;
|
||||||
using System;
|
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Qualities;
|
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles
|
namespace NzbDrone.Core.MediaFiles
|
||||||
|
@ -10,7 +8,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
{
|
{
|
||||||
public EpisodeFile()
|
public EpisodeFile()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EpisodeFile(EpisodeFile source)
|
public EpisodeFile(EpisodeFile source)
|
||||||
|
@ -19,32 +17,17 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
SeriesId = source.SeriesId;
|
SeriesId = source.SeriesId;
|
||||||
SeasonNumber = source.SeasonNumber;
|
SeasonNumber = source.SeasonNumber;
|
||||||
Path = source.Path;
|
Path = source.Path;
|
||||||
Quality = source.Quality;
|
|
||||||
Proper = source.Proper;
|
|
||||||
Size = source.Size;
|
Size = source.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public int SeasonNumber { get; set; }
|
public int SeasonNumber { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public Quality Quality { get; set; }
|
|
||||||
public bool Proper { get; set; }
|
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
public DateTime DateAdded { get; set; }
|
public DateTime DateAdded { get; set; }
|
||||||
public string SceneName { get; set; }
|
public string SceneName { get; set; }
|
||||||
public string ReleaseGroup { get; set; }
|
public string ReleaseGroup { get; set; }
|
||||||
|
|
||||||
public QualityModel QualityModel
|
public QualityModel Quality { get; set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new QualityModel(Quality, Proper);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Quality = value.Quality;
|
|
||||||
Proper = value.Proper;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -80,7 +80,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
|
|
||||||
var parseResult = Parser.ParsePath(episodeFile.Path);
|
var parseResult = Parser.ParsePath(episodeFile.Path);
|
||||||
parseResult.Series = series;
|
parseResult.Series = series;
|
||||||
parseResult.Quality = new QualityModel { Quality = episodeFile.Quality, Proper = episodeFile.Proper };
|
parseResult.Quality = episodeFile.Quality;
|
||||||
parseResult.Episodes = episodes;
|
parseResult.Episodes = episodes;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@
|
||||||
<Compile Include="DecisionEngine\Specifications\UpgradeDiskSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\UpgradeDiskSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\UpgradeHistorySpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\UpgradeHistorySpecification.cs" />
|
||||||
<Compile Include="Download\Clients\Sabnzbd\SabAutoConfigureService.cs" />
|
<Compile Include="Download\Clients\Sabnzbd\SabAutoConfigureService.cs" />
|
||||||
|
<Compile Include="Download\DownloadClientProvider.cs" />
|
||||||
<Compile Include="Download\EpisodeDownloadedEvent.cs" />
|
<Compile Include="Download\EpisodeDownloadedEvent.cs" />
|
||||||
<Compile Include="Download\EpisodeGrabbedEvent.cs" />
|
<Compile Include="Download\EpisodeGrabbedEvent.cs" />
|
||||||
<Compile Include="Download\SeriesRenamedEvent.cs" />
|
<Compile Include="Download\SeriesRenamedEvent.cs" />
|
||||||
|
@ -402,7 +403,7 @@
|
||||||
<Compile Include="Download\Clients\Sabnzbd\SabProvider.cs">
|
<Compile Include="Download\Clients\Sabnzbd\SabProvider.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Download\DownloadProvider.cs">
|
<Compile Include="Download\DownloadService.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Tv\EpisodeRepository.cs">
|
<Compile Include="Tv\EpisodeRepository.cs">
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
result += String.Format(" [{0}]", episodeFile.Quality);
|
result += String.Format(" [{0}]", episodeFile.Quality);
|
||||||
|
|
||||||
if (episodeFile.Proper)
|
if (episodeFile.Quality.Proper)
|
||||||
result += " [Proper]";
|
result += " [Proper]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace NzbDrone.Core.Providers
|
||||||
}
|
}
|
||||||
|
|
||||||
//Make sure this file is an upgrade for ALL episodes already on disk
|
//Make sure this file is an upgrade for ALL episodes already on disk
|
||||||
if (episodes.All(e => e.EpisodeFile == null || e.EpisodeFile.QualityModel <= parseResult.Quality))
|
if (episodes.All(e => e.EpisodeFile == null || e.EpisodeFile.Quality <= parseResult.Quality))
|
||||||
{
|
{
|
||||||
Logger.Debug("Deleting the existing file(s) on disk to upgrade to: {0}", filePath);
|
Logger.Debug("Deleting the existing file(s) on disk to upgrade to: {0}", filePath);
|
||||||
//Do the delete for files where there is already an episode on disk
|
//Do the delete for files where there is already an episode on disk
|
||||||
|
@ -152,8 +152,7 @@ namespace NzbDrone.Core.Providers
|
||||||
episodeFile.SeriesId = series.Id;
|
episodeFile.SeriesId = series.Id;
|
||||||
episodeFile.Path = filePath.NormalizePath();
|
episodeFile.Path = filePath.NormalizePath();
|
||||||
episodeFile.Size = size;
|
episodeFile.Size = size;
|
||||||
episodeFile.Quality = parseResult.Quality.Quality;
|
episodeFile.Quality = parseResult.Quality;
|
||||||
episodeFile.Proper = parseResult.Quality.Proper;
|
|
||||||
episodeFile.SeasonNumber = parseResult.SeasonNumber;
|
episodeFile.SeasonNumber = parseResult.SeasonNumber;
|
||||||
episodeFile.SceneName = Path.GetFileNameWithoutExtension(filePath.NormalizePath());
|
episodeFile.SceneName = Path.GetFileNameWithoutExtension(filePath.NormalizePath());
|
||||||
episodeFile.ReleaseGroup = parseResult.ReleaseGroup;
|
episodeFile.ReleaseGroup = parseResult.ReleaseGroup;
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Providers.Xbmc
|
||||||
payload[offset++] = (byte)iconType;
|
payload[offset++] = (byte)iconType;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
payload[offset++] = (byte)0;
|
payload[offset++] = 0;
|
||||||
|
|
||||||
Array.Copy(icon, 0, payload, caption.Length + message.Length + 7, icon.Length);
|
Array.Copy(icon, 0, payload, caption.Length + message.Length + 7, icon.Length);
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,16 @@ using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Eventing;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Datastore;
|
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.MediaFiles.Events;
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.MetadataSource;
|
using NzbDrone.Core.MetadataSource;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
|
||||||
using NzbDrone.Core.Tv.Events;
|
using NzbDrone.Core.Tv.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Tv
|
namespace NzbDrone.Core.Tv
|
||||||
{
|
{
|
||||||
public interface IEpisodeService
|
public interface IEpisodeService
|
||||||
{
|
{
|
||||||
void AddEpisode(Episode episode);
|
|
||||||
Episode GetEpisode(int id);
|
Episode GetEpisode(int id);
|
||||||
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber);
|
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber);
|
||||||
Episode GetEpisode(int seriesId, DateTime date);
|
Episode GetEpisode(int seriesId, DateTime date);
|
||||||
|
@ -33,7 +30,6 @@ namespace NzbDrone.Core.Tv
|
||||||
bool IsFirstOrLastEpisodeOfSeason(int seriesId, int seasonNumber, int episodeNumber);
|
bool IsFirstOrLastEpisodeOfSeason(int seriesId, int seasonNumber, int episodeNumber);
|
||||||
void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus);
|
void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus);
|
||||||
void UpdateEpisodes(List<Episode> episodes);
|
void UpdateEpisodes(List<Episode> episodes);
|
||||||
Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber);
|
|
||||||
List<Episode> EpisodesBetweenDates(DateTime start, DateTime end);
|
List<Episode> EpisodesBetweenDates(DateTime start, DateTime end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,11 +59,6 @@ namespace NzbDrone.Core.Tv
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEpisode(Episode episode)
|
|
||||||
{
|
|
||||||
episode.Ignored = _seasonRepository.IsIgnored(episode.SeriesId, episode.SeasonNumber);
|
|
||||||
_episodeRepository.Insert(episode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Episode GetEpisode(int id)
|
public Episode GetEpisode(int id)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +98,7 @@ namespace NzbDrone.Core.Tv
|
||||||
return new List<Episode>();
|
return new List<Episode>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.AirDate.Value);
|
var episodeInfo = GetEpisode(parseResult.Series.Id, parseResult.AirDate.Value);
|
||||||
|
|
||||||
if (episodeInfo != null)
|
if (episodeInfo != null)
|
||||||
{
|
{
|
||||||
|
@ -129,14 +120,14 @@ namespace NzbDrone.Core.Tv
|
||||||
Episode episodeInfo = null;
|
Episode episodeInfo = null;
|
||||||
|
|
||||||
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
|
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
|
||||||
episodeInfo = GetEpisodeBySceneNumbering(((ModelBase)parseResult.Series).Id, parseResult.SeasonNumber, episodeNumber);
|
episodeInfo = _episodeRepository.GetEpisodeBySceneNumbering(parseResult.Series.Id, parseResult.SeasonNumber, episodeNumber);
|
||||||
|
|
||||||
if (episodeInfo == null)
|
if (episodeInfo == null)
|
||||||
{
|
{
|
||||||
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.SeasonNumber, episodeNumber);
|
episodeInfo = GetEpisode(parseResult.Series.Id, parseResult.SeasonNumber, episodeNumber);
|
||||||
if (episodeInfo == null && parseResult.AirDate != null)
|
if (episodeInfo == null && parseResult.AirDate != null)
|
||||||
{
|
{
|
||||||
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).Id, parseResult.AirDate.Value);
|
episodeInfo = GetEpisode(parseResult.Series.Id, parseResult.AirDate.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,11 +353,6 @@ namespace NzbDrone.Core.Tv
|
||||||
_episodeRepository.UpdateMany(episodes);
|
_episodeRepository.UpdateMany(episodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber)
|
|
||||||
{
|
|
||||||
return _episodeRepository.GetEpisodeBySceneNumbering(seriesId, seasonNumber, episodeNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Episode> EpisodesBetweenDates(DateTime start, DateTime end)
|
public List<Episode> EpisodesBetweenDates(DateTime start, DateTime end)
|
||||||
{
|
{
|
||||||
return _episodeRepository.EpisodesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime());
|
return _episodeRepository.EpisodesBetweenDates(start.ToUniversalTime(), end.ToUniversalTime());
|
||||||
|
|
|
@ -11,12 +11,13 @@ namespace NzbDrone.Core.Tv
|
||||||
|
|
||||||
public Boolean Proper { get; set; }
|
public Boolean Proper { get; set; }
|
||||||
|
|
||||||
public QualityModel():this(Quality.Unknown, false)
|
public QualityModel()
|
||||||
|
: this(Quality.Unknown)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public QualityModel(Quality quality, Boolean proper)
|
public QualityModel(Quality quality, Boolean proper = false)
|
||||||
{
|
{
|
||||||
Quality = quality;
|
Quality = quality;
|
||||||
Proper = proper;
|
Proper = proper;
|
||||||
|
@ -113,8 +114,8 @@ namespace NzbDrone.Core.Tv
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(null, obj)) return false;
|
if (ReferenceEquals(null, obj)) return false;
|
||||||
if (ReferenceEquals(this, obj)) return true;
|
if (ReferenceEquals(this, obj)) return true;
|
||||||
if (obj.GetType() != typeof (QualityModel)) return false;
|
if (obj.GetType() != typeof(QualityModel)) return false;
|
||||||
return Equals((QualityModel) obj);
|
return Equals((QualityModel)obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ namespace NzbDrone.Core.Tv
|
||||||
foreach (var series in allSeries)
|
foreach (var series in allSeries)
|
||||||
{
|
{
|
||||||
//Only update parameters that can be changed in MassEdit
|
//Only update parameters that can be changed in MassEdit
|
||||||
var edited = editedSeries.Single(s => ((ModelBase)s).Id == series.Id);
|
var edited = editedSeries.Single(s => s.Id == series.Id);
|
||||||
series.QualityProfileId = edited.QualityProfileId;
|
series.QualityProfileId = edited.QualityProfileId;
|
||||||
series.Monitored = edited.Monitored;
|
series.Monitored = edited.Monitored;
|
||||||
series.SeasonFolder = edited.SeasonFolder;
|
series.SeasonFolder = edited.SeasonFolder;
|
||||||
|
|
Loading…
Reference in New Issue