mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Tests added
Series metadata will be created when series info is refreshed (and on add)
This commit is contained in:
parent
b50e16a456
commit
eee24aff1d
19
NzbDrone.App.Test/NzbDrone.App.Test.ncrunchproject
Normal file
19
NzbDrone.App.Test/NzbDrone.App.Test.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject
Normal file
19
NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Common/NzbDrone.Common.ncrunchproject
Normal file
19
NzbDrone.Common/NzbDrone.Common.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
@ -114,6 +114,8 @@
|
|||||||
<Compile Include="ProviderTests\AnalyticsProviderTests\AnalyticsProviderFixture.cs" />
|
<Compile Include="ProviderTests\AnalyticsProviderTests\AnalyticsProviderFixture.cs" />
|
||||||
<Compile Include="ProviderTests\ConfigProviderTests\ConfigCachingFixture.cs" />
|
<Compile Include="ProviderTests\ConfigProviderTests\ConfigCachingFixture.cs" />
|
||||||
<Compile Include="ProviderTests\BannerProviderTest.cs" />
|
<Compile Include="ProviderTests\BannerProviderTest.cs" />
|
||||||
|
<Compile Include="ProviderTests\Metadata\Xbmc_ForEpisodeFile_Fixture.cs" />
|
||||||
|
<Compile Include="ProviderTests\Metadata\Xbmc_ForSeries_Fixture.cs" />
|
||||||
<Compile Include="ProviderTests\SearchHistoryProviderTest.cs" />
|
<Compile Include="ProviderTests\SearchHistoryProviderTest.cs" />
|
||||||
<Compile Include="ProviderTests\PlexProviderTest.cs" />
|
<Compile Include="ProviderTests\PlexProviderTest.cs" />
|
||||||
<Compile Include="ProviderTests\SeasonProviderTest.cs" />
|
<Compile Include="ProviderTests\SeasonProviderTest.cs" />
|
||||||
|
19
NzbDrone.Core.Test/NzbDrone.Core.Test.ncrunchproject
Normal file
19
NzbDrone.Core.Test/NzbDrone.Core.Test.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
@ -172,7 +172,7 @@ public void RefreshEpisodeInfo_emptyRepo()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
@ -207,7 +207,7 @@ public void RefreshEpisodeInfo_should_set_older_than_1900_to_null()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ public void RefreshEpisodeInfo_should_set_older_than_1900_to_null_for_existing_e
|
|||||||
Db.Insert(fakeEpisode);
|
Db.Insert(fakeEpisode);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeTvDbEpisodes);
|
.Returns(fakeTvDbEpisodes);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
@ -285,7 +285,7 @@ public void RefreshEpisodeInfo_ignore_episode_zero()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ public void RefreshEpisodeInfo_should_skip_future_episodes_with_no_title()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ public void RefreshEpisodeInfo_should_skip_older_than_1900_year_episodes_with_no
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ public void RefreshEpisodeInfo_should_add_future_episodes_with_title()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ public void RefreshEpisodeInfo_should_add_old_episodes_with_no_title()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ public void RefreshEpisodeInfo_ignore_season_zero()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeEpisodes);
|
.Returns(fakeEpisodes);
|
||||||
|
|
||||||
Mocker.GetMock<SeasonProvider>()
|
Mocker.GetMock<SeasonProvider>()
|
||||||
@ -493,7 +493,7 @@ public void new_episodes_only_calls_Insert()
|
|||||||
var currentEpisodes = new List<Episode>();
|
var currentEpisodes = new List<Episode>();
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(tvdbSeries);
|
.Returns(tvdbSeries);
|
||||||
|
|
||||||
Mocker.GetMock<IDatabase>()
|
Mocker.GetMock<IDatabase>()
|
||||||
@ -528,7 +528,7 @@ public void existing_episodes_only_calls_Update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(tvdbSeries);
|
.Returns(tvdbSeries);
|
||||||
|
|
||||||
Mocker.GetMock<IDatabase>()
|
Mocker.GetMock<IDatabase>()
|
||||||
@ -565,7 +565,7 @@ public void should_try_to_get_existing_episode_using_tvdbid_first()
|
|||||||
.Returns(fakeEpisodeList);
|
.Returns(fakeEpisodeList);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(fakeTvDbResult);
|
.Returns(fakeTvDbResult);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
@ -602,7 +602,7 @@ public void should_try_to_get_existing_episode_using_tvdbid_first_then_season_ep
|
|||||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(tvdbSeries);
|
.Returns(tvdbSeries);
|
||||||
|
|
||||||
Mocker.GetMock<IDatabase>()
|
Mocker.GetMock<IDatabase>()
|
||||||
@ -634,7 +634,7 @@ public void existing_episodes_keep_their_episodeId_file_id()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
Mocker.GetMock<TvDbProvider>(MockBehavior.Strict)
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(tvdbSeries);
|
.Returns(tvdbSeries);
|
||||||
|
|
||||||
var updatedEpisodes = new List<Episode>();
|
var updatedEpisodes = new List<Episode>();
|
||||||
@ -695,7 +695,7 @@ public void RefreshEpisodeInfo_should_ignore_new_episode_for_ignored_season()
|
|||||||
Db.Insert(fakeEpisode);
|
Db.Insert(fakeEpisode);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(tvdbSeries);
|
.Returns(tvdbSeries);
|
||||||
|
|
||||||
Mocker.GetMock<SeasonProvider>()
|
Mocker.GetMock<SeasonProvider>()
|
||||||
@ -1407,7 +1407,7 @@ public void RefreshEpisodeInfo_should_ignore_episode_zero_except_if_season_one()
|
|||||||
Db.Insert(fakeSeries);
|
Db.Insert(fakeSeries);
|
||||||
|
|
||||||
Mocker.GetMock<TvDbProvider>()
|
Mocker.GetMock<TvDbProvider>()
|
||||||
.Setup(c => c.GetSeries(seriesId, true))
|
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||||
.Returns(tvdbSeries);
|
.Returns(tvdbSeries);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
@ -0,0 +1,153 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using FizzWare.NBuilder;
|
||||||
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
using NzbDrone.Core.Providers.Metadata;
|
||||||
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Test.Common.AutoMoq;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
using TvdbLib.Data;
|
||||||
|
using TvdbLib.Data.Banner;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
public class Xbmc_ForEpisoddeFile_Fixture : CoreTest
|
||||||
|
{
|
||||||
|
private Series series;
|
||||||
|
private EpisodeFile episodeFile;
|
||||||
|
private TvdbSeries tvdbSeries;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
WithTempAsAppPath();
|
||||||
|
|
||||||
|
series = Builder<Series>
|
||||||
|
.CreateNew()
|
||||||
|
.With(s => s.SeriesId == 79488)
|
||||||
|
.With(s => s.Title == "30 Rock")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
episodeFile = Builder<EpisodeFile>.CreateNew()
|
||||||
|
.With(f => f.SeriesId = 79488)
|
||||||
|
.With(f => f.SeasonNumber = 1)
|
||||||
|
.With(f => f.Path = @"C:\Test\30 Rock\Season 01\30 Rock - S01E01 - Pilot.avi")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var tvdbEpisodes = Builder<TvdbEpisode>.CreateListOfSize(2)
|
||||||
|
.All()
|
||||||
|
.With(e => e.SeriesId = 79488)
|
||||||
|
.With(e => e.SeasonNumber = 1)
|
||||||
|
.With(e => e.Directors = new List<string>{ "Fake Director" })
|
||||||
|
.With(e => e.Writer = new List<string>{ "Fake Writer" })
|
||||||
|
.With(e => e.GuestStars = new List<string> { "Guest Star 1", "Guest Star 2", "Guest Star 3", "" })
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var seasonBanners = Builder<TvdbSeasonBanner>
|
||||||
|
.CreateListOfSize(4)
|
||||||
|
.TheFirst(2)
|
||||||
|
.With(b => b.Season = 1)
|
||||||
|
.TheLast(2)
|
||||||
|
.With(b => b.Season = 2)
|
||||||
|
.TheFirst(1)
|
||||||
|
.With(b => b.BannerType = TvdbSeasonBanner.Type.season)
|
||||||
|
.With(b => b.BannerPath = "seasons/79488-1-1.jpg")
|
||||||
|
.TheNext(2)
|
||||||
|
.With(b => b.BannerType = TvdbSeasonBanner.Type.seasonwide)
|
||||||
|
.With(b => b.BannerPath = "banners/seasons/79488-test.jpg")
|
||||||
|
.TheLast(1)
|
||||||
|
.With(b => b.BannerType = TvdbSeasonBanner.Type.season)
|
||||||
|
.With(b => b.BannerPath = "seasons/79488-2-1.jpg")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var seriesActors = Builder<TvdbActor>
|
||||||
|
.CreateListOfSize(5)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
tvdbSeries = Builder<TvdbSeries>
|
||||||
|
.CreateNew()
|
||||||
|
.With(s => s.Id = 79488)
|
||||||
|
.With(s => s.SeriesName = "30 Rock")
|
||||||
|
.With(s => s.TvdbActors = seriesActors.ToList())
|
||||||
|
.With(s => s.Episodes = tvdbEpisodes.ToList())
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
tvdbSeries.Banners.AddRange(seasonBanners);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WithUseBanners()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WithSingleEpisodeFile()
|
||||||
|
{
|
||||||
|
var episode = Builder<Episode>.CreateNew()
|
||||||
|
.With(e => e.SeasonNumber = 1)
|
||||||
|
.With(e => e.SeriesId = 79488)
|
||||||
|
.With(e => e.EpisodeNumber = 1)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Mocker.GetMock<EpisodeProvider>()
|
||||||
|
.Setup(s => s.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
||||||
|
.Returns(new List<Episode> { episode });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WithMultiEpisodeFile()
|
||||||
|
{
|
||||||
|
var episodes = Builder<Episode>.CreateListOfSize(2)
|
||||||
|
.All()
|
||||||
|
.With(e => e.SeriesId = 79488)
|
||||||
|
.With(e => e.SeasonNumber = 1)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Mocker.GetMock<EpisodeProvider>()
|
||||||
|
.Setup(s => s.GetEpisodesByFileId(episodeFile.EpisodeFileId))
|
||||||
|
.Returns(episodes.ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_blowup()
|
||||||
|
{
|
||||||
|
WithSingleEpisodeFile();
|
||||||
|
Mocker.Resolve<Xbmc>().ForEpisodeFile(episodeFile, tvdbSeries);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_call_diskprovider_writeAllText_once_for_single_episode()
|
||||||
|
{
|
||||||
|
WithSingleEpisodeFile();
|
||||||
|
Mocker.Resolve<Xbmc>().ForEpisodeFile(episodeFile, tvdbSeries);
|
||||||
|
Mocker.GetMock<DiskProvider>().Verify(v => v.WriteAllText(episodeFile.Path.Replace("avi", "nfo"), It.IsAny<string>()), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_call_diskprovider_writeAllText_once_for_multi_episode()
|
||||||
|
{
|
||||||
|
WithMultiEpisodeFile();
|
||||||
|
Mocker.Resolve<Xbmc>().ForEpisodeFile(episodeFile, tvdbSeries);
|
||||||
|
Mocker.GetMock<DiskProvider>().Verify(v => v.WriteAllText(episodeFile.Path.Replace("avi", "nfo"), It.IsAny<string>()), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_download_thumbnail_when_thumbnail_path_is_not_null()
|
||||||
|
{
|
||||||
|
WithSingleEpisodeFile();
|
||||||
|
Mocker.Resolve<Xbmc>().ForEpisodeFile(episodeFile, tvdbSeries);
|
||||||
|
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(tvdbSeries.Episodes.First().BannerPath, episodeFile.Path.Replace("avi", "tbn")), Times.Once());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using FizzWare.NBuilder;
|
||||||
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
using NzbDrone.Core.Providers.Metadata;
|
||||||
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Test.Common.AutoMoq;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
using TvdbLib.Data;
|
||||||
|
using TvdbLib.Data.Banner;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.ProviderTests.Metadata
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
public class Xbmc_ForSeries_Fixture : CoreTest
|
||||||
|
{
|
||||||
|
private Series series;
|
||||||
|
private TvdbSeries tvdbSeries;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
WithTempAsAppPath();
|
||||||
|
|
||||||
|
series = Builder<Series>
|
||||||
|
.CreateNew()
|
||||||
|
.With(s => s.SeriesId == 79488)
|
||||||
|
.With(s => s.Title == "30 Rock")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var seasonBanners = Builder<TvdbSeasonBanner>
|
||||||
|
.CreateListOfSize(4)
|
||||||
|
.TheFirst(2)
|
||||||
|
.With(b => b.Season = 1)
|
||||||
|
.TheLast(2)
|
||||||
|
.With(b => b.Season = 2)
|
||||||
|
.TheFirst(1)
|
||||||
|
.With(b => b.BannerType = TvdbSeasonBanner.Type.season)
|
||||||
|
.With(b => b.BannerPath = "seasons/79488-1-1.jpg")
|
||||||
|
.TheNext(2)
|
||||||
|
.With(b => b.BannerType = TvdbSeasonBanner.Type.seasonwide)
|
||||||
|
.With(b => b.BannerPath = "banners/seasons/79488-test.jpg")
|
||||||
|
.TheLast(1)
|
||||||
|
.With(b => b.BannerType = TvdbSeasonBanner.Type.season)
|
||||||
|
.With(b => b.BannerPath = "seasons/79488-2-1.jpg")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var seriesActors = Builder<TvdbActor>
|
||||||
|
.CreateListOfSize(5)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
tvdbSeries = Builder<TvdbSeries>
|
||||||
|
.CreateNew()
|
||||||
|
.With(s => s.Id = 79488)
|
||||||
|
.With(s => s.SeriesName = "30 Rock")
|
||||||
|
.With(s => s.TvdbActors = seriesActors.ToList())
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
tvdbSeries.Banners.AddRange(seasonBanners);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WithUseBanners()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.MetadataUseBanners).Returns(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_blowup()
|
||||||
|
{
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_call_diskprovider_writeAllText()
|
||||||
|
{
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
Mocker.GetMock<DiskProvider>().Verify(v => v.WriteAllText(Path.Combine(series.Path, "tvshow.nfo"), It.IsAny<string>()), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_download_fanart()
|
||||||
|
{
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(tvdbSeries.FanartPath, Path.Combine(series.Path, "fanart.jpg")), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_download_poster_when_useBanners_is_false()
|
||||||
|
{
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(tvdbSeries.PosterPath, Path.Combine(series.Path, "folder.jpg")), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_download_banner_when_useBanners_is_true()
|
||||||
|
{
|
||||||
|
WithUseBanners();
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(tvdbSeries.BannerPath, Path.Combine(series.Path, "folder.jpg")), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_download_season_poster_when_useBanners_is_false()
|
||||||
|
{
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(It.Is<string>(s => !s.Contains("banners")), It.IsRegex(@"season\d{2}\.tbn")), Times.Exactly(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_download_season_banner_when_useBanners_is_true()
|
||||||
|
{
|
||||||
|
WithUseBanners();
|
||||||
|
Mocker.Resolve<Xbmc>().ForSeries(series, tvdbSeries);
|
||||||
|
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(It.Is<string>(s => s.Contains("banners")), It.IsRegex(@"season\d{2}\.tbn")), Times.Exactly(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Model.Metadata
|
namespace NzbDrone.Core.Model
|
||||||
{
|
{
|
||||||
public class MisnamedEpisodeModel
|
public class MisnamedEpisodeModel
|
||||||
{
|
{
|
||||||
|
@ -239,6 +239,7 @@
|
|||||||
<Compile Include="Datastore\Migrations\Migration20110726.cs" />
|
<Compile Include="Datastore\Migrations\Migration20110726.cs" />
|
||||||
<Compile Include="Datastore\Migrations\Migration20110707.cs" />
|
<Compile Include="Datastore\Migrations\Migration20110707.cs" />
|
||||||
<Compile Include="Datastore\DbProviderFactory.cs" />
|
<Compile Include="Datastore\DbProviderFactory.cs" />
|
||||||
|
<Compile Include="Datastore\Migrations\Migration20120707.cs" />
|
||||||
<Compile Include="Datastore\Migrations\NzbDroneMigration.cs" />
|
<Compile Include="Datastore\Migrations\NzbDroneMigration.cs" />
|
||||||
<Compile Include="Datastore\Migrations\SchemaInfo.cs" />
|
<Compile Include="Datastore\Migrations\SchemaInfo.cs" />
|
||||||
<Compile Include="Datastore\PetaPoco\EpisodeSeasonRelator.cs" />
|
<Compile Include="Datastore\PetaPoco\EpisodeSeasonRelator.cs" />
|
||||||
@ -284,6 +285,9 @@
|
|||||||
<Compile Include="Providers\Indexer\NzbIndex.cs" />
|
<Compile Include="Providers\Indexer\NzbIndex.cs" />
|
||||||
<Compile Include="Providers\Indexer\FileSharingTalk.cs" />
|
<Compile Include="Providers\Indexer\FileSharingTalk.cs" />
|
||||||
<Compile Include="Providers\Indexer\Wombles.cs" />
|
<Compile Include="Providers\Indexer\Wombles.cs" />
|
||||||
|
<Compile Include="Providers\MetadataProvider.cs" />
|
||||||
|
<Compile Include="Providers\Metadata\MetadataBase.cs" />
|
||||||
|
<Compile Include="Providers\Metadata\Xbmc.cs" />
|
||||||
<Compile Include="Providers\SearchHistoryProvider.cs" />
|
<Compile Include="Providers\SearchHistoryProvider.cs" />
|
||||||
<Compile Include="Providers\SeasonProvider.cs" />
|
<Compile Include="Providers\SeasonProvider.cs" />
|
||||||
<Compile Include="Jobs\RecentBacklogSearchJob.cs" />
|
<Compile Include="Jobs\RecentBacklogSearchJob.cs" />
|
||||||
@ -313,6 +317,7 @@
|
|||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Providers\StatsProvider.cs" />
|
<Compile Include="Providers\StatsProvider.cs" />
|
||||||
|
<Compile Include="Repository\MetadataDefinition.cs" />
|
||||||
<Compile Include="Repository\Search\SearchHistoryItem.cs" />
|
<Compile Include="Repository\Search\SearchHistoryItem.cs" />
|
||||||
<Compile Include="Repository\Search\SearchHistory.cs" />
|
<Compile Include="Repository\Search\SearchHistory.cs" />
|
||||||
<Compile Include="Model\ReportRejectionType.cs" />
|
<Compile Include="Model\ReportRejectionType.cs" />
|
||||||
|
19
NzbDrone.Core/NzbDrone.Core.ncrunchproject
Normal file
19
NzbDrone.Core/NzbDrone.Core.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Metadata
|
namespace NzbDrone.Core.Providers.Metadata
|
||||||
{
|
{
|
||||||
public abstract class Xbmc : MetadataBase
|
public class Xbmc : MetadataBase
|
||||||
{
|
{
|
||||||
protected readonly Logger _logger;
|
protected readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public Xbmc(ConfigProvider configProvider, DiskProvider diskProvider, BannerProvider bannerProvider, EpisodeProvider episodeProvider)
|
public Xbmc(ConfigProvider configProvider, DiskProvider diskProvider, BannerProvider bannerProvider, EpisodeProvider episodeProvider)
|
||||||
: base(configProvider, diskProvider, bannerProvider, episodeProvider)
|
: base(configProvider, diskProvider, bannerProvider, episodeProvider)
|
||||||
@ -71,22 +71,22 @@ public override void ForSeries(Series series, TvdbSeries tvDbSeries)
|
|||||||
_logger.Debug("Downloading fanart for: {0}", series.Title);
|
_logger.Debug("Downloading fanart for: {0}", series.Title);
|
||||||
_bannerProvider.Download(tvDbSeries.FanartPath, Path.Combine(series.Path, "fanart.jpg"));
|
_bannerProvider.Download(tvDbSeries.FanartPath, Path.Combine(series.Path, "fanart.jpg"));
|
||||||
|
|
||||||
if (!_configProvider.MetadataUseBanners)
|
if (_configProvider.MetadataUseBanners)
|
||||||
{
|
{
|
||||||
_logger.Debug("Downloading series thumbnail for: {0}", series.Title);
|
_logger.Debug("Downloading series banner for: {0}", series.Title);
|
||||||
_bannerProvider.Download(tvDbSeries.PosterPath, "folder.jpg");
|
_bannerProvider.Download(tvDbSeries.BannerPath, Path.Combine(series.Path, "folder.jpg"));
|
||||||
|
|
||||||
_logger.Debug("Downloading Season posters for {0}", series.Title);
|
_logger.Debug("Downloading Season banners for {0}", series.Title);
|
||||||
DownloadSeasonThumbnails(series, tvDbSeries, TvdbSeasonBanner.Type.season);
|
DownloadSeasonThumbnails(series, tvDbSeries, TvdbSeasonBanner.Type.seasonwide);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.Debug("Downloading series banner for: {0}", series.Title);
|
_logger.Debug("Downloading series thumbnail for: {0}", series.Title);
|
||||||
_bannerProvider.Download(tvDbSeries.BannerPath, "folder.jpg");
|
_bannerProvider.Download(tvDbSeries.PosterPath, Path.Combine(series.Path, "folder.jpg"));
|
||||||
|
|
||||||
_logger.Debug("Downloading Season banners for {0}", series.Title);
|
_logger.Debug("Downloading Season posters for {0}", series.Title);
|
||||||
DownloadSeasonThumbnails(series, tvDbSeries, TvdbSeasonBanner.Type.seasonwide);
|
DownloadSeasonThumbnails(series, tvDbSeries, TvdbSeasonBanner.Type.season);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,25 +114,33 @@ public override void ForEpisodeFile(EpisodeFile episodeFile, TvdbSeries tvDbSeri
|
|||||||
}
|
}
|
||||||
|
|
||||||
_logger.Debug("Downloading episode thumbnail for: {0}", episodeFile.EpisodeFileId);
|
_logger.Debug("Downloading episode thumbnail for: {0}", episodeFile.EpisodeFileId);
|
||||||
_bannerProvider.Download(episodeFileThumbnail.BannerPath, "folder.jpg");
|
_bannerProvider.Download(episodeFileThumbnail.BannerPath, episodeFile.Path.Replace(Path.GetExtension(episodeFile.Path), ".tbn"));
|
||||||
|
|
||||||
_logger.Debug("Generating filename.nfo for: {0}", episodeFile.EpisodeFileId);
|
_logger.Debug("Generating filename.nfo for: {0}", episodeFile.EpisodeFileId);
|
||||||
var sb = new StringBuilder();
|
|
||||||
var xws = new XmlWriterSettings();
|
|
||||||
xws.OmitXmlDeclaration = false;
|
|
||||||
xws.Indent = false;
|
|
||||||
|
|
||||||
using (var xw = XmlWriter.Create(sb, xws))
|
var xmlResult = String.Empty;
|
||||||
|
foreach (var episode in episodes)
|
||||||
{
|
{
|
||||||
var doc = new XDocument();
|
var sb = new StringBuilder();
|
||||||
|
var xws = new XmlWriterSettings();
|
||||||
|
xws.OmitXmlDeclaration = false;
|
||||||
|
xws.Indent = false;
|
||||||
|
|
||||||
foreach (var episode in episodes)
|
using (var xw = XmlWriter.Create(sb, xws))
|
||||||
{
|
{
|
||||||
var tvdbEpisode =
|
var doc = new XDocument();
|
||||||
tvDbSeries.Episodes.FirstOrDefault(
|
var tvdbEpisode = tvDbSeries.Episodes.FirstOrDefault(
|
||||||
e =>
|
e =>
|
||||||
e.SeasonNumber == episode.SeasonNumber &&
|
e.Id == episode.TvDbEpisodeId);
|
||||||
e.EpisodeNumber == episode.EpisodeNumber);
|
|
||||||
|
if (tvdbEpisode == null)
|
||||||
|
{
|
||||||
|
_logger.Debug("Looking up by TvDbEpisodeId failed, trying to match via season/episode number combination");
|
||||||
|
tvdbEpisode = tvDbSeries.Episodes.FirstOrDefault(
|
||||||
|
e =>
|
||||||
|
e.SeasonNumber == episode.SeasonNumber &&
|
||||||
|
e.EpisodeNumber == episode.EpisodeNumber);
|
||||||
|
}
|
||||||
|
|
||||||
if (tvdbEpisode == null)
|
if (tvdbEpisode == null)
|
||||||
{
|
{
|
||||||
@ -161,7 +169,7 @@ public override void ForEpisodeFile(EpisodeFile episodeFile, TvdbSeries tvDbSeri
|
|||||||
|
|
||||||
details.Add(new XElement("actor",
|
details.Add(new XElement("actor",
|
||||||
new XElement("name", actor)
|
new XElement("name", actor)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(var actor in tvDbSeries.TvdbActors)
|
foreach(var actor in tvDbSeries.TvdbActors)
|
||||||
@ -170,17 +178,17 @@ public override void ForEpisodeFile(EpisodeFile episodeFile, TvdbSeries tvDbSeri
|
|||||||
new XElement("name", actor.Name),
|
new XElement("name", actor.Name),
|
||||||
new XElement("role", actor.Role),
|
new XElement("role", actor.Role),
|
||||||
new XElement("thumb", actor.ActorImage)
|
new XElement("thumb", actor.ActorImage)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.Add(details);
|
doc.Add(details);
|
||||||
doc.Save(xw);
|
doc.Save(xw);
|
||||||
}
|
}
|
||||||
|
xmlResult += sb.ToString();
|
||||||
}
|
}
|
||||||
|
var filename = episodeFile.Path.Replace(Path.GetExtension(episodeFile.Path), ".nfo");
|
||||||
var filename = Path.GetFileNameWithoutExtension(episodeFile.Path) + ".nfo";
|
|
||||||
_logger.Debug("Saving episodedetails to: {0}", filename);
|
_logger.Debug("Saving episodedetails to: {0}", filename);
|
||||||
_diskProvider.WriteAllText(filename, sb.ToString());
|
_diskProvider.WriteAllText(filename, xmlResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DownloadSeasonThumbnails(Series series, TvdbSeries tvDbSeries, TvdbSeasonBanner.Type bannerType)
|
private void DownloadSeasonThumbnails(Series series, TvdbSeries tvDbSeries, TvdbSeasonBanner.Type bannerType)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
using NzbDrone.Core.Providers.Metadata;
|
using NzbDrone.Core.Providers.Metadata;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
|
using TvdbLib.Data;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
@ -92,6 +93,11 @@ public virtual void CreateForSeries(Series series)
|
|||||||
{
|
{
|
||||||
var tvDbSeries = _tvDbProvider.GetSeries(series.SeriesId, false, true);
|
var tvDbSeries = _tvDbProvider.GetSeries(series.SeriesId, false, true);
|
||||||
|
|
||||||
|
CreateForSeries(series, tvDbSeries);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void CreateForSeries(Series series, TvdbSeries tvDbSeries)
|
||||||
|
{
|
||||||
foreach (var provider in _metadataProviders.Where(i => GetSettings(i.GetType()).Enable))
|
foreach (var provider in _metadataProviders.Where(i => GetSettings(i.GetType()).Enable))
|
||||||
{
|
{
|
||||||
provider.ForSeries(series, tvDbSeries);
|
provider.ForSeries(series, tvDbSeries);
|
||||||
|
@ -20,17 +20,19 @@ public class SeriesProvider
|
|||||||
private readonly IDatabase _database;
|
private readonly IDatabase _database;
|
||||||
private readonly SceneMappingProvider _sceneNameMappingProvider;
|
private readonly SceneMappingProvider _sceneNameMappingProvider;
|
||||||
private readonly BannerProvider _bannerProvider;
|
private readonly BannerProvider _bannerProvider;
|
||||||
|
private readonly MetadataProvider _metadataProvider;
|
||||||
private static readonly Regex TimeRegex = new Regex(@"^(?<time>\d+:?\d*)\W*(?<meridiem>am|pm)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex TimeRegex = new Regex(@"^(?<time>\d+:?\d*)\W*(?<meridiem>am|pm)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
public SeriesProvider(IDatabase database, ConfigProvider configProviderProvider,
|
public SeriesProvider(IDatabase database, ConfigProvider configProviderProvider,
|
||||||
TvDbProvider tvDbProviderProvider, SceneMappingProvider sceneNameMappingProvider,
|
TvDbProvider tvDbProviderProvider, SceneMappingProvider sceneNameMappingProvider,
|
||||||
BannerProvider bannerProvider)
|
BannerProvider bannerProvider, MetadataProvider metadataProvider)
|
||||||
{
|
{
|
||||||
_database = database;
|
_database = database;
|
||||||
_configProvider = configProviderProvider;
|
_configProvider = configProviderProvider;
|
||||||
_tvDbProvider = tvDbProviderProvider;
|
_tvDbProvider = tvDbProviderProvider;
|
||||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||||
_bannerProvider = bannerProvider;
|
_bannerProvider = bannerProvider;
|
||||||
|
_metadataProvider = metadataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SeriesProvider()
|
public SeriesProvider()
|
||||||
@ -86,7 +88,7 @@ public virtual bool IsMonitored(long id)
|
|||||||
|
|
||||||
public virtual Series UpdateSeriesInfo(int seriesId)
|
public virtual Series UpdateSeriesInfo(int seriesId)
|
||||||
{
|
{
|
||||||
var tvDbSeries = _tvDbProvider.GetSeries(seriesId, false);
|
var tvDbSeries = _tvDbProvider.GetSeries(seriesId, false, true);
|
||||||
var series = GetSeries(seriesId);
|
var series = GetSeries(seriesId);
|
||||||
|
|
||||||
series.SeriesId = tvDbSeries.Id;
|
series.SeriesId = tvDbSeries.Id;
|
||||||
@ -103,6 +105,8 @@ public virtual Series UpdateSeriesInfo(int seriesId)
|
|||||||
series.Network = tvDbSeries.Network;
|
series.Network = tvDbSeries.Network;
|
||||||
|
|
||||||
UpdateSeries(series);
|
UpdateSeries(series);
|
||||||
|
_metadataProvider.CreateForSeries(series, tvDbSeries);
|
||||||
|
|
||||||
return series;
|
return series;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Test.Common/NzbDrone.Test.Common.ncrunchproject
Normal file
19
NzbDrone.Test.Common/NzbDrone.Test.Common.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.ncrunchproject
Normal file
19
NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Update.Test/NzbDrone.Update.Test.ncrunchproject
Normal file
19
NzbDrone.Update.Test/NzbDrone.Update.Test.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Update/NzbDrone.Update.ncrunchproject
Normal file
19
NzbDrone.Update/NzbDrone.Update.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
19
NzbDrone.Web/NzbDrone.Web.ncrunchproject
Normal file
19
NzbDrone.Web/NzbDrone.Web.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
@ -1,10 +1,12 @@
|
|||||||
<SolutionConfiguration>
|
<SolutionConfiguration>
|
||||||
<FileVersion>0</FileVersion>
|
<FileVersion>1</FileVersion>
|
||||||
<AutoEnableOnStartup>Default</AutoEnableOnStartup>
|
<AutoEnableOnStartup>True</AutoEnableOnStartup>
|
||||||
<AllowParallelTestExecution>false</AllowParallelTestExecution>
|
<AllowParallelTestExecution>false</AllowParallelTestExecution>
|
||||||
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
|
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
|
||||||
<FrameworkUtilisationTypeForGallio>UseStaticAnalysis</FrameworkUtilisationTypeForGallio>
|
<FrameworkUtilisationTypeForGallio>UseStaticAnalysis</FrameworkUtilisationTypeForGallio>
|
||||||
<FrameworkUtilisationTypeForMSpec>UseStaticAnalysis</FrameworkUtilisationTypeForMSpec>
|
<FrameworkUtilisationTypeForMSpec>UseStaticAnalysis</FrameworkUtilisationTypeForMSpec>
|
||||||
<FrameworkUtilisationTypeForMSTest>UseStaticAnalysis</FrameworkUtilisationTypeForMSTest>
|
<FrameworkUtilisationTypeForMSTest>UseStaticAnalysis</FrameworkUtilisationTypeForMSTest>
|
||||||
<EngineModes>Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk</EngineModes>
|
<EngineModes>Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk</EngineModes>
|
||||||
|
<MetricsExclusionList>
|
||||||
|
</MetricsExclusionList>
|
||||||
</SolutionConfiguration>
|
</SolutionConfiguration>
|
19
NzbDrone/NzbDrone.ncrunchproject
Normal file
19
NzbDrone/NzbDrone.ncrunchproject
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ProjectConfiguration>
|
||||||
|
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
|
||||||
|
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
|
||||||
|
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
|
||||||
|
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
|
||||||
|
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
|
||||||
|
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
|
||||||
|
<RunPreBuildEvents>false</RunPreBuildEvents>
|
||||||
|
<RunPostBuildEvents>false</RunPostBuildEvents>
|
||||||
|
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
|
||||||
|
<InstrumentAssembly>true</InstrumentAssembly>
|
||||||
|
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
|
||||||
|
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
|
||||||
|
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
|
||||||
|
<DefaultTestTimeout>60000</DefaultTestTimeout>
|
||||||
|
<UseBuildConfiguration />
|
||||||
|
<ProxyProcessPath />
|
||||||
|
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
|
||||||
|
</ProjectConfiguration>
|
Loading…
Reference in New Issue
Block a user