1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

automatically download banner,poster, fanart. without a job :D

This commit is contained in:
kay.one 2013-03-03 21:53:02 -08:00
parent 62c1be1634
commit 1ccbb3c9d8
42 changed files with 245 additions and 483 deletions

View File

@ -2,25 +2,26 @@
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Api.QualityType;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Providers;
namespace NzbDrone.Api.Series
{
public class SeriesLookupModule : NzbDroneApiModule
{
private readonly TvDbProvider _tvDbProvider;
private readonly TvDbProxy _tvDbProxy;
public SeriesLookupModule(TvDbProvider tvDbProvider)
public SeriesLookupModule(TvDbProxy tvDbProxy)
: base("/Series/lookup")
{
_tvDbProvider = tvDbProvider;
_tvDbProxy = tvDbProxy;
Get["/"] = x => GetQualityType();
}
private Response GetQualityType()
{
var tvDbResults = _tvDbProvider.SearchSeries((string)Request.Query.term);
var tvDbResults = _tvDbProxy.SearchSeries((string)Request.Query.term);
return tvDbResults.AsResponse();
}
}

View File

@ -202,7 +202,7 @@ public string create_proper_sab_season_title(bool proper)
public string create_proper_sab_daily_titles(bool proper)
{
var series = Builder<Series>.CreateNew()
.With(c => c.SeriesType = SeriesType.Daily)
.With(c => c.SeriesTypes = SeriesTypes.Daily)
.With(c => c.Title = "My Series Name")
.Build();

View File

@ -1,92 +0,0 @@
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
using System.Linq;
namespace NzbDrone.Core.Test.JobTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
public class BannerDownloadJobTest : CoreTest
{
private ProgressNotification _notification;
[SetUp]
public void Setup()
{
_notification = new ProgressNotification("Test");
WithTempAsAppPath();
}
private void WithSuccessfulDownload()
{
Mocker.GetMock<BannerProvider>()
.Setup(s => s.Download(It.IsAny<Series>()))
.Returns(true);
}
private void WithFailedDownload()
{
Mocker.GetMock<BannerProvider>()
.Setup(s => s.Download(It.IsAny<Series>()))
.Returns(false);
}
private void VerifyDownloadMock(int times)
{
Mocker.GetMock<BannerProvider>().Verify(v => v.Download(It.IsAny<Series>()), Times.Exactly(times));
}
[Test]
public void Start_should_download_banners_for_all_series_when_no_targetId_is_passed_in()
{
WithSuccessfulDownload();
var series = Builder<Series>.CreateListOfSize(5)
.Build().ToList();
Mocker.GetMock<ISeriesRepository>().Setup(s => s.All())
.Returns(series);
Mocker.Resolve<BannerDownloadJob>().Start(_notification, null);
VerifyDownloadMock(series.Count);
}
[Test]
public void Start_should_only_attempt_to_download_for_series_with_banner_url()
{
WithSuccessfulDownload();
var series = Builder<Series>.CreateListOfSize(5)
.TheFirst(2)
.With(s => s.BannerUrl = null)
.Build().ToList();
Mocker.GetMock<ISeriesRepository>().Setup(s => s.All())
.Returns(series);
Mocker.Resolve<BannerDownloadJob>().Start(_notification, null);
VerifyDownloadMock(3);
}
[Test]
public void Start_should_download_single_banner_when_seriesId_is_passed_in()
{
WithSuccessfulDownload();
var series = Builder<Series>.CreateNew()
.Build();
Mocker.GetMock<ISeriesRepository>().Setup(s => s.Get(series.Id))
.Returns(series);
Mocker.Resolve<BannerDownloadJob>().Start(_notification, new { SeriesId = series.Id });
VerifyDownloadMock(1);
}
}
}

View File

@ -48,9 +48,6 @@ public void import_new_series_succesful()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)))
.Callback(() => series[1].LastDiskSync = DateTime.Now);
Mocker.GetMock<BannerDownloadJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
Mocker.GetMock<XemUpdateJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") > 0)));
@ -116,9 +113,6 @@ public void failed_import_should_not_be_stuck_in_loop()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)))
.Callback(() => series[0].LastDiskSync = DateTime.Now);
Mocker.GetMock<BannerDownloadJob>()
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)));
Mocker.GetMock<ISeriesRepository>()
.Setup(s => s.Get(series[0].Id)).Returns(series[0]);

View File

@ -0,0 +1,23 @@
using System.Linq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.Test.MediaCoverTests
{
[TestFixture]
public class MediaCoverServiceFixture : CoreTest<MediaCoverService>
{
[SetUp]
public void Setup()
{
Mocker.SetConstant(new HttpProvider());
Mocker.SetConstant(new DiskProvider());
Mocker.SetConstant(new EnvironmentProvider());
}
}
}

View File

@ -763,7 +763,7 @@ public void should_use_airDate_if_series_isDaily()
var series = Builder<Series>
.CreateNew()
.With(s => s.SeriesType = SeriesType.Daily)
.With(s => s.SeriesTypes = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();
@ -792,7 +792,7 @@ public void should_use_airDate_if_series_isDaily_no_episode_title()
var series = Builder<Series>
.CreateNew()
.With(s => s.SeriesType = SeriesType.Daily)
.With(s => s.SeriesTypes = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();
@ -821,7 +821,7 @@ public void should_set_airdate_to_unknown_if_not_available()
var series = Builder<Series>
.CreateNew()
.With(s => s.SeriesType = SeriesType.Daily)
.With(s => s.SeriesTypes = SeriesTypes.Daily)
.With(s => s.Title = "The Daily Show with Jon Stewart")
.Build();

View File

@ -140,6 +140,7 @@
<Compile Include="JobTests\JobRepositoryFixture.cs" />
<Compile Include="JobTests\RenameSeasonJobFixture.cs" />
<Compile Include="DecisionEngineTests\LanguageSpecificationFixture.cs" />
<Compile Include="MediaCoverTests\MediaCoverServiceFixture.cs" />
<Compile Include="ProviderTests\DownloadClientTests\NzbgetProviderTests\DownloadNzbFixture.cs" />
<Compile Include="ProviderTests\DownloadClientTests\NzbgetProviderTests\QueueFixture.cs" />
<Compile Include="ProviderTests\DownloadProviderTests\ContainsRecentEpisode.cs" />
@ -163,13 +164,11 @@
<Compile Include="Qualities\QualityFixture.cs" />
<Compile Include="EpisodeParseResultTest.cs" />
<Compile Include="JobTests\BacklogSearchJobTest.cs" />
<Compile Include="JobTests\BannerDownloadJobTest.cs" />
<Compile Include="JobTests\RssSyncJobTest.cs" />
<Compile Include="JobTests\PostDownloadScanJobFixture.cs" />
<Compile Include="JobTests\RecentBacklogSearchJobTest.cs" />
<Compile Include="ParserTests\QualityParserFixture.cs" />
<Compile Include="Configuration\ConfigCachingFixture.cs" />
<Compile Include="ProviderTests\BannerProviderTest.cs" />
<Compile Include="DecisionEngineTests\AllowedReleaseGroupSpecificationFixture.cs" />
<Compile Include="DecisionEngineTests\CustomStartDateSpecificationFixture.cs" />
<Compile Include="ProviderTests\DiskScanProviderTests\CleanUpFixture.cs" />

View File

@ -1,103 +0,0 @@
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.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common.AutoMoq;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests
{
[TestFixture]
// ReSharper disable InconsistentNaming
public class BannerProviderTest : CoreTest
{
private Series _series;
[SetUp]
public void Setup()
{
WithTempAsAppPath();
_series = Builder<Series>.CreateNew()
.With(s => s.Id = 12345)
.Build();
var path = @"C:\Windows\Temp";
Mocker.GetMock<DiskProvider>().Setup(s => s.CreateDirectory(path));
}
private void WithSuccessfulDownload()
{
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadFile(It.IsAny<string>(), It.IsAny<string>()));
}
private void WithFailedDownload()
{
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadFile(It.IsAny<string>(), It.IsAny<string>()))
.Throws(new WebException("Failed to download file (Mocked)"));
}
[Test]
public void Download_should_return_true_when_banner_is_downloaded_successfully()
{
WithSuccessfulDownload();
var result = Mocker.Resolve<BannerProvider>().Download(_series);
result.Should().BeTrue();
}
[Test]
public void Download_should_return_false_when_banner_download_fails()
{
WithFailedDownload();
var result = Mocker.Resolve<BannerProvider>().Download(_series);
result.Should().BeFalse();
}
[Test]
public void Delete_should_delete_banner_file_when_it_exists()
{
Mocker.GetMock<DiskProvider>().Setup(s => s.FileExists(It.IsAny<string>()))
.Returns(true);
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFile(It.IsAny<string>()));
var result = Mocker.Resolve<BannerProvider>().Delete(1);
result.Should().BeTrue();
}
[Test]
public void Delete_should_return_true_even_when_file_sint_deleted()
{
Mocker.GetMock<DiskProvider>().Setup(s => s.FileExists(It.IsAny<string>()))
.Returns(false);
var result = Mocker.Resolve<BannerProvider>().Delete(1);
result.Should().BeTrue();
}
[Test]
public void Delete_should_return_false_when_file_fails_to_delete()
{
Mocker.GetMock<DiskProvider>().Setup(s => s.FileExists(It.IsAny<string>()))
.Returns(true);
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFile(It.IsAny<string>()))
.Throws(new SystemException("File not found."));
var result = Mocker.Resolve<BannerProvider>().Delete(1);
result.Should().BeFalse();
ExceptionVerification.ExpectedWarns(1);
}
}
}

View File

@ -37,7 +37,7 @@ public void Setup()
{
_series = Builder<Series>
.CreateNew()
.With(s => s.SeriesType = SeriesType.Standard)
.With(s => s.SeriesTypes = SeriesTypes.Standard)
.Build();
}
@ -50,7 +50,7 @@ public void With80MBFile()
public void WithDailySeries()
{
_series.SeriesType = SeriesType.Daily;
_series.SeriesTypes = SeriesTypes.Daily;
}
[Test]

View File

@ -149,7 +149,7 @@ public void is_in_queue_should_find_if_exact_daily_episode_is_in_queue()
{
Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false },
AirDate = new DateTime(2011, 12, 01),
Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesType = SeriesType.Daily },
Series = new Series { Title = "The Dailyshow", CleanTitle = Parser.NormalizeTitle("The Dailyshow"), SeriesTypes = SeriesTypes.Daily },
};

View File

@ -7,6 +7,7 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -17,7 +18,7 @@ namespace NzbDrone.Core.Test.ProviderTests
// ReSharper disable InconsistentNaming
public class TvDbProviderTest : CoreTest
{
private TvDbProvider tvDbProvider;
private TvDbProxy tvDbProxy;
[SetUp]
public void Setup()
@ -25,11 +26,11 @@ public void Setup()
var builder = new ContainerBuilder();
builder.RegisterType<EnvironmentProvider>();
builder.RegisterType<TvDbProvider>();
builder.RegisterType<TvDbProxy>();
var container = builder.Build();
tvDbProvider = container.Resolve<TvDbProvider>();
tvDbProxy = container.Resolve<TvDbProxy>();
}
[TearDown]
@ -45,7 +46,7 @@ public void TearDown()
[TestCase("Franklin & Bash")]
public void successful_search(string title)
{
var result = tvDbProvider.SearchSeries(title);
var result = tvDbProxy.SearchSeries(title);
result.Should().NotBeEmpty();
result[0].Title.Should().Be(title);
@ -56,7 +57,7 @@ public void successful_search(string title)
public void no_search_result()
{
//act
var result = tvDbProvider.SearchSeries(Guid.NewGuid().ToString());
var result = tvDbProxy.SearchSeries(Guid.NewGuid().ToString());
//assert
result.Should().BeEmpty();
@ -67,7 +68,7 @@ public void no_search_result()
public void none_unique_season_episode_number()
{
//act
var result = tvDbProvider.GetEpisodes(75978);//Family guy
var result = tvDbProxy.GetEpisodes(75978);//Family guy
//Asserts that when episodes are grouped by Season/Episode each group contains maximum of
//one item.

View File

@ -5,6 +5,7 @@
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.ReferenceData;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.TvRage;
@ -54,11 +55,11 @@ public void Setup()
.Setup(s => s.GetCleanName(_series.Id))
.Returns("");
Mocker.GetMock<TvRageProvider>()
Mocker.GetMock<TvRageProxy>()
.Setup(s => s.SearchSeries(_series.Title))
.Returns(_searchResults);
Mocker.GetMock<TvRageProvider>()
Mocker.GetMock<TvRageProxy>()
.Setup(s => s.GetSeries(_searchResults.First().ShowId))
.Returns(_tvRageSeries);
}

View File

@ -5,6 +5,7 @@
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.TvRage;
using NzbDrone.Core.Providers;

View File

@ -8,6 +8,7 @@
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -38,7 +39,7 @@ private void WithOneResult()
public void should_be_null_when_no_showinfo_is_returned()
{
WithEmptyResults();
Mocker.Resolve<TvRageProvider>().GetSeries(100).Should().BeNull();
Mocker.Resolve<TvRageProxy>().GetSeries(100).Should().BeNull();
ExceptionVerification.ExpectedWarns(1);
}
@ -47,7 +48,7 @@ public void should_be_null_when_no_showinfo_is_returned()
public void should_return_series_when_showinfo_is_valid()
{
WithOneResult();
var result = Mocker.Resolve<TvRageProvider>().GetSeries(29999);
var result = Mocker.Resolve<TvRageProxy>().GetSeries(29999);
result.ShowId.Should().Be(29999);
result.Name.Should().Be("Anger Management");

View File

@ -6,6 +6,7 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -19,13 +20,13 @@ public class GetUtcOffsetFixture : CoreTest
[Test]
public void should_return_zero_if_timeZone_is_empty()
{
Mocker.Resolve<TvRageProvider>().GetUtcOffset("").Should().Be(0);
Mocker.Resolve<TvRageProxy>().GetUtcOffset("").Should().Be(0);
}
[Test]
public void should_return_zero_if_cannot_be_coverted_to_int()
{
Mocker.Resolve<TvRageProvider>().GetUtcOffset("adfhadfhdjaf").Should().Be(0);
Mocker.Resolve<TvRageProxy>().GetUtcOffset("adfhadfhdjaf").Should().Be(0);
}
[TestCase("GMT-5", -5)]
@ -33,7 +34,7 @@ public void should_return_zero_if_cannot_be_coverted_to_int()
[TestCase("GMT+8", 8)]
public void should_return_offset_when_not_dst(string timezone, int expected)
{
Mocker.Resolve<TvRageProvider>().GetUtcOffset(timezone).Should().Be(expected);
Mocker.Resolve<TvRageProxy>().GetUtcOffset(timezone).Should().Be(expected);
}
[TestCase("GMT-5 +DST", -4)]
@ -41,7 +42,7 @@ public void should_return_offset_when_not_dst(string timezone, int expected)
[TestCase("GMT+8 +DST", 9)]
public void should_return_offset_plus_one_when_dst(string timezone, int expected)
{
Mocker.Resolve<TvRageProvider>().GetUtcOffset(timezone).Should().Be(expected);
Mocker.Resolve<TvRageProxy>().GetUtcOffset(timezone).Should().Be(expected);
}
}
}

View File

@ -8,6 +8,7 @@
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -45,35 +46,35 @@ private void WithOneResult()
public void should_be_empty_when_no_results_are_found()
{
WithEmptyResults();
Mocker.Resolve<TvRageProvider>().SearchSeries("asdasdasdasdas").Should().BeEmpty();
Mocker.Resolve<TvRageProxy>().SearchSeries("asdasdasdasdas").Should().BeEmpty();
}
[Test]
public void should_be_have_more_than_one_when_multiple_results_are_returned()
{
WithManyResults();
Mocker.Resolve<TvRageProvider>().SearchSeries("top+gear").Should().NotBeEmpty();
Mocker.Resolve<TvRageProxy>().SearchSeries("top+gear").Should().NotBeEmpty();
}
[Test]
public void should_have_one_when_only_one_result_is_found()
{
WithOneResult();
Mocker.Resolve<TvRageProvider>().SearchSeries("suits").Should().HaveCount(1);
Mocker.Resolve<TvRageProxy>().SearchSeries("suits").Should().HaveCount(1);
}
[Test]
public void ended_should_not_have_a_value_when_series_has_not_ended()
{
WithOneResult();
Mocker.Resolve<TvRageProvider>().SearchSeries("suits").First().Ended.HasValue.Should().BeFalse();
Mocker.Resolve<TvRageProxy>().SearchSeries("suits").First().Ended.HasValue.Should().BeFalse();
}
[Test]
public void started_should_match_series()
{
WithOneResult();
Mocker.Resolve<TvRageProvider>().SearchSeries("suits").First().Started.Should().Be(new DateTime(2011, 6, 23));
Mocker.Resolve<TvRageProxy>().SearchSeries("suits").First().Started.Should().Be(new DateTime(2011, 6, 23));
}
}
}

View File

@ -1,81 +0,0 @@
using System;
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Jobs
{
public class BannerDownloadJob : IJob
{
private readonly ISeriesService _seriesService;
private readonly BannerProvider _bannerProvider;
private readonly ISeriesRepository _seriesRepository;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
public BannerDownloadJob(ISeriesService seriesService, BannerProvider bannerProvider, ISeriesRepository seriesRepository)
{
_seriesService = seriesService;
_bannerProvider = bannerProvider;
_seriesRepository = seriesRepository;
}
public BannerDownloadJob()
{
}
public string Name
{
get { return "Banner Download"; }
}
public TimeSpan DefaultInterval
{
get { return TimeSpan.FromDays(30); }
}
public virtual void Start(ProgressNotification notification, dynamic options)
{
Logger.Debug("Starting banner download job");
if (options != null)
{
Series series = _seriesRepository.Get((int)options.SeriesId);
if (series != null && !String.IsNullOrEmpty(series.BannerUrl))
{
DownloadBanner(notification, series);
}
return;
}
var seriesInDb = _seriesRepository.All();
foreach (var series in seriesInDb.Where(s => !String.IsNullOrEmpty(s.BannerUrl)))
{
DownloadBanner(notification, series);
}
Logger.Debug("Finished banner download job");
}
public virtual void DownloadBanner(ProgressNotification notification, Series series)
{
notification.CurrentMessage = string.Format("Downloading banner for '{0}'", series.Title);
if (_bannerProvider.Download(series))
notification.CurrentMessage = string.Format("Successfully download banner for '{0}'", series.Title);
else
notification.CurrentMessage = string.Format("Failed to download banner for '{0}'", series.Title);
}
}
}

View File

@ -64,7 +64,7 @@ public virtual void Start(ProgressNotification notification, dynamic options)
return;
}
if (episode.Series.SeriesType == SeriesType.Daily)
if (episode.Series.SeriesTypes == SeriesTypes.Daily)
{
if (!episode.AirDate.HasValue)
{

View File

@ -22,7 +22,6 @@ public class ImportNewSeriesJob : IJob
private readonly IMediaFileService _mediaFileService;
private readonly UpdateInfoJob _updateInfoJob;
private readonly DiskScanJob _diskScanJob;
private readonly BannerDownloadJob _bannerDownloadJob;
private readonly ISeasonRepository _seasonRepository;
private readonly XemUpdateJob _xemUpdateJob;
private readonly ISeriesRepository _seriesRepository;
@ -34,7 +33,7 @@ public class ImportNewSeriesJob : IJob
public ImportNewSeriesJob(ISeriesService seriesService, IEpisodeService episodeService,
IMediaFileService mediaFileService, UpdateInfoJob updateInfoJob,
DiskScanJob diskScanJob, BannerDownloadJob bannerDownloadJob,
DiskScanJob diskScanJob,
ISeasonRepository seasonRepository, XemUpdateJob xemUpdateJob, ISeriesRepository seriesRepository, ISeasonService seasonService)
{
_seriesService = seriesService;
@ -42,7 +41,6 @@ public ImportNewSeriesJob(ISeriesService seriesService, IEpisodeService episodeS
_mediaFileService = mediaFileService;
_updateInfoJob = updateInfoJob;
_diskScanJob = diskScanJob;
_bannerDownloadJob = bannerDownloadJob;
_seasonRepository = seasonRepository;
_xemUpdateJob = xemUpdateJob;
_seriesRepository = seriesRepository;
@ -86,9 +84,6 @@ private void ScanSeries(ProgressNotification notification)
var updatedSeries = _seriesRepository.Get(((ModelBase)currentSeries).Id);
AutoIgnoreSeasons(((ModelBase)updatedSeries).Id);
//Download the banner for the new series
_bannerDownloadJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).Id });
//Get Scene Numbering if applicable
_xemUpdateJob.Start(notification, new { SeriesId = ((ModelBase)updatedSeries).Id });

View File

@ -0,0 +1,18 @@
using System.Linq;
namespace NzbDrone.Core.MediaCover
{
public enum MediaCoverTypes
{
Poster = 0,
Banner = 1,
Fanart = 2
}
public class MediaCover
{
public MediaCoverTypes CoverType { get; set; }
public string Url { get; set; }
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Tv.Events;
namespace NzbDrone.Core.MediaCover
{
public class MediaCoverService : IHandle<SeriesUpdatedEvent>
{
private readonly HttpProvider _httpProvider;
private readonly DiskProvider _diskProvider;
private readonly Logger _logger;
private readonly string _coverRootFolder;
private const string COVER_URL_PREFIX = "http://www.thetvdb.com/banners/";
public MediaCoverService(HttpProvider httpProvider, DiskProvider diskProvider, EnvironmentProvider environmentProvider, Logger logger)
{
_httpProvider = httpProvider;
_diskProvider = diskProvider;
_logger = logger;
_coverRootFolder = environmentProvider.GetMediaCoverPath();
}
public void Handle(SeriesUpdatedEvent message)
{
EnsureCovers(message.Series);
}
private void EnsureCovers(Series series)
{
foreach (var cover in series.Covers)
{
var fileName = GetCoverPath(series.Id, cover.CoverType);
if (!_diskProvider.FileExists(fileName))
{
DownloadCover(series, cover);
}
}
}
private void DownloadCover(Series series, MediaCover cover)
{
try
{
var fileName = GetCoverPath(series.Id, cover.CoverType);
_logger.Info("Downloading {0} for {1}", cover.CoverType, series.Title);
_httpProvider.DownloadFile(COVER_URL_PREFIX + cover.Url, fileName);
}
catch (Exception e)
{
_logger.ErrorException("Couldn't download media cover for " + series.TvDbId, e);
}
}
private string GetCoverPath(int seriesId, MediaCoverTypes coverTypes)
{
return Path.Combine(_coverRootFolder, seriesId.ToString("0000"), coverTypes.ToString().ToLower() + ".jpg");
}
}
}

View File

@ -132,7 +132,7 @@ public string GetNewFilename(IList<Episode> episodes, Series series, Quality qua
result += series.Title + separatorStyle.Pattern;
}
if (series.SeriesType == SeriesType.Standard)
if (series.SeriesTypes == SeriesTypes.Standard)
{
result += numberStyle.Pattern.Replace("%0e",
String.Format("{0:00}", sortedEpisodes.First().EpisodeNumber));

View File

@ -3,12 +3,13 @@
using System.Linq;
using System.Text.RegularExpressions;
using NLog;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.Tv;
using NzbDrone.Common;
namespace NzbDrone.Core.Providers
namespace NzbDrone.Core.MetadataSource
{
public class TvDbProvider
public class TvDbProxy
{
public const string TVDB_APIKEY = "5D2D188E86E07F4F";
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
@ -18,7 +19,7 @@ public class TvDbProvider
private readonly Tvdb.Tvdb _handlerV2;
public TvDbProvider()
public TvDbProxy()
{
_handlerV2 = new Tvdb.Tvdb(TVDB_APIKEY);
}
@ -64,7 +65,23 @@ public virtual Series GetSeries(int tvDbSeriesId)
series.Runtime = Convert.ToInt32(tvDbSeries.Runtime);
}
series.BannerUrl = tvDbSeries.banner;
series.Covers = new List<MediaCover.MediaCover>();
if (!string.IsNullOrWhiteSpace(tvDbSeries.banner))
{
series.Covers.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Banner, Url = tvDbSeries.banner });
}
if (!string.IsNullOrWhiteSpace(tvDbSeries.fanart))
{
series.Covers.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Fanart, Url = tvDbSeries.fanart });
}
if (!string.IsNullOrWhiteSpace(tvDbSeries.poster))
{
series.Covers.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = tvDbSeries.poster });
}
series.Network = tvDbSeries.Network;
if (tvDbSeries.FirstAired.HasValue && tvDbSeries.FirstAired.Value.Year > 1900)

View File

@ -1,29 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Providers;
using NzbDrone.Core.ReferenceData;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model.TvRage;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers
namespace NzbDrone.Core.MetadataSource
{
public class TvRageMappingProvider
{
private readonly SceneMappingService _sceneMappingService;
private readonly TvRageProvider _tvRageProvider;
private readonly TvRageProxy _tvRageProxy;
private readonly IEpisodeService _episodeService;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public TvRageMappingProvider(SceneMappingService sceneMappingService,
TvRageProvider tvRageProvider, IEpisodeService episodeService)
TvRageProxy tvRageProxy, IEpisodeService episodeService)
{
_sceneMappingService = sceneMappingService;
_tvRageProvider = tvRageProvider;
_tvRageProxy = tvRageProxy;
_episodeService = episodeService;
}
@ -36,7 +34,7 @@ public Series FindMatchingTvRageSeries(Series series)
var firstEpisode = _episodeService.GetEpisode(series.Id, 1, 1);
var cleanName = _sceneMappingService.GetCleanName(series.Id);
var results = _tvRageProvider.SearchSeries(series.Title);
var results = _tvRageProxy.SearchSeries(series.Title);
var result = ProcessResults(results, series, cleanName, firstEpisode);
if (result != null)
@ -44,7 +42,7 @@ public Series FindMatchingTvRageSeries(Series series)
logger.Trace("TV Rage: {0} matches TVDB: {1}", result.Name, series.Title);
series.TvRageId = result.ShowId;
series.TvRageTitle = result.Name;
series.UtcOffset = _tvRageProvider.GetSeries(result.ShowId).UtcOffset;
series.UtcOffset = _tvRageProxy.GetSeries(result.ShowId).UtcOffset;
}
return series;

View File

@ -1,27 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.TvRage;
namespace NzbDrone.Core.Providers
namespace NzbDrone.Core.MetadataSource
{
public class TvRageProvider
public class TvRageProxy
{
private readonly HttpProvider _httpProvider;
private const string TVRAGE_APIKEY = "NW4v0PSmQIoVmpbASLdD";
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public TvRageProvider(HttpProvider httpProvider)
public TvRageProxy(HttpProvider httpProvider)
{
_httpProvider = httpProvider;
}
public TvRageProvider()
public TvRageProxy()
{
}

View File

@ -91,7 +91,7 @@ public string GetDownloadTitle()
return seasonResult;
}
if (Series.SeriesType == SeriesType.Daily)
if (Series.SeriesTypes == SeriesTypes.Daily)
{
var dailyResult = String.Format("{0} - {1:yyyy-MM-dd} - {2} [{3}]", seriesTitle,
AirDate, Episodes.First().Title, Quality.Quality);

View File

@ -232,6 +232,7 @@
<Compile Include="Jobs\RefreshEpsiodeMetadata.cs" />
<Compile Include="Jobs\PastWeekBacklogSearchJob.cs" />
<Compile Include="Lifecycle\IInitializable.cs" />
<Compile Include="MediaCover\MediaCover.cs" />
<Compile Include="MediaFiles\MediaFileRepository.cs" />
<Compile Include="Model\DownloadClientType.cs" />
<Compile Include="Instrumentation\LogService.cs" />
@ -264,6 +265,7 @@
<Compile Include="Tv\Events\EpisodeInfoUpdatedEvent.cs" />
<Compile Include="Tv\Events\EpisodeInfoAddedEvent.cs" />
<Compile Include="Tv\Events\SeriesAddedEvent.cs" />
<Compile Include="Tv\Events\SeriesUpdatedEvent.cs" />
<Compile Include="Tv\SeasonRepository.cs" />
<Compile Include="Tv\SeriesRepository.cs" />
<Compile Include="Tv\QualityModel.cs" />
@ -294,7 +296,7 @@
<Compile Include="Model\Xem\XemSceneTvdbMapping.cs" />
<Compile Include="Model\Xem\XemValues.cs" />
<Compile Include="AutofacSignalrDependencyResolver.cs" />
<Compile Include="Providers\BannerProvider.cs" />
<Compile Include="MediaCover\MediaCoverService.cs" />
<Compile Include="DecisionEngine\LanguageSpecification.cs" />
<Compile Include="Providers\DownloadClients\NzbgetProvider.cs" />
<Compile Include="Providers\MediaInfoProvider.cs" />
@ -321,7 +323,6 @@
<Compile Include="Jobs\RenameSeriesJob.cs" />
<Compile Include="Lifecycle\AppUpdateJob.cs" />
<Compile Include="Jobs\BacklogSearchJob.cs" />
<Compile Include="Jobs\BannerDownloadJob.cs" />
<Compile Include="Jobs\ConvertEpisodeJob.cs" />
<Compile Include="Jobs\SeriesSearchJob.cs" />
<Compile Include="Jobs\SeasonSearchJob.cs" />
@ -337,8 +338,8 @@
<Compile Include="Jobs\IJob.cs" />
<Compile Include="Jobs\RssSyncJob.cs" />
<Compile Include="Jobs\UpdateInfoJob.cs" />
<Compile Include="Providers\TvRageMappingProvider.cs" />
<Compile Include="Providers\TvRageProvider.cs" />
<Compile Include="MetadataSource\TvRageMappingProvider.cs" />
<Compile Include="MetadataSource\TvRageProxy.cs" />
<Compile Include="Providers\XemCommunicationProvider.cs" />
<Compile Include="Providers\XemProvider.cs" />
<Compile Include="Qualities\Quality.cs" />
@ -504,7 +505,7 @@
<Compile Include="Providers\SmtpProvider.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Providers\TvDbProvider.cs">
<Compile Include="MetadataSource\TvDbProxy.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Providers\TwitterProvider.cs">

View File

@ -1,102 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
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;
namespace NzbDrone.Core.Providers
{
public class BannerProvider
{
private readonly HttpProvider _httpProvider;
private readonly EnvironmentProvider _environmentProvider;
private readonly DiskProvider _diskProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
public BannerProvider(HttpProvider httpProvider, EnvironmentProvider environmentProvider,
DiskProvider diskProvider)
{
_httpProvider = httpProvider;
_environmentProvider = environmentProvider;
_diskProvider = diskProvider;
}
public BannerProvider()
{
}
public virtual bool Download(Series series)
{
var bannerPath = _environmentProvider.GetBannerPath();
logger.Trace("Ensuring Banner Folder exists: ", bannerPath);
_diskProvider.CreateDirectory(bannerPath);
var bannerFilename = Path.Combine(bannerPath, series.Id.ToString()) + ".jpg";
logger.Trace("Downloading banner for '{0}'", series.Title);
try
{
_httpProvider.DownloadFile(BANNER_URL_PREFIX + series.BannerUrl, bannerFilename);
logger.Trace("Successfully download banner for '{0}'", series.Title);
}
catch (Exception)
{
logger.Debug("Failed to download banner for '{0}'", series.Title);
return false;
}
return true;
}
public virtual bool Delete(int seriesId)
{
var bannerPath = _environmentProvider.GetBannerPath();
var bannerFilename = Path.Combine(bannerPath, seriesId.ToString()) + ".jpg";
try
{
logger.Trace("Checking if banner exists: {0}", bannerFilename);
if (_diskProvider.FileExists(bannerFilename))
{
logger.Trace("Deleting existing banner: {0}", bannerFilename);
_diskProvider.DeleteFile(bannerFilename);
}
}
catch(Exception ex)
{
logger.WarnException("Failed to delete banner: " + bannerFilename, ex);
return false;
}
return true;
}
public virtual void Download(string remotePath, string filename)
{
var url = BANNER_URL_PREFIX + remotePath;
try
{
_httpProvider.DownloadFile(url, filename);
logger.Trace("Successfully download banner from '{0}' to '{1}'", url, filename);
}
catch (Exception ex)
{
var message = String.Format("Failed to download Banner from '{0}' to '{1}'", url, filename);
logger.DebugException(message, ex);
throw;
}
}
}
}

View File

@ -117,7 +117,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
var size = _diskProvider.GetSize(filePath);
var runTime = _mediaInfoProvider.GetRunTime(filePath);
if (series.SeriesType == SeriesType.Daily || parseResult.SeasonNumber > 0)
if (series.SeriesTypes == SeriesTypes.Daily || parseResult.SeasonNumber > 0)
{
if (size < Constants.IgnoreFileSize && runTime < 180)
{

View File

@ -43,7 +43,7 @@ public virtual bool IsInQueue(EpisodeParseResult newParseResult)
var matchingTitleWithQuality = matchigTitle.Where(q => q.ParseResult.Quality >= newParseResult.Quality);
if (newParseResult.Series.SeriesType == SeriesType.Daily)
if (newParseResult.Series.SeriesTypes == SeriesTypes.Daily)
{
return matchingTitleWithQuality.Any(q => q.ParseResult.AirDate.Value.Date == newParseResult.AirDate.Value.Date);
}

View File

@ -42,7 +42,7 @@ public virtual bool IsInQueue(EpisodeParseResult newParseResult)
var matchingTitleWithQuality = matchigTitle.Where(q => q.ParseResult.Quality >= newParseResult.Quality);
if (newParseResult.Series.SeriesType == SeriesType.Daily)
if (newParseResult.Series.SeriesTypes == SeriesTypes.Daily)
{
return matchingTitleWithQuality.Any(q => q.ParseResult.AirDate.Value.Date == newParseResult.AirDate.Value.Date);
}

View File

@ -46,7 +46,7 @@ public virtual List<int> SeasonSearch(ProgressNotification notification, int ser
return new List<int>();
}
if (series.SeriesType == SeriesType.Daily)
if (series.SeriesTypes == SeriesTypes.Daily)
{
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
return new List<int>();
@ -75,7 +75,7 @@ public virtual List<int> PartialSeasonSearch(ProgressNotification notification,
return new List<int>();
}
if (series.SeriesType == SeriesType.Daily)
if (series.SeriesTypes == SeriesTypes.Daily)
{
logger.Trace("Daily series detected, skipping season search: {0}", series.Title);
return new List<int>();

View File

@ -24,7 +24,7 @@ public virtual void UpdateDailySeries()
if (series != null)
{
_seriesService.SetSeriesType(series.Id, SeriesType.Daily);
_seriesService.SetSeriesType(series.Id, SeriesTypes.Daily);
}
}
}

View File

@ -86,7 +86,7 @@ public override string ToString()
{
string seriesTitle = Series == null ? "[NULL]" : Series.Title;
if (Series != null && Series.SeriesType == SeriesType.Daily && AirDate.HasValue)
if (Series != null && Series.SeriesTypes == SeriesTypes.Daily && AirDate.HasValue)
return string.Format("{0} - {1:yyyy-MM-dd}", seriesTitle, AirDate.Value);
return string.Format("{0} - S{1:00}E{2:00}", seriesTitle, SeasonNumber, EpisodeNumber);

View File

@ -5,6 +5,7 @@
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Tv.Events;
@ -39,14 +40,14 @@ public class EpisodeService : IEpisodeService, IHandle<EpisodeGrabbedEvent>
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
private readonly TvDbProvider _tvDbProvider;
private readonly TvDbProxy _tvDbProxy;
private readonly ISeasonRepository _seasonRepository;
private readonly IEpisodeRepository _episodeRepository;
private readonly IEventAggregator _eventAggregator;
public EpisodeService(TvDbProvider tvDbProviderProvider, ISeasonRepository seasonRepository, IEpisodeRepository episodeRepository, IEventAggregator eventAggregator)
public EpisodeService(TvDbProxy tvDbProxyProxy, ISeasonRepository seasonRepository, IEpisodeRepository episodeRepository, IEventAggregator eventAggregator)
{
_tvDbProvider = tvDbProviderProvider;
_tvDbProxy = tvDbProxyProxy;
_seasonRepository = seasonRepository;
_episodeRepository = episodeRepository;
_eventAggregator = eventAggregator;
@ -89,7 +90,7 @@ public List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult)
if (parseResult.AirDate.HasValue)
{
if (parseResult.Series.SeriesType == SeriesType.Standard)
if (parseResult.Series.SeriesTypes == SeriesTypes.Standard)
{
//Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error
logger.Warn("Found daily-style episode for non-daily series: {0}. {1}", parseResult.Series.Title, parseResult.OriginalString);
@ -182,7 +183,7 @@ public void RefreshEpisodeInfo(Series series)
var successCount = 0;
var failCount = 0;
var tvdbEpisodes = _tvDbProvider.GetEpisodes(series.TvDbId);
var tvdbEpisodes = _tvDbProxy.GetEpisodes(series.TvDbId);
var seriesEpisodes = GetEpisodeBySeries(series.Id);
var updateList = new List<Episode>();

View File

@ -0,0 +1,15 @@
using System.Linq;
using NzbDrone.Common.Eventing;
namespace NzbDrone.Core.Tv.Events
{
public class SeriesUpdatedEvent : IEvent
{
public Series Series { get; private set; }
public SeriesUpdatedEvent(Series series)
{
Series = series;
}
}
}

View File

@ -9,7 +9,7 @@
namespace NzbDrone.Core.Tv
{
public enum SeriesType
public enum SeriesTypes
{
Standard = 0,
Daily = 1,
@ -35,8 +35,8 @@ public class Series : ModelBase
public DateTime? LastInfoSync { get; set; }
public DateTime? LastDiskSync { get; set; }
public int Runtime { get; set; }
public string BannerUrl { get; set; }
public SeriesType SeriesType { get; set; }
public List<MediaCover.MediaCover> Covers { get; set; }
public SeriesTypes SeriesTypes { get; set; }
public BacklogSettingType BacklogSetting { get; set; }
public string Network { get; set; }
public DateTime? CustomStartDate { get; set; }

View File

@ -11,7 +11,7 @@ public interface ISeriesRepository : IBasicRepository<Series>
List<Series> Search(string title);
Series GetByTitle(string cleanTitle);
Series FindByTvdbId(int tvdbId);
void SetSeriesType(int seriesId, SeriesType seriesType);
void SetSeriesType(int seriesId, SeriesTypes seriesTypes);
}
@ -42,9 +42,9 @@ public Series FindByTvdbId(int tvdbId)
return Queryable.SingleOrDefault(s => s.TvDbId == tvdbId);
}
public void SetSeriesType(int seriesId, SeriesType seriesType)
public void SetSeriesType(int seriesId, SeriesTypes seriesTypes)
{
ObjectDatabase.UpdateField(new Series(){Id = seriesId, SeriesType =seriesType }, "SeriesType");
ObjectDatabase.UpdateField(new Series(){Id = seriesId, SeriesTypes =seriesTypes }, "SeriesType");
}
}
}

View File

@ -6,6 +6,7 @@
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Qualities;
@ -22,14 +23,14 @@ public interface ISeriesService
void AddSeries(string title, string path, int tvDbSeriesId, int qualityProfileId, DateTime? airedAfter);
void UpdateFromSeriesEditor(IList<Series> editedSeries);
Series FindByTvdbId(int tvdbId);
void SetSeriesType(int seriesId, SeriesType seriesType);
void SetSeriesType(int seriesId, SeriesTypes seriesTypes);
}
public class SeriesService : ISeriesService
{
private readonly ISeriesRepository _seriesRepository;
private readonly IConfigService _configService;
private readonly TvDbProvider _tvDbProvider;
private readonly TvDbProxy _tvDbProxy;
private readonly TvRageMappingProvider _tvRageMappingProvider;
private readonly IEventAggregator _eventAggregator;
private readonly IQualityProfileService _qualityProfileService;
@ -39,12 +40,12 @@ public class SeriesService : ISeriesService
private readonly SceneMappingService _sceneNameMappingService;
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
TvDbProvider tvDbProviderProvider, SceneMappingService sceneNameMappingService,
TvDbProxy tvDbProxyProxy, SceneMappingService sceneNameMappingService,
TvRageMappingProvider tvRageMappingProvider, IEventAggregator eventAggregator, IQualityProfileService qualityProfileService)
{
_seriesRepository = seriesRepository;
_configService = configServiceService;
_tvDbProvider = tvDbProviderProvider;
_tvDbProxy = tvDbProxyProxy;
_sceneNameMappingService = sceneNameMappingService;
_tvRageMappingProvider = tvRageMappingProvider;
_eventAggregator = eventAggregator;
@ -61,7 +62,7 @@ public bool IsMonitored(int id)
public Series UpdateSeriesInfo(int seriesId)
{
var series = _seriesRepository.Get(seriesId);
var tvDbSeries = _tvDbProvider.GetSeries(series.TvDbId);
var tvDbSeries = _tvDbProxy.GetSeries(series.TvDbId);
series.Title = tvDbSeries.Title;
series.AirTime = tvDbSeries.AirTime;
@ -71,7 +72,7 @@ public Series UpdateSeriesInfo(int seriesId)
series.CleanTitle = tvDbSeries.CleanTitle;
series.LastInfoSync = DateTime.Now;
series.Runtime = tvDbSeries.Runtime;
series.BannerUrl = tvDbSeries.BannerUrl;
series.Covers = tvDbSeries.Covers;
series.Network = tvDbSeries.Network;
series.FirstAired = tvDbSeries.FirstAired;
@ -88,6 +89,8 @@ public Series UpdateSeriesInfo(int seriesId)
_seriesRepository.Update(series);
_eventAggregator.Publish(new SeriesUpdatedEvent(series));
return series;
}
@ -159,9 +162,9 @@ public Series FindByTvdbId(int tvdbId)
return _seriesRepository.FindByTvdbId(tvdbId);
}
public void SetSeriesType(int seriesId, SeriesType seriesType)
public void SetSeriesType(int seriesId, SeriesTypes seriesTypes)
{
_seriesRepository.SetSeriesType(seriesId, seriesType);
_seriesRepository.SetSeriesType(seriesId, seriesTypes);
}

View File

@ -16,10 +16,9 @@ protected static void InitLogging()
if (LogManager.Configuration == null || LogManager.Configuration is XmlLoggingConfiguration)
{
LogManager.Configuration = new LoggingConfiguration();
var consoleTarget = new ConsoleTarget();
consoleTarget.Layout = "${message} ${exception}";
var consoleTarget = new ConsoleTarget { Layout = "${message} ${exception}" };
LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", consoleTarget));
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, consoleTarget));
RegisterExceptionVerification();
}
@ -29,7 +28,7 @@ private static void RegisterExceptionVerification()
{
var exceptionVerification = new ExceptionVerification();
LogManager.Configuration.AddTarget("ExceptionVerification", exceptionVerification);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, exceptionVerification));
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Warn, exceptionVerification));
}
[SetUp]

View File

@ -49,6 +49,8 @@ public void TestBaseSetup()
Mocker.SetConstant(LogManager.GetLogger("TestLogger"));
LogManager.ReconfigExistingLoggers();
TempFolder = Path.Combine(Directory.GetCurrentDirectory(), "_temp_" + DateTime.Now.Ticks);
MockedRestProvider = new Mock<RestProvider>();

View File

@ -2,6 +2,7 @@
<FileVersion>1</FileVersion>
<AutoEnableOnStartup>False</AutoEnableOnStartup>
<AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>