Fixed searchProvider

pull/6/head
Mark McDowall 12 years ago
parent c693f90271
commit 728a18f680

@ -833,41 +833,5 @@ namespace NzbDrone.Core.Test.ProviderTests
}
[Test]
public void Update_UseSceneNumbering_should_update_applicable_series()
{
WithRealDb();
var series = Builder<Series>.CreateListOfSize(5)
.All()
.With(s => s.UseSceneNumbering = false)
.Build();
Db.InsertMany(series);
Mocker.Resolve<SeriesProvider>().UpdateUseSceneNumbering(new []{ 2, 3 });
var seriesResults = Db.Fetch<Series>();
seriesResults.Single(s => s.SeriesId == 2).UseSceneNumbering.Should().BeTrue();
seriesResults.Single(s => s.SeriesId == 3).UseSceneNumbering.Should().BeTrue();
}
[Test]
public void Update_UseSceneNumbering_should_not_update_other_series()
{
WithRealDb();
var series = Builder<Series>.CreateListOfSize(5)
.All()
.With(s => s.UseSceneNumbering = false)
.Build();
Db.InsertMany(series);
Mocker.Resolve<SeriesProvider>().UpdateUseSceneNumbering(new [] { 2, 3 });
var seriesResults = Db.Fetch<Series>();
seriesResults.Where(s => !s.UseSceneNumbering).Should().HaveCount(3);
seriesResults.Where(s => !s.UseSceneNumbering).Should().NotContain(s => s.SeriesId == 2 || s.SeriesId == 3);
}
}
}

@ -254,7 +254,12 @@ namespace NzbDrone.Core.Providers
//Treat as single episode
else if (episodes.Count == 1)
{
if (!series.IsDaily)
//Use SceneNumbering
if (series.UseSceneNumbering)
reports.AddRange(indexer.FetchEpisode(title, episodes.First().SceneSeasonNumber, episodes.First().SceneEpisodeNumber));
//Standard
else if (!series.IsDaily)
reports.AddRange(indexer.FetchEpisode(title, seasonNumber, episodes.First().EpisodeNumber));
//Daily Episode

@ -238,14 +238,6 @@ namespace NzbDrone.Core.Providers
_database.UpdateMany(allSeries);
}
public virtual void UpdateUseSceneNumbering(IEnumerable<Int32> seriesIds)
{
_database.Execute("UPDATE Series SET UseSceneNumbering = 0");
var query = String.Format("UPDATE Series SET UseSceneNumbering = 1 WHERE SeriesId IN ({0})", String.Join(",", seriesIds));
_database.Execute(query);
}
/// <summary>
/// Cleans up the AirsTime Component from TheTVDB since it can be garbage that comes in.
/// </summary>

Loading…
Cancel
Save