fixed some broken tests.

This commit is contained in:
kay.one 2013-03-26 20:44:52 -07:00
parent c1960525d7
commit ba4950ea8f
32 changed files with 153 additions and 162 deletions

View File

@ -2,12 +2,12 @@ using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.ReferenceData;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.IndexerSearchTests
{
public class GetSearchTitleFixture : TestBase
public class GetSearchTitleFixture : CoreTest<TestSearch>
{
private Series _series;
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
private void WithSceneMapping()
{
Mocker.GetMock<SceneMappingService>()
Mocker.GetMock<ISceneMappingService>()
.Setup(s => s.GetSceneName(_series.Id, -1))
.Returns("Hawaii Five 0 2010");
}
@ -30,8 +30,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
[Test]
public void should_return_series_title_when_there_is_no_scene_mapping()
{
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
.Should().Be(_series.Title);
Subject.GetSearchTitle(_series, 5).Should().Be(_series.Title);
}
[Test]
@ -39,19 +38,17 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
{
WithSceneMapping();
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
.Should().Be("Hawaii Five 0 2010");
Subject.GetSearchTitle(_series, 5).Should().Be("Hawaii Five 0 2010");
}
[Test]
public void should_return_season_scene_name_when_one_exists()
{
Mocker.GetMock<SceneMappingService>()
Mocker.GetMock<ISceneMappingService>()
.Setup(s => s.GetSceneName(_series.Id, 5))
.Returns("Hawaii Five 0 2010 - Season 5");
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
.Should().Be("Hawaii Five 0 2010 - Season 5");
Subject.GetSearchTitle(_series, 5).Should().Be("Hawaii Five 0 2010 - Season 5");
}
[Test]
@ -59,8 +56,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
{
WithSceneMapping();
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
.Should().Be("Hawaii Five 0 2010");
Subject.GetSearchTitle(_series, 5).Should().Be("Hawaii Five 0 2010");
}
[Test]
@ -68,8 +64,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
{
_series.Title = "Franklin & Bash";
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
.Should().Be("Franklin and Bash");
Subject.GetSearchTitle(_series, 5).Should().Be("Franklin and Bash");
}
[TestCase("Betty White's Off Their Rockers", "Betty Whites Off Their Rockers")]
@ -79,12 +74,11 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
{
_series.Title = input;
Mocker.GetMock<SceneMappingService>()
Mocker.GetMock<ISceneMappingService>()
.Setup(s => s.GetSceneName(_series.Id, -1))
.Returns("");
Mocker.Resolve<TestSearch>().GetSearchTitle(_series, 5)
.Should().Be(expected);
Subject.GetSearchTitle(_series, 5).Should().Be(expected);
}
}
}

View File

@ -1,10 +1,12 @@
using System.Collections.Generic;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
using System.Linq;
namespace NzbDrone.Core.Test.IndexerSearchTests.PartialSeasonSearchTests
{
@ -31,7 +33,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests.PartialSeasonSearchTests
.Should()
.HaveCount(0);
ExceptionVerification.ExpectedErrors(4);
ExceptionVerification.ExpectedErrors(2);
}
[Test]
@ -39,14 +41,29 @@ namespace NzbDrone.Core.Test.IndexerSearchTests.PartialSeasonSearchTests
{
WithValidIndexers();
Subject.PerformSearch(_series, new List<Episode> { _episode }, notification)
var episodes = Builder<Episode>.CreateListOfSize(4)
.All()
.With(c => c.SeasonNumber = 1)
.Build();
episodes[0].EpisodeNumber = 1;
episodes[1].EpisodeNumber = 5;
episodes[2].EpisodeNumber = 10;
episodes[3].EpisodeNumber = 15;
Subject.PerformSearch(_series, episodes.ToList(), notification)
.Should()
.HaveCount(20);
.HaveCount(40);
_indexer1.Verify(v => v.FetchPartialSeason(_series.Title, 1, 0), Times.Once());
_indexer1.Verify(v => v.FetchPartialSeason(_series.Title, 1, 1), Times.Once());
_indexer2.Verify(v => v.FetchPartialSeason(_series.Title, 1, 0), Times.Once());
_indexer2.Verify(v => v.FetchPartialSeason(_series.Title, 1, 1), Times.Once());
_indexer1.Verify(v => v.FetchPartialSeason(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()), Times.Exactly(2));
_indexer2.Verify(v => v.FetchPartialSeason(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int>()), Times.Exactly(2));
}
}
}

