mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
fixed more tests.
This commit is contained in:
parent
a98d792c0d
commit
9931bab998
@ -66,9 +66,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
firstQuality = new QualityModel(QualityTypes.Bluray1080p, true);
|
||||
secondQuality = new QualityModel(QualityTypes.Bluray1080p, true);
|
||||
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 3)).Returns(firstQuality);
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 4)).Returns(secondQuality);
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 5)).Returns<QualityModel>(null);
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 4)).Returns(secondQuality);
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 5)).Returns<QualityModel>(null);
|
||||
}
|
||||
|
||||
private void WithFirstReportUpgradable()
|
||||
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
parseResultSingle.Quality = new QualityModel(QualityTypes.WEBDL1080p, false);
|
||||
firstQuality = new QualityModel(QualityTypes.WEBDL1080p, false);
|
||||
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.SeriesId, 12, 3)).Returns(firstQuality);
|
||||
Mocker.GetMock<HistoryService>().Setup(c => c.GetBestQualityInHistory(fakeSeries.OID, 12, 3)).Returns(firstQuality);
|
||||
|
||||
_upgradeHistory.IsSatisfiedBy(parseResultSingle).Should().BeFalse();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
.Build();
|
||||
|
||||
_episode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.With(e => e.Series = _series)
|
||||
.With(e => e.EpisodeFile = _episodeFile)
|
||||
.Build();
|
||||
|
@ -3,6 +3,7 @@ using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.Indexers
|
||||
|
||||
public class MockIndexer : IndexerBase
|
||||
{
|
||||
public MockIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||
public MockIndexer(HttpProvider httpProvider, IConfigService configService)
|
||||
: base(httpProvider, configService)
|
||||
{
|
||||
}
|
||||
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.Indexers
|
||||
|
||||
public class TestUrlIndexer : IndexerBase
|
||||
{
|
||||
public TestUrlIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||
public TestUrlIndexer(HttpProvider httpProvider, IConfigService configService)
|
||||
: base(httpProvider, configService)
|
||||
{
|
||||
}
|
||||
@ -187,7 +187,7 @@ namespace NzbDrone.Core.Test.Indexers
|
||||
|
||||
public class CustomParserIndexer : IndexerBase
|
||||
{
|
||||
public CustomParserIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||
public CustomParserIndexer(HttpProvider httpProvider, IConfigService configService)
|
||||
: base(httpProvider, configService)
|
||||
{
|
||||
}
|
||||
@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.Indexers
|
||||
|
||||
public class NotConfiguredIndexer : IndexerBase
|
||||
{
|
||||
public NotConfiguredIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||
public NotConfiguredIndexer(HttpProvider httpProvider, IConfigService configService)
|
||||
: base(httpProvider, configService)
|
||||
{
|
||||
}
|
||||
@ -300,7 +300,7 @@ namespace NzbDrone.Core.Test.Indexers
|
||||
|
||||
public class DefaultEnabledIndexer : IndexerBase
|
||||
{
|
||||
public DefaultEnabledIndexer(HttpProvider httpProvider, ConfigService configService)
|
||||
public DefaultEnabledIndexer(HttpProvider httpProvider, IConfigService configService)
|
||||
: base(httpProvider, configService)
|
||||
{
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
var episodes = Builder<Episode>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(e => e.Series = series)
|
||||
.With(e => e.SeriesId = series.SeriesId)
|
||||
.With(e => e.SeriesId = series.OID)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.Build();
|
||||
|
||||
@ -198,7 +198,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
var episodes = Builder<Episode>.CreateListOfSize(10)
|
||||
.TheFirst(5)
|
||||
.With(e => e.Series = series)
|
||||
.With(e => e.SeriesId = series.SeriesId)
|
||||
.With(e => e.SeriesId = series.OID)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.TheNext(5)
|
||||
.With(e => e.Series = series2)
|
||||
|
@ -82,10 +82,10 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.SeriesId))
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.OID))
|
||||
.Returns(series);
|
||||
|
||||
Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.SeriesId });
|
||||
Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.OID });
|
||||
VerifyDownloadMock(1);
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
public void series_specific_scan_should_scan_series()
|
||||
{
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12)
|
||||
.With(s => s.OID = 12)
|
||||
.Build();
|
||||
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(p => p.Get(series.SeriesId));
|
||||
.Setup(p => p.Get(series.OID));
|
||||
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>()
|
||||
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.SeriesId });
|
||||
Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.OID });
|
||||
|
||||
//Assert
|
||||
Mocker.VerifyAllMocks();
|
||||
@ -51,8 +51,8 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
public void job_with_no_target_should_scan_all_series()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1).With(s => s.SeriesId = 12)
|
||||
.TheNext(1).With(s => s.SeriesId = 15)
|
||||
.TheFirst(1).With(s => s.OID = 12)
|
||||
.TheNext(1).With(s => s.OID = 15)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
@ -77,8 +77,8 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
public void failed_scan_should_not_terminated_job()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1).With(s => s.SeriesId = 12)
|
||||
.TheNext(1).With(s => s.SeriesId = 15)
|
||||
.TheFirst(1).With(s => s.OID = 12)
|
||||
.TheNext(1).With(s => s.OID = 15)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
@ -104,8 +104,8 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
public void job_with_no_target_should_scan_series_with_episodes()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1).With(s => s.SeriesId = 12)
|
||||
.TheNext(1).With(s => s.SeriesId = 15)
|
||||
.TheFirst(1).With(s => s.OID = 12)
|
||||
.TheNext(1).With(s => s.OID = 15)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
|
@ -26,8 +26,8 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.All().With(s => s.LastInfoSync = null)
|
||||
.TheFirst(1).With(s => s.SeriesId = 12)
|
||||
.TheNext(1).With(s => s.SeriesId = 15)
|
||||
.TheFirst(1).With(s => s.OID = 12)
|
||||
.TheNext(1).With(s => s.OID = 15)
|
||||
.Build();
|
||||
|
||||
var notification = new ProgressNotification("Test");
|
||||
@ -40,11 +40,11 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
|
||||
|
||||
Mocker.GetMock<DiskScanJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
|
||||
.Callback(() => series[0].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<DiskScanJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)))
|
||||
.Callback(() => series[1].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<BannerDownloadJob>()
|
||||
@ -54,18 +54,18 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
|
||||
.Callback(() => series[0].LastInfoSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)))
|
||||
.Callback(() => series[1].LastInfoSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(series[0].SeriesId)).Returns(series[0]);
|
||||
.Setup(s => s.Get(series[0].OID)).Returns(series[0]);
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(series[1].SeriesId)).Returns(series[1]);
|
||||
.Setup(s => s.Get(series[1].OID)).Returns(series[1]);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
|
||||
@ -74,11 +74,11 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once());
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once());
|
||||
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.All().With(s => s.LastInfoSync = null)
|
||||
.TheFirst(1).With(s => s.SeriesId = 12)
|
||||
.TheNext(1).With(s => s.SeriesId = 15)
|
||||
.TheFirst(1).With(s => s.OID = 12)
|
||||
.TheNext(1).With(s => s.OID = 15)
|
||||
.Build();
|
||||
|
||||
var notification = new ProgressNotification("Test");
|
||||
@ -104,37 +104,37 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Returns(series);
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
|
||||
.Callback(() => series[0].LastInfoSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)))
|
||||
.Throws(new InvalidOperationException());
|
||||
|
||||
Mocker.GetMock<DiskScanJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)))
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)))
|
||||
.Callback(() => series[0].LastDiskSync = DateTime.Now);
|
||||
|
||||
Mocker.GetMock<BannerDownloadJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)));
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)));
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(series[0].SeriesId)).Returns(series[0]);
|
||||
.Setup(s => s.Get(series[0].OID)).Returns(series[0]);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(s => s.GetSeriesFiles(It.IsAny<int>())).Returns(new List<EpisodeFile>());
|
||||
|
||||
Mocker.GetMock<XemUpdateJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)));
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)));
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].OID)), Times.Once());
|
||||
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].SeriesId)), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].OID)), Times.Once());
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
|
||||
|
@ -37,11 +37,11 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(_series.SeriesId))
|
||||
.Setup(s => s.Get(_series.OID))
|
||||
.Returns(_series);
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(s => s.GetSeasonFiles(_series.SeriesId, 5))
|
||||
.Setup(s => s.GetSeasonFiles(_series.OID, 5))
|
||||
.Returns(_episodeFiles);
|
||||
}
|
||||
|
||||
@ -63,13 +63,13 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
public void should_throw_if_seasonId_is_less_than_zero()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = -10 }));
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = -10 }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_log_warning_if_no_episode_files_are_found()
|
||||
{
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = 10 });
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = 10 });
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
[Test]
|
||||
public void should_return_if_no_episodes_are_moved()
|
||||
{
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = 5 });
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = 5 });
|
||||
|
||||
Mocker.GetMock<MetadataProvider>().Verify(v => v.RemoveForEpisodeFiles(It.IsAny<List<EpisodeFile>>()), Times.Never());
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.JobTests
|
||||
public void should_return_process_metadata_if_files_are_moved()
|
||||
{
|
||||
WithMovedFiles();
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.SeriesId, SeasonNumber = 5 });
|
||||
Mocker.Resolve<RenameSeasonJob>().Start(_testNotification, new { SeriesId = _series.OID, SeasonNumber = 5 });
|
||||
|
||||
Mocker.GetMock<MetadataProvider>().Verify(v => v.RemoveForEpisodeFiles(It.IsAny<List<EpisodeFile>>()), Times.Once());
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
WithTempAsAppPath();
|
||||
|
||||
_series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12345)
|
||||
.With(s => s.OID = 12345)
|
||||
.Build();
|
||||
|
||||
var path = @"C:\Windows\Temp";
|
||||
|
@ -81,7 +81,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
.Build();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = seriesId)
|
||||
.With(s => s.OID = seriesId)
|
||||
.With(s => s.Title = "The Office")
|
||||
.Build();
|
||||
|
||||
|
@ -28,13 +28,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
public void should_not_move_file_if_source_and_destination_are_the_same_path()
|
||||
{
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 5)
|
||||
.With(s => s.OID = 5)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.With(e => e.SeriesId = fakeSeries.OID)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.EpisodeNumber = 1)
|
||||
.Build();
|
||||
@ -43,12 +43,12 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi"));
|
||||
|
||||
var file = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.SeriesId = fakeSeries.SeriesId)
|
||||
.With(f => f.SeriesId = fakeSeries.OID)
|
||||
.With(f => f.Path = fi.FullName)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(e => e.Get(fakeSeries.SeriesId))
|
||||
.Setup(e => e.Get(fakeSeries.OID))
|
||||
.Returns(fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
@ -74,13 +74,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
public void should_use_EpisodeFiles_quality()
|
||||
{
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 5)
|
||||
.With(s => s.OID = 5)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.With(e => e.SeriesId = fakeSeries.OID)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.EpisodeNumber = 1)
|
||||
.Build();
|
||||
@ -91,14 +91,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
const string message = "30 Rock - 1x01 - [WEBDL]";
|
||||
|
||||
var file = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.SeriesId = fakeSeries.SeriesId)
|
||||
.With(f => f.SeriesId = fakeSeries.OID)
|
||||
.With(f => f.Path = currentFilename)
|
||||
.With(f => f.Quality = QualityTypes.WEBDL720p)
|
||||
.With(f => f.Proper = false)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(e => e.Get(fakeSeries.SeriesId))
|
||||
.Setup(e => e.Get(fakeSeries.OID))
|
||||
.Returns(fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
@ -133,13 +133,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
public void should_log_error_and_return_null_when_source_file_does_not_exists()
|
||||
{
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 5)
|
||||
.With(s => s.OID = 5)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.With(e => e.SeriesId = fakeSeries.OID)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.EpisodeNumber = 1)
|
||||
.Build();
|
||||
@ -150,14 +150,14 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
const string message = "30 Rock - 1x01 - [WEBDL]";
|
||||
|
||||
var file = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.SeriesId = fakeSeries.SeriesId)
|
||||
.With(f => f.SeriesId = fakeSeries.OID)
|
||||
.With(f => f.Path = currentFilename)
|
||||
.With(f => f.Quality = QualityTypes.WEBDL720p)
|
||||
.With(f => f.Proper = false)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(e => e.Get(fakeSeries.SeriesId))
|
||||
.Setup(e => e.Get(fakeSeries.OID))
|
||||
.Returns(fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
|
@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Returns(true);
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12).Build();
|
||||
.With(s => s.OID = 12).Build();
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<DiskScanProvider>().Scan(series);
|
||||
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||
|
||||
series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.SeriesId == 79488)
|
||||
.With(s => s.OID == 79488)
|
||||
.With(s => s.Title == "30 Rock")
|
||||
.Build();
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||
|
||||
series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.SeriesId == 79488)
|
||||
.With(s => s.OID == 79488)
|
||||
.With(s => s.Title == "30 Rock")
|
||||
.Build();
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
||||
{
|
||||
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(f => f.SeriesId = fakeSeries.SeriesId)
|
||||
.With(f => f.SeriesId = fakeSeries.OID)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder)).Returns(fakeEpisodeFiles);
|
||||
@ -224,7 +224,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
||||
|
||||
var fakeEpisodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(f => f.SeriesId = fakeSeries.SeriesId)
|
||||
.With(f => f.SeriesId = fakeSeries.OID)
|
||||
.Build().ToList();
|
||||
|
||||
//Act
|
||||
|
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
||||
private void WithImportedFile(string file)
|
||||
{
|
||||
var fakeEpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.SeriesId = fakeSeries.SeriesId)
|
||||
.With(f => f.SeriesId = fakeSeries.OID)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Setup(s => s.ImportFile(fakeSeries, file)).Returns(fakeEpisodeFile);
|
||||
|
@ -138,11 +138,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.All()
|
||||
.With(s => s.SeriesType = SeriesType.Standard)
|
||||
.TheFirst(1)
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.TheNext(1)
|
||||
.With(s => s.SeriesId = 11)
|
||||
.With(s => s.OID = 11)
|
||||
.TheNext(1)
|
||||
.With(s => s.SeriesId = 12)
|
||||
.With(s => s.OID = 12)
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(fakeSeries);
|
||||
@ -170,12 +170,12 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.All()
|
||||
.With(s => s.SeriesType = SeriesType.Standard)
|
||||
.TheFirst(1)
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.With(s => s.SeriesType = SeriesType.Daily)
|
||||
.TheNext(1)
|
||||
.With(s => s.SeriesId = 11)
|
||||
.With(s => s.OID = 11)
|
||||
.TheNext(1)
|
||||
.With(s => s.SeriesId = 12)
|
||||
.With(s => s.OID = 12)
|
||||
.Build();
|
||||
|
||||
Db.InsertMany(fakeSeries);
|
||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
|
||||
_searchHistory = Builder<SearchHistory>.CreateNew()
|
||||
.With(h => h.EpisodeId = _episode.OID)
|
||||
.With(h => h.SeriesId - _series.SeriesId)
|
||||
.With(h => h.SeriesId - _series.OID)
|
||||
.With(h => h.SearchHistoryItems = items)
|
||||
.Build();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.DailyEpisodeSearchTests
|
||||
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.With(e => e.Series = _series)
|
||||
.Build();
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.EpisodeSearchTests
|
||||
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.With(e => e.Series = _series)
|
||||
.Build();
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
||||
private void WithSceneMapping()
|
||||
{
|
||||
Mocker.GetMock<SceneMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(_series.SeriesId, -1))
|
||||
.Setup(s => s.GetSceneName(_series.OID, -1))
|
||||
.Returns("Hawaii Five 0 2010");
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
||||
public void should_return_season_scene_name_when_one_exists()
|
||||
{
|
||||
Mocker.GetMock<SceneMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(_series.SeriesId, 5))
|
||||
.Setup(s => s.GetSceneName(_series.OID, 5))
|
||||
.Returns("Hawaii Five 0 2010 - Season 5");
|
||||
|
||||
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
|
||||
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
||||
_series.Title = input;
|
||||
|
||||
Mocker.GetMock<SceneMappingProvider>()
|
||||
.Setup(s => s.GetSceneName(_series.SeriesId, -1))
|
||||
.Setup(s => s.GetSceneName(_series.OID, -1))
|
||||
.Returns("");
|
||||
|
||||
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
|
||||
|
@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests.PartialSeasonSearchTests
|
||||
_episodes = Builder<Episode>
|
||||
.CreateListOfSize(10)
|
||||
.All()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.With(e => e.Series = _series)
|
||||
.Build()
|
||||
.ToList();
|
||||
|
@ -36,14 +36,14 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
||||
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.With(e => e.Series = _series)
|
||||
.Build();
|
||||
|
||||
_episodes = Builder<Episode>
|
||||
.CreateListOfSize(10)
|
||||
.All()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.With(e => e.Series = _series)
|
||||
.Build()
|
||||
.ToList();
|
||||
|
@ -36,12 +36,12 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
||||
public void Setup()
|
||||
{
|
||||
_matchingSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
_mismatchedSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12345)
|
||||
.With(s => s.OID = 12345)
|
||||
.With(s => s.Title = "Not 30 Rock")
|
||||
.Build();
|
||||
|
||||
|
@ -46,11 +46,11 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisode(_series.SeriesId, 1, 1))
|
||||
.Setup(s => s.GetEpisode(_series.OID, 1, 1))
|
||||
.Returns(_episode);
|
||||
|
||||
Mocker.GetMock<SceneMappingProvider>()
|
||||
.Setup(s => s.GetCleanName(_series.SeriesId))
|
||||
.Setup(s => s.GetCleanName(_series.OID))
|
||||
.Returns("");
|
||||
|
||||
Mocker.GetMock<TvRageProvider>()
|
||||
|
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
.Build();
|
||||
|
||||
series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 1)
|
||||
.With(s => s.OID = 1)
|
||||
.And(c => c.Monitored = true)
|
||||
.Build();
|
||||
|
||||
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
|
||||
//Assert
|
||||
result.Should().HaveCount(5);
|
||||
result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.SeriesId);
|
||||
result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.OID);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -465,7 +465,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video,smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/))";
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
@ -491,7 +491,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var url = "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn(UpdateLibrary(video))";
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
@ -519,7 +519,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
@ -552,7 +552,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
@ -585,7 +585,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
@ -617,7 +617,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
var tvshows = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 79488)
|
||||
.With(s => s.OID = 79488)
|
||||
.With(s => s.Title = "30 Rock")
|
||||
.Build();
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 1)
|
||||
.With(s => s.OID = 1)
|
||||
.Build();
|
||||
var fakeEpisodes = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = 1)
|
||||
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
Db.Insert(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.SeriesId, 2, 1);
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.OID, 2, 1);
|
||||
|
||||
//Assert
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes);
|
||||
@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12)
|
||||
.With(s => s.OID = 12)
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(10)
|
||||
@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -196,7 +196,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -237,7 +237,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
Db.Insert(fakeSeries);
|
||||
@ -274,7 +274,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -313,7 +313,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -351,7 +351,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -384,7 +384,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -417,7 +417,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -452,7 +452,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -484,7 +484,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
|
||||
@ -515,7 +515,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
foreach (var tvDbEpisode in tvdbSeries.Episodes)
|
||||
@ -553,7 +553,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
)
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
var fakeEpisodeList = new List<Episode> { new Episode { TvDbEpisodeId = 99, SeasonNumber = 10, EpisodeNumber = 10, Series = fakeSeries } };
|
||||
|
||||
Mocker.GetMock<IDatabase>()
|
||||
@ -595,7 +595,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build();
|
||||
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||
@ -621,7 +621,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
foreach (var tvDbEpisode in tvdbSeries.Episodes)
|
||||
@ -670,7 +670,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
foreach (var tvDbEpisode in tvdbSeries.Episodes)
|
||||
@ -716,7 +716,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.With(c => c.Episodes = new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(5).Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
var currentEpisodes = new List<Episode>();
|
||||
foreach (var tvDbEpisode in tvdbSeries.Episodes)
|
||||
@ -784,7 +784,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
@ -1121,7 +1121,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(4)
|
||||
@ -1164,7 +1164,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(4)
|
||||
@ -1208,7 +1208,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.Build();
|
||||
|
||||
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
@ -1252,7 +1252,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.Build();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(2)
|
||||
@ -1281,7 +1281,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.Build();
|
||||
|
||||
var fakeEpisodes = Builder<Episode>.CreateListOfSize(2)
|
||||
@ -1308,7 +1308,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 10)
|
||||
.With(s => s.OID = 10)
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
@ -1400,7 +1400,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithRealDb();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12345)
|
||||
.With(s => s.OID = 12345)
|
||||
.With(s => s.CleanTitle = "officeus")
|
||||
.Build();
|
||||
|
||||
@ -1432,7 +1432,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
var postDownloadStatus = PostDownloadStatusType.Failed;
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(s => s.SeriesId = 12345)
|
||||
.With(s => s.OID = 12345)
|
||||
.With(s => s.CleanTitle = "officeus")
|
||||
.Build();
|
||||
|
||||
@ -1489,7 +1489,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.OID = seriesId).Build();
|
||||
|
||||
WithRealDb();
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesId = seriesId)
|
||||
.With(c => c.OID = seriesId)
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesId = seriesId)
|
||||
.With(c => c.OID = seriesId)
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
@ -101,7 +101,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesId = seriesId)
|
||||
.With(c => c.OID = seriesId)
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesId = seriesId)
|
||||
.With(c => c.OID = seriesId)
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
@ -174,7 +174,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesId = seriesId)
|
||||
.With(c => c.OID = seriesId)
|
||||
.Build();
|
||||
|
||||
var fakeEpisode = Builder<Episode>.CreateNew()
|
||||
@ -186,7 +186,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
|
||||
//Other Series
|
||||
var otherFakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.SeriesId = 12345)
|
||||
.With(c => c.OID = 12345)
|
||||
.Build();
|
||||
|
||||
var otherFakeEpisode = Builder<Episode>.CreateNew()
|
||||
|
@ -36,19 +36,19 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
.Build();
|
||||
|
||||
fakeEpisode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.With(e => e.SeriesId = fakeSeries.OID)
|
||||
.With(e => e.Title = "Episode (1)")
|
||||
.Build();
|
||||
|
||||
fakeEpisode2 = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.With(e => e.SeriesId = fakeSeries.OID)
|
||||
.With(e => e.SeasonNumber = fakeEpisode.SeasonNumber)
|
||||
.With(e => e.EpisodeNumber = fakeEpisode.EpisodeNumber + 1)
|
||||
.With(e => e.Title = "Episode (2)")
|
||||
.Build();
|
||||
|
||||
fakeDailyEpisode = Builder<Episode>.CreateNew()
|
||||
.With(e => e.SeriesId = fakeSeries.SeriesId)
|
||||
.With(e => e.SeriesId = fakeSeries.OID)
|
||||
.With(e => e.AirDate = DateTime.Now.Date)
|
||||
.With(e => e.Title = "Daily Episode 1")
|
||||
.Build();
|
||||
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
{
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.Build();
|
||||
|
||||
Db.Insert(_episode);
|
||||
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
{
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
.With(e => e.SeriesId = _series.SeriesId)
|
||||
.With(e => e.SeriesId = _series.OID)
|
||||
.Build();
|
||||
|
||||
Db.Insert(_episode);
|
||||
@ -52,14 +52,14 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
[Test]
|
||||
public void should_return_null_if_no_episodes_in_db()
|
||||
{
|
||||
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.SeriesId, 1, 1).Should().BeNull();
|
||||
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.OID, 1, 1).Should().BeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_null_if_no_matching_episode_is_found()
|
||||
{
|
||||
WithNullSceneNumbering();
|
||||
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.SeriesId, 1, 1).Should().BeNull();
|
||||
Mocker.Resolve<EpisodeService>().GetEpisodeBySceneNumbering(_series.OID, 1, 1).Should().BeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
WithSceneNumbering();
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>()
|
||||
.GetEpisodeBySceneNumbering(_series.SeriesId, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
|
||||
.GetEpisodeBySceneNumbering(_series.OID, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber);
|
||||
|
||||
result.OID.Should().Be(_episode.OID);
|
||||
}
|
||||
|
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -30,7 +30,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
foreach (var episode in subject.Episodes)
|
||||
{
|
||||
var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.SeriesId, episode.SeasonNumber, episode.EpisodeNumber);
|
||||
var bestQualityInHistory = _historyService.GetBestQualityInHistory(subject.Series.OID, episode.SeasonNumber, episode.EpisodeNumber);
|
||||
if (bestQualityInHistory != null)
|
||||
{
|
||||
logger.Trace("Comparing history quality with report. History is {0}", bestQualityInHistory);
|
||||
|
@ -27,7 +27,7 @@ namespace NzbDrone.Core.History
|
||||
|
||||
public QualityModel GetBestQualityInHistory(int seriesId, int seasonNumber, int episodeNumber)
|
||||
{
|
||||
var history = Queryable.OrderByDescending(c => c.Quality).FirstOrDefault(c => c.Episode.Series.SeriesId == seriesId && c.Episode.SeasonNumber == seasonNumber &&
|
||||
var history = Queryable.OrderByDescending(c => c.Quality).FirstOrDefault(c => c.Episode.Series.OID == seriesId && c.Episode.SeasonNumber == seasonNumber &&
|
||||
c.Episode.EpisodeNumber == episodeNumber);
|
||||
|
||||
if (history != null)
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -65,7 +66,7 @@ namespace NzbDrone.Core.Jobs
|
||||
|
||||
private void ScanSeries(ProgressNotification notification)
|
||||
{
|
||||
var syncList = _seriesRepository.All().Where(s => s.LastInfoSync == null && !_attemptedSeries.Contains(s.SeriesId)).ToList();
|
||||
var syncList = _seriesRepository.All().Where(s => s.LastInfoSync == null && !_attemptedSeries.Contains(s.OID)).ToList();
|
||||
if (syncList.Count == 0)
|
||||
{
|
||||
return;
|
||||
@ -75,20 +76,20 @@ namespace NzbDrone.Core.Jobs
|
||||
{
|
||||
try
|
||||
{
|
||||
_attemptedSeries.Add(currentSeries.OID);
|
||||
_attemptedSeries.Add(((ModelBase)currentSeries).OID);
|
||||
notification.CurrentMessage = String.Format("Searching for '{0}'", new DirectoryInfo(currentSeries.Path).Name);
|
||||
|
||||
_updateInfoJob.Start(notification, new { SeriesId = currentSeries.OID });
|
||||
_diskScanJob.Start(notification, new { SeriesId = currentSeries.OID });
|
||||
_updateInfoJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID });
|
||||
_diskScanJob.Start(notification, new { SeriesId = ((ModelBase)currentSeries).OID });
|
||||
|
||||
var updatedSeries = _seriesRepository.Get(currentSeries.OID);
|
||||
AutoIgnoreSeasons(updatedSeries.OID);
|
||||
var updatedSeries = _seriesRepository.Get(((ModelBase)currentSeries).OID);
|
||||
AutoIgnoreSeasons(((ModelBase)updatedSeries).OID);
|
||||
|
||||
//Download the banner for the new series
|
||||
_bannerDownloadJob.Start(notification, new { SeriesId = updatedSeries.OID });
|
||||
_bannerDownloadJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).OID });
|
||||
|
||||
//Get Scene Numbering if applicable
|
||||
_xemUpdateJob.Start(notification, new { SeriesId = updatedSeries.OID });
|
||||
_xemUpdateJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).OID });
|
||||
|
||||
notification.CurrentMessage = String.Format("{0} was successfully imported", updatedSeries.Title);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
|
@ -6,6 +6,7 @@ using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.ExternalNotification;
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Tv;
|
||||
@ -109,7 +110,7 @@ namespace NzbDrone.Core.Providers.Search
|
||||
logger.Trace("Analysing report " + episodeParseResult);
|
||||
episodeParseResult.Series = _seriesRepository.GetByTitle(episodeParseResult.CleanTitle);
|
||||
|
||||
if(episodeParseResult.Series == null || episodeParseResult.Series.OID != series.OID)
|
||||
if(episodeParseResult.Series == null || ((ModelBase)episodeParseResult.Series).OID != series.OID)
|
||||
{
|
||||
item.SearchError = ReportRejectionType.WrongSeries;
|
||||
continue;
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Model.TvRage;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -33,7 +34,7 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
var firstEpisode = _episodeService.GetEpisode(series.OID, 1, 1);
|
||||
|
||||
var cleanName = _sceneMappingProvider.GetCleanName(series.SeriesId);
|
||||
var cleanName = _sceneMappingProvider.GetCleanName(series.OID);
|
||||
var results = _tvRageProvider.SearchSeries(series.Title);
|
||||
var result = ProcessResults(results, series, cleanName, firstEpisode);
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace NzbDrone.Core.Providers
|
||||
Logger.Trace("Failed to get TV Shows from XBMC");
|
||||
|
||||
else
|
||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title);
|
||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.OID || s.Label == series.Title);
|
||||
|
||||
//var hostOnly = GetHostWithoutPort(host);
|
||||
|
||||
@ -179,7 +179,7 @@ namespace NzbDrone.Core.Providers
|
||||
Logger.Trace("Failed to get TV Shows from XBMC");
|
||||
|
||||
else
|
||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title);
|
||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.OID || s.Label == series.Title);
|
||||
|
||||
var postJson = new JObject();
|
||||
postJson.Add(new JProperty("jsonrpc", "2.0"));
|
||||
@ -221,7 +221,7 @@ namespace NzbDrone.Core.Providers
|
||||
try
|
||||
{
|
||||
Logger.Trace("Sending Update DB Request to XBMC Host: {0}", host);
|
||||
var xbmcSeriesPath = GetXbmcSeriesPath(host, series.SeriesId, username, password);
|
||||
var xbmcSeriesPath = GetXbmcSeriesPath(host, series.OID, username, password);
|
||||
|
||||
//If the path is found update it, else update the whole library
|
||||
if (!String.IsNullOrEmpty(xbmcSeriesPath))
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
@ -37,7 +38,7 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
var ids = _xemCommunicationProvider.GetXemSeriesIds();
|
||||
var series = _seriesRepository.All();
|
||||
var wantedSeries = series.Where(s => ids.Contains(s.SeriesId)).ToList();
|
||||
var wantedSeries = series.Where(s => ids.Contains(s.OID)).ToList();
|
||||
|
||||
foreach(var ser in wantedSeries)
|
||||
{
|
||||
@ -81,7 +82,7 @@ namespace NzbDrone.Core.Providers
|
||||
try
|
||||
{
|
||||
var episodesToUpdate = new List<Episode>();
|
||||
var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.SeriesId);
|
||||
var mappings = _xemCommunicationProvider.GetSceneTvdbMappings(series.OID);
|
||||
|
||||
if (mappings == null)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Eventing;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -94,7 +95,7 @@ namespace NzbDrone.Core.Tv
|
||||
return new List<Episode>();
|
||||
}
|
||||
|
||||
var episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.AirDate.Value);
|
||||
var episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.AirDate.Value);
|
||||
|
||||
if (episodeInfo != null)
|
||||
{
|
||||
@ -116,14 +117,14 @@ namespace NzbDrone.Core.Tv
|
||||
Episode episodeInfo = null;
|
||||
|
||||
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
|
||||
episodeInfo = GetEpisodeBySceneNumbering(parseResult.Series.OID, parseResult.SeasonNumber, episodeNumber);
|
||||
episodeInfo = GetEpisodeBySceneNumbering(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber);
|
||||
|
||||
if (episodeInfo == null)
|
||||
{
|
||||
episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.SeasonNumber, episodeNumber);
|
||||
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.SeasonNumber, episodeNumber);
|
||||
if (episodeInfo == null && parseResult.AirDate != null)
|
||||
{
|
||||
episodeInfo = GetEpisode(parseResult.Series.OID, parseResult.AirDate.Value);
|
||||
episodeInfo = GetEpisode(((ModelBase)parseResult.Series).OID, parseResult.AirDate.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +181,7 @@ namespace NzbDrone.Core.Tv
|
||||
var successCount = 0;
|
||||
var failCount = 0;
|
||||
|
||||
var tvdbEpisodes = _tvDbProvider.GetSeries(series.SeriesId, true)
|
||||
var tvdbEpisodes = _tvDbProvider.GetSeries(series.OID, true)
|
||||
.Episodes
|
||||
.Where(episode => !string.IsNullOrWhiteSpace(episode.EpisodeName) ||
|
||||
(episode.FirstAired < DateTime.Now.AddDays(2) && episode.FirstAired.Year > 1900))
|
||||
|
@ -19,7 +19,7 @@ namespace NzbDrone.Core.Tv
|
||||
|
||||
public class Series : ModelBase
|
||||
{
|
||||
public virtual int SeriesId { get; set; }
|
||||
public int TvDbId { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
|
@ -6,6 +6,7 @@ using NLog;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Eventing;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -58,7 +59,7 @@ namespace NzbDrone.Core.Tv
|
||||
public Series UpdateSeriesInfo(int seriesId)
|
||||
{
|
||||
var series = _seriesRepository.Get(seriesId);
|
||||
var tvDbSeries = _tvDbProvider.GetSeries(series.SeriesId, false, true);
|
||||
var tvDbSeries = _tvDbProvider.GetSeries(series.OID, false, true);
|
||||
|
||||
series.Title = tvDbSeries.SeriesName;
|
||||
series.AirTime = CleanAirsTime(tvDbSeries.AirsTime);
|
||||
@ -118,7 +119,7 @@ namespace NzbDrone.Core.Tv
|
||||
Ensure.That(() => path).IsNotNullOrWhiteSpace();
|
||||
|
||||
var repoSeries = new Series();
|
||||
repoSeries.SeriesId = tvDbSeriesId;
|
||||
repoSeries.TvDbId = tvDbSeriesId;
|
||||
repoSeries.Path = path;
|
||||
repoSeries.Monitored = true;
|
||||
repoSeries.QualityProfileId = qualityProfileId;
|
||||
@ -145,7 +146,7 @@ namespace NzbDrone.Core.Tv
|
||||
foreach (var series in allSeries)
|
||||
{
|
||||
//Only update parameters that can be changed in MassEdit
|
||||
var edited = editedSeries.Single(s => s.OID == series.OID);
|
||||
var edited = editedSeries.Single(s => ((ModelBase)s).OID == series.OID);
|
||||
series.QualityProfileId = edited.QualityProfileId;
|
||||
series.Monitored = edited.Monitored;
|
||||
series.SeasonFolder = edited.SeasonFolder;
|
||||
|
Loading…
Reference in New Issue
Block a user