mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
fixed some broken tests.
This commit is contained in:
parent
c1960525d7
commit
ba4950ea8f
@ -2,12 +2,12 @@
|
||||
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 @@ public void Setup()
|
||||
|
||||
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 @@ private void WithSceneMapping()
|
||||
[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 @@ public void should_return_scene_mapping_when_one_exists()
|
||||
{
|
||||
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 @@ public void should_return_series_scene_name_when_one_for_season_does_not_exist()
|
||||
{
|
||||
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 @@ public void should_replace_ampersand_with_and()
|
||||
{
|
||||
_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 @@ public void should_replace_some_special_characters(string input, string expected
|
||||
{
|
||||
_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
@ -17,9 +19,9 @@ public void should_fetch_results_from_indexers()
|
||||
{
|
||||
WithValidIndexers();
|
||||
|
||||
Subject.PerformSearch(_series, new List<Episode> { _episode }, notification)
|
||||
.Should()
|
||||
.HaveCount(20);
|
||||
Subject.PerformSearch(_series, new List<Episode> { _episode }, notification)
|
||||
.Should()
|
||||
.HaveCount(20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -31,7 +33,7 @@ public void should_log_error_when_fetching_from_indexer_fails()
|
||||
.Should()
|
||||
.HaveCount(0);
|
||||
|
||||
ExceptionVerification.ExpectedErrors(4);
|
||||
ExceptionVerification.ExpectedErrors(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -39,14 +41,29 @@ public void should_hit_each_indexer_once_for_each_prefix()
|
||||
{
|
||||
WithValidIndexers();
|
||||
|
||||
Subject.PerformSearch(_series, new List<Episode> { _episode }, notification)
|
||||
.Should()
|
||||
.HaveCount(20);
|
||||
|
||||
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(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,14 @@
|
||||
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 @@ public void Setup()
|
||||
[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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ public class TestSearch : IndexerSearchBase
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -95,22 +95,22 @@ protected override NetworkCredential Credentials
|
||||
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 @@ public override bool IsConfigured
|
||||
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 @@ public override bool IsConfigured
|
||||
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 @@ public override bool IsConfigured
|
||||
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 @@ protected override NetworkCredential Credentials
|
||||
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();
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -20,7 +20,7 @@ public ConfigRepository(IDatabase database)
|
||||
|
||||
public Config Get(string key)
|
||||
{
|
||||
return Queryable().SingleOrDefault(c => c.Key == key);
|
||||
return Query.SingleOrDefault(c => c.Key == key);
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,9 +38,14 @@ public BasicRepository(IDatabase database)
|
||||
_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()
|
||||
|
@ -10,7 +10,14 @@
|
||||
|
||||
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 @@ public class DownloadProvider
|
||||
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 @@ public DownloadProvider(SabProvider sabProvider, IConfigService configService, B
|
||||
_pneumaticProvider = pneumaticProvider;
|
||||
_nzbgetProvider = nzbgetProvider;
|
||||
_eventAggregator = eventAggregator;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public DownloadProvider()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool DownloadReport(EpisodeParseResult parseResult)
|
||||
{
|
||||
@ -50,7 +59,7 @@ public virtual bool DownloadReport(EpisodeParseResult parseResult)
|
||||
|
||||
if (success)
|
||||
{
|
||||
logger.Trace("Download added to Queue: {0}", downloadTitle);
|
||||
_logger.Trace("Download added to Queue: {0}", downloadTitle);
|
||||
_eventAggregator.Publish(new EpisodeGrabbedEvent(parseResult));
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public ExternalNotificationRepository(IDatabase database)
|
||||
|
||||
public ExternalNotificationDefinition Get(string name)
|
||||
{
|
||||
return Queryable().SingleOrDefault(c => c.Name.ToLower() == name.ToLower());
|
||||
return Query.SingleOrDefault(c => c.Name.ToLower() == name.ToLower());
|
||||
}
|
||||
}
|
||||
}
|
@ -21,14 +21,14 @@ public HistoryRepository(IDatabase database)
|
||||
|
||||
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)
|
||||
|
@ -17,7 +17,7 @@ public abstract class IndexerSearchBase
|
||||
{
|
||||
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 @@ public abstract class IndexerSearchBase
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ public class PartialSeasonSearch : IndexerSearchBase
|
||||
{
|
||||
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,
|
||||
|
@ -36,22 +36,22 @@ public override bool IsConfigured
|
||||
}
|
||||
}
|
||||
|
||||
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>();
|
||||
}
|
||||
|
@ -61,49 +61,25 @@ protected virtual NetworkCredential Credentials
|
||||
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 @@ public virtual IList<EpisodeParseResult> FetchDailyEpisode(string seriesTitle, D
|
||||
|
||||
}
|
||||
|
||||
protected virtual List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
private List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
{
|
||||
var result = new List<EpisodeParseResult>();
|
||||
|
||||
@ -213,7 +189,7 @@ protected virtual List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
{
|
||||
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 @@ protected virtual List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
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 @@ public EpisodeParseResult ParseFeed(SyndicationItem item)
|
||||
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);
|
||||
|
@ -19,7 +19,7 @@ public IndexerRepository(IDatabase database)
|
||||
|
||||
public Indexer Find(Type type)
|
||||
{
|
||||
return Queryable().Single(i => i.Type == type.ToString());
|
||||
return Query.Single(i => i.Type == type.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public override bool IsConfigured
|
||||
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 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
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 @@ protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, D
|
||||
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 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
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>();
|
||||
|
||||
|
@ -17,7 +17,7 @@ public NewznabRepository(IDatabase database)
|
||||
|
||||
public IEnumerable<NewznabDefinition> Enabled()
|
||||
{
|
||||
return Queryable().Where(n => n.Enable);
|
||||
return Query.Where(n => n.Enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ protected override string NzbInfoUrl(SyndicationItem item)
|
||||
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 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
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 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
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 @@ protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, D
|
||||
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>();
|
||||
|
||||
|
@ -51,7 +51,7 @@ protected override string NzbInfoUrl(SyndicationItem item)
|
||||
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 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
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 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
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 @@ protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, D
|
||||
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>();
|
||||
|
||||
|
@ -53,22 +53,22 @@ protected override string NzbInfoUrl(SyndicationItem item)
|
||||
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>();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public override bool IsConfigured
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
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 @@ protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, D
|
||||
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 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
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 @@ public override IList<EpisodeParseResult> FetchRss()
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
protected List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
||||
{
|
||||
var result = new List<EpisodeParseResult>();
|
||||
|
||||
|
@ -42,7 +42,7 @@ public override bool IsConfigured
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int se
|
||||
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 @@ protected override IList<string> GetDailyEpisodeSearchUrls(string seriesTitle, D
|
||||
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 @@ protected override IList<string> GetSeasonSearchUrls(string seriesTitle, int sea
|
||||
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>();
|
||||
|
||||
|
@ -48,22 +48,22 @@ protected override string NzbInfoUrl(SyndicationItem item)
|
||||
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>();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public LogRepository(IDatabase database)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,13 @@ public JobRepository(IDatabase database, IEnumerable<IJob> jobs, Logger logger)
|
||||
|
||||
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()
|
||||
|
@ -23,17 +23,17 @@ public MediaFileRepository(IDatabase database)
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public QualitySizeRepository(IDatabase database)
|
||||
|
||||
public QualitySize GetByQualityId(int qualityId)
|
||||
{
|
||||
return Queryable().Single(q => q.QualityId == qualityId);
|
||||
return Query.Single(q => q.QualityId == qualityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ public SceneMappingRepository(IDatabase database)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
@ -25,17 +25,17 @@ public SeasonRepository(IDatabase database)
|
||||
|
||||
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 @@ public bool IsIgnored(int seriesId, int seasonNumber)
|
||||
|
||||
public List<Season> GetSeasonBySeries(int seriesId)
|
||||
{
|
||||
return Queryable().Where(s => s.SeriesId == seriesId);
|
||||
return Query.Where(s => s.SeriesId == seriesId);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,22 +23,22 @@ public SeriesRepository(IDatabase database)
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user