View File

@ -5,13 +5,14 @@ using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.IndexerSearchTests.PartialSeasonSearchTests
{
[TestFixture]
public class PartialSeasonSearch_EpisodeMatch : TestBase
public class PartialSeasonSearch_EpisodeMatch : CoreTest<PartialSeasonSearch>
{
private Series _series;
private List<Episode> _episodes;
@ -42,17 +43,15 @@ namespace NzbDrone.Core.Test.IndexerSearchTests.PartialSeasonSearchTests
[Test]
public void should_return_wrongSeason_when_season_does_not_match()
{
Mocker.Resolve<PartialSeasonSearch>()
.IsEpisodeMatch(_series, new { SeasonNumber = 2, Episodes = _episodes }, _episodeParseResult)
Subject.IsEpisodeMatch(_series, new { SeasonNumber = 2, Episodes = _episodes }, _episodeParseResult)
.Should().BeFalse();
}
[Test]
public void should_not_return_error_when_season_matches()
{
Mocker.Resolve<PartialSeasonSearch>()
.IsEpisodeMatch(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult)
.Should().BeFalse();
Subject.IsEpisodeMatch(_series, new { SeasonNumber = 1, Episodes = _episodes }, _episodeParseResult)
.Should().BeTrue();
}
}
}

View File

@ -17,9 +17,9 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public TestSearch(ISeriesService seriesService, IEpisodeService episodeService, DownloadProvider downloadProvider,
public TestSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider,
IIndexerService indexerService, ISceneMappingService sceneMappingService,
DownloadDirector downloadDirector, ISeriesRepository seriesRepository)
IDownloadDirector downloadDirector, ISeriesRepository seriesRepository)
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,
downloadDirector)
{

View File

@ -95,22 +95,22 @@ namespace NzbDrone.Core.Test.Indexers
get { return null; }
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
throw new NotImplementedException();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
throw new NotImplementedException();
}
@ -153,22 +153,22 @@ namespace NzbDrone.Core.Test.Indexers
get { return true; }
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
throw new NotImplementedException();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
throw new NotImplementedException();
}
@ -206,22 +206,22 @@ namespace NzbDrone.Core.Test.Indexers
get { return true; }
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
throw new NotImplementedException();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
throw new NotImplementedException();
}
@ -266,22 +266,22 @@ namespace NzbDrone.Core.Test.Indexers
get { return false; }
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
throw new NotImplementedException();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
throw new NotImplementedException();
}
@ -319,22 +319,22 @@ namespace NzbDrone.Core.Test.Indexers
get { return null; }
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
throw new NotImplementedException();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
throw new NotImplementedException();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
throw new NotImplementedException();
}

View File

@ -411,7 +411,8 @@
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>xcopy /s /y "$(SolutionDir)\Libraries\Sqlite\*.*" "$(TargetDir)"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Configuration
public Config Get(string key)
{
return Queryable().SingleOrDefault(c => c.Key == key);
return Query.SingleOrDefault(c => c.Key == key);
}

View File

@ -38,9 +38,14 @@ namespace NzbDrone.Core.Datastore
_dataMapper = database.DataMapper;
}
protected QueryBuilder<TModel> Queryable()
protected QueryBuilder<TModel> Query
{
return _dataMapper.Query<TModel>();
get { return _dataMapper.Query<TModel>(); }
}
protected void Delete(Expression<Func<TModel, bool>> filter)
{
_dataMapper.Delete(filter);
}
public IEnumerable<TModel> All()

View File

@ -10,7 +10,14 @@ using NzbDrone.Core.Model;
namespace NzbDrone.Core.Download
{
public class DownloadProvider
public interface IDownloadProvider
{
bool DownloadReport(EpisodeParseResult parseResult);
IDownloadClient GetActiveDownloadClient();
bool ContainsRecentEpisode(EpisodeParseResult parseResult);
}
public class DownloadProvider : IDownloadProvider
{
private readonly SabProvider _sabProvider;
private readonly IConfigService _configService;
@ -18,10 +25,14 @@ namespace NzbDrone.Core.Download
private readonly PneumaticProvider _pneumaticProvider;
private readonly NzbgetProvider _nzbgetProvider;
private readonly IEventAggregator _eventAggregator;
private readonly Logger _logger;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public DownloadProvider(SabProvider sabProvider, IConfigService configService, BlackholeProvider blackholeProvider, PneumaticProvider pneumaticProvider, NzbgetProvider nzbgetProvider, IEventAggregator eventAggregator)
public DownloadProvider(SabProvider sabProvider, IConfigService configService,
BlackholeProvider blackholeProvider,
PneumaticProvider pneumaticProvider,
NzbgetProvider nzbgetProvider,
IEventAggregator eventAggregator, Logger logger)
{
_sabProvider = sabProvider;
_configService = configService;
@ -29,11 +40,9 @@ namespace NzbDrone.Core.Download
_pneumaticProvider = pneumaticProvider;
_nzbgetProvider = nzbgetProvider;
_eventAggregator = eventAggregator;
_logger = logger;
}
public DownloadProvider()
{
}
public virtual bool DownloadReport(EpisodeParseResult parseResult)
{
@ -50,7 +59,7 @@ namespace NzbDrone.Core.Download
if (success)
{
logger.Trace("Download added to Queue: {0}", downloadTitle);
_logger.Trace("Download added to Queue: {0}", downloadTitle);
_eventAggregator.Publish(new EpisodeGrabbedEvent(parseResult));
}

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.ExternalNotification
public ExternalNotificationDefinition Get(string name)
{
return Queryable().SingleOrDefault(c => c.Name.ToLower() == name.ToLower());
return Query.SingleOrDefault(c => c.Name.ToLower() == name.ToLower());
}
}
}

View File

@ -21,14 +21,14 @@ namespace NzbDrone.Core.History
public void Trim()
{
var oldIds = Queryable().Where(c => c.Date < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds);
var cutoff = DateTime.Now.AddDays(-30).Date;
Delete(c=> c.Date < cutoff);
}
public QualityModel GetBestQualityInHistory(int episodeId)
{
var history = Queryable().Where(c => c.EpisodeId == episodeId)
var history = Query.Where(c => c.EpisodeId == episodeId)
.OrderByDescending(c => c.Quality).FirstOrDefault();
if (history != null)

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Core.IndexerSearch
{
private readonly ISeriesRepository _seriesRepository;
private readonly IEpisodeService _episodeService;
private readonly DownloadProvider _downloadProvider;
private readonly IDownloadProvider _downloadProvider;
private readonly ISceneMappingService _sceneMappingService;
private readonly IDownloadDirector DownloadDirector;
@ -25,7 +25,7 @@ namespace NzbDrone.Core.IndexerSearch
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
protected IndexerSearchBase(ISeriesRepository seriesRepository, IEpisodeService episodeService, DownloadProvider downloadProvider,
protected IndexerSearchBase(ISeriesRepository seriesRepository, IEpisodeService episodeService, IDownloadProvider downloadProvider,
IIndexerService indexerService, ISceneMappingService sceneMappingService,
IDownloadDirector downloadDirector)
{

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Core.IndexerSearch
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public PartialSeasonSearch(IEpisodeService episodeService, DownloadProvider downloadProvider, IIndexerService indexerService,
public PartialSeasonSearch(IEpisodeService episodeService, IDownloadProvider downloadProvider, IIndexerService indexerService,
ISceneMappingService sceneMappingService, IDownloadDirector downloadDirector,
ISeriesRepository seriesRepository)
: base(seriesRepository, episodeService, downloadProvider, indexerService, sceneMappingService,

View File

@ -36,22 +36,22 @@ namespace NzbDrone.Core.Indexers
}
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
return new List<string>();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
return new List<string>();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
return new List<string>();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
return new List<string>();
}

View File

@ -61,49 +61,25 @@ namespace NzbDrone.Core.Indexers
get { return null; }
}
protected abstract IList<String> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber);
protected abstract IList<String> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date);
protected abstract IList<String> GetSeasonSearchUrls(string seriesTitle, int seasonNumber);
protected abstract IList<String> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard);
protected abstract IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber);
protected abstract IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date);
protected abstract IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber);
protected abstract IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard);
/// <summary>
/// This method can be overwritten to provide indexer specific info parsing
/// </summary>
/// <param name="item">RSS item that needs to be parsed</param>
/// <param name="currentResult">Result of the built in parse function.</param>
/// <returns></returns>
protected virtual EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
{
return currentResult;
}
/// <summary>
/// This method can be overwritten to provide pre-parse the title
/// </summary>
/// <param name="item">RSS item that needs to be parsed</param>
/// <returns></returns>
protected virtual string TitlePreParser(SyndicationItem item)
{
return item.Title.Text;
}
/// <summary>
/// Generates direct link to download an NZB
/// </summary>
/// <param name = "item">RSS Feed item to generate the link for</param>
/// <returns>Download link URL</returns>
protected abstract string NzbDownloadUrl(SyndicationItem item);
/// <summary>
/// Generates link to the NZB info at the indexer
/// </summary>
/// <param name = "item">RSS Feed item to generate the link for</param>
/// <returns>Nzb Info URL</returns>
protected abstract string NzbInfoUrl(SyndicationItem item);
/// <summary>
/// Fetches RSS feed and process each news item.
/// </summary>
public virtual IList<EpisodeParseResult> FetchRss()
{
_logger.Debug("Fetching feeds from " + Name);
@ -168,7 +144,7 @@ namespace NzbDrone.Core.Indexers
}
protected virtual List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
private List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
{
var result = new List<EpisodeParseResult>();
@ -213,7 +189,7 @@ namespace NzbDrone.Core.Indexers
{
if (webException.Message.Contains("503"))
{
_logger.Warn("{0} server is currently unavailable.{1} {2}", Name,url, webException.Message);
_logger.Warn("{0} server is currently unavailable.{1} {2}", Name, url, webException.Message);
}
else
{
@ -231,11 +207,6 @@ namespace NzbDrone.Core.Indexers
return result;
}
/// <summary>
/// Parses the RSS feed item
/// </summary>
/// <param name = "item">RSS feed item to parse</param>
/// <returns>Detailed episode info</returns>
public EpisodeParseResult ParseFeed(SyndicationItem item)
{
var title = TitlePreParser(item);
@ -253,11 +224,6 @@ namespace NzbDrone.Core.Indexers
return CustomParser(item, episodeParseResult);
}
/// <summary>
/// This method can be overwritten to provide indexer specific title cleaning
/// </summary>
/// <param name="title">Title that needs to be cleaned</param>
/// <returns></returns>
public virtual string GetQueryTitle(string title)
{
title = RemoveThe.Replace(title, string.Empty);

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Indexers
public Indexer Find(Type type)
{
return Queryable().Single(i => i.Type == type.ToString());
return Query.Single(i => i.Type == type.ToString());
}
}
}

View File

@ -30,7 +30,7 @@ namespace NzbDrone.Core.Indexers
get { return true; }
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
var searchUrls = new List<string>();
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
var searchUrls = new List<string>();
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
var searchUrls = new List<string>();
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
var searchUrls = new List<string>();

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Core.Indexers
public IEnumerable<NewznabDefinition> Enabled()
{
return Queryable().Where(n => n.Enable);
return Query.Where(n => n.Enable);
}
}
}

View File

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Indexers
return item.Links[1].Uri.ToString();
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
var searchUrls = new List<String>();
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
var searchUrls = new List<String>();
@ -75,7 +75,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
var searchUrls = new List<String>();
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
var searchUrls = new List<String>();

View File

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Indexers
return item.Links[0].Uri.ToString();
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
var searchUrls = new List<String>();
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
var searchUrls = new List<String>();
@ -75,7 +75,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
var searchUrls = new List<String>();
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
var searchUrls = new List<String>();

View File

@ -53,22 +53,22 @@ namespace NzbDrone.Core.Indexers
return item.Links[0].Uri.ToString();
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
return new List<string>();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
return new List<string>();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
return new List<string>();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
return new List<string>();
}

View File

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Indexers
}
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
var searchUrls = new List<String>();
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
var searchUrls = new List<String>();
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
var searchUrls = new List<String>();
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
var searchUrls = new List<String>();
@ -148,7 +148,7 @@ namespace NzbDrone.Core.Indexers
return result;
}
protected override List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
protected List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
{
var result = new List<EpisodeParseResult>();

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Indexers
}
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
var searchUrls = new List<String>();
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
var searchUrls = new List<String>();
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
var searchUrls = new List<String>();
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Indexers
return searchUrls;
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
var searchUrls = new List<String>();

View File

@ -48,22 +48,22 @@ namespace NzbDrone.Core.Indexers
return null;
}
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
protected override IEnumerable<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{
return new List<string>();
}
protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
protected override IEnumerable<string> GetSeasonSearchUrls(string seriesTitle, int seasonNumber)
{
return new List<string>();
}
protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
protected override IEnumerable<string> GetDailyEpisodeSearchUrls(string seriesTitle, DateTime date)
{
return new List<string>();
}
protected override IList<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
protected override IEnumerable<string> GetPartialSeasonSearchUrls(string seriesTitle, int seasonNumber, int episodeWildcard)
{
return new List<string>();
}

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Instrumentation
public void Trim()
{
var oldIds = Queryable().Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
var oldIds = Query.Where(c => c.Time < DateTime.Now.AddDays(-30).Date).Select(c => c.Id);
DeleteMany(oldIds);
}
}

View File

@ -27,13 +27,13 @@ namespace NzbDrone.Core.Jobs
public JobDefinition GetDefinition(Type type)
{
return Queryable().Single(c => c.Type == type.FullName);
return Query.Single(c => c.Type == type.FullName);
}
public IList<JobDefinition> GetPendingJobs()
{
return Queryable().Where(c => c.Enable == true && c.Interval != 2).ToList().Where(c => c.LastExecution < DateTime.Now.AddMinutes(-c.Interval)).ToList();
return Query.Where(c => c.Enable == true && c.Interval != 2).ToList().Where(c => c.LastExecution < DateTime.Now.AddMinutes(-c.Interval)).ToList();
}
public void Init()

View File

@ -23,17 +23,17 @@ namespace NzbDrone.Core.MediaFiles
public EpisodeFile GetFileByPath(string path)
{
return Queryable().SingleOrDefault(c => c.Path == path);
return Query.SingleOrDefault(c => c.Path == path);
}
public List<EpisodeFile> GetFilesBySeries(int seriesId)
{
return Queryable().Where(c => c.SeriesId == seriesId).ToList();
return Query.Where(c => c.SeriesId == seriesId).ToList();
}
public List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber)
{
return Queryable().Where(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).ToList();
return Query.Where(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).ToList();
}
}

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Qualities
public QualitySize GetByQualityId(int qualityId)
{
return Queryable().Single(q => q.QualityId == qualityId);
return Query.Single(q => q.QualityId == qualityId);
}
}
}

View File

@ -20,12 +20,12 @@ namespace NzbDrone.Core.ReferenceData
public SceneMapping FindByTvdbId(int tvdbId)
{
return Queryable().SingleOrDefault(c => c.TvdbId == tvdbId);
return Query.SingleOrDefault(c => c.TvdbId == tvdbId);
}
public SceneMapping FindByCleanTitle(string cleanTitle)
{
return Queryable().SingleOrDefault(c => c.CleanTitle == cleanTitle);
return Query.SingleOrDefault(c => c.CleanTitle == cleanTitle);
}
}
}

View File

@ -25,17 +25,17 @@ namespace NzbDrone.Core.Tv
public IList<int> GetSeasonNumbers(int seriesId)
{
return Queryable().Where(c => c.SeriesId == seriesId).Select(c => c.SeriesId).ToList();
return Query.Where(c => c.SeriesId == seriesId).Select(c => c.SeriesId).ToList();
}
public Season Get(int seriesId, int seasonNumber)
{
return Queryable().Single(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
return Query.Single(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
}
public bool IsIgnored(int seriesId, int seasonNumber)
{
var season = Queryable().SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
var season = Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber);
if (season == null) return false;
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Tv
public List<Season> GetSeasonBySeries(int seriesId)
{
return Queryable().Where(s => s.SeriesId == seriesId);
return Query.Where(s => s.SeriesId == seriesId);
}
}
}

View File

@ -23,22 +23,22 @@ namespace NzbDrone.Core.Tv
public bool SeriesPathExists(string path)
{
return Queryable().Any(c => c.Path == path);
return Query.Any(c => c.Path == path);
}
public List<Series> Search(string title)
{
return Queryable().Where(s => s.Title.Contains(title));
return Query.Where(s => s.Title.Contains(title));
}
public Series GetByTitle(string cleanTitle)
{
return Queryable().SingleOrDefault(s => s.CleanTitle.Equals(cleanTitle));
return Query.SingleOrDefault(s => s.CleanTitle.Equals(cleanTitle));
}
public Series FindByTvdbId(int tvdbId)
{
return Queryable().SingleOrDefault(s => s.TvDbId.Equals(tvdbId));
return Query.SingleOrDefault(s => s.TvDbId.Equals(tvdbId));
}
public void SetSeriesType(int seriesId, SeriesTypes seriesType)