TVRageMapping updates

Fixed: Issue matching TVDB series to TVRage series in some situations
pull/2/head
Mark McDowall 12 years ago
parent afef5ba0f4
commit 89cfb5c9b1

@ -31,6 +31,7 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
.With(s => s.TvRageId = 0) .With(s => s.TvRageId = 0)
.With(s => s.TvRageTitle = null) .With(s => s.TvRageTitle = null)
.With(s => s.UtcOffset = 0) .With(s => s.UtcOffset = 0)
.With(s => s.FirstAired = DateTime.Today.AddDays(-180))
.Build(); .Build();
_episode = Builder<Episode> _episode = Builder<Episode>

@ -25,7 +25,10 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
.CreateListOfSize(5) .CreateListOfSize(5)
.Build(); .Build();
_series = Builder<Series>.CreateNew().Build(); _series = Builder<Series>
.CreateNew()
.With(s => s.FirstAired = DateTime.Today.AddDays(-180))
.Build();
_episode = Builder<Episode> _episode = Builder<Episode>
.CreateNew() .CreateNew()
@ -63,7 +66,18 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
} }
[Test] [Test]
public void should_return_result_if_firstAired_matches() public void should_return_result_if_series_firstAired_matches()
{
_series.FirstAired = _searchResults.Last().Started;
Mocker.Resolve<TvRageMappingProvider>()
.ProcessResults(_searchResults, _series, "nomatchhere", _episode)
.Should()
.Be(_searchResults.Last());
}
[Test]
public void should_return_result_if_episode_firstAired_matches()
{ {
_episode.AirDate = _searchResults.Last().Started; _episode.AirDate = _searchResults.Last().Started;

@ -0,0 +1,16 @@
using System;
using System.Data;
using Migrator.Framework;
using NzbDrone.Common;
namespace NzbDrone.Core.Datastore.Migrations
{
[Migration(20121226)]
public class Migration20121226 : NzbDroneMigration
{
protected override void MainDbUpgrade()
{
Database.AddColumn("Series", new Column("FirstAired", DbType.DateTime, ColumnProperty.Null));
}
}
}

@ -228,6 +228,7 @@
<Compile Include="Datastore\MigrationLogger.cs" /> <Compile Include="Datastore\MigrationLogger.cs" />
<Compile Include="Datastore\MigrationsHelper.cs" /> <Compile Include="Datastore\MigrationsHelper.cs" />
<Compile Include="Datastore\CustomeMapper.cs" /> <Compile Include="Datastore\CustomeMapper.cs" />
<Compile Include="Datastore\Migrations\Migration20121226.cs" />
<Compile Include="Datastore\Migrations\Migration20121218.cs" /> <Compile Include="Datastore\Migrations\Migration20121218.cs" />
<Compile Include="Datastore\Migrations\Migration20121209.cs" /> <Compile Include="Datastore\Migrations\Migration20121209.cs" />
<Compile Include="Datastore\Migrations\Migration20121202.cs" /> <Compile Include="Datastore\Migrations\Migration20121202.cs" />

@ -110,6 +110,11 @@ namespace NzbDrone.Core.Providers
series.BannerUrl = tvDbSeries.BannerPath; series.BannerUrl = tvDbSeries.BannerPath;
series.Network = tvDbSeries.Network; series.Network = tvDbSeries.Network;
if (tvDbSeries.FirstAired.Year > 1900)
series.FirstAired = tvDbSeries.FirstAired.Date;
else
series.FirstAired = null;
try try
{ {
if(series.TvRageId == 0) if(series.TvRageId == 0)

@ -59,7 +59,10 @@ namespace NzbDrone.Core.Providers
if (!String.IsNullOrWhiteSpace(sceneCleanName) && Parser.NormalizeTitle(result.Name).Equals(sceneCleanName)) if (!String.IsNullOrWhiteSpace(sceneCleanName) && Parser.NormalizeTitle(result.Name).Equals(sceneCleanName))
return result; return result;
if (firstEpisode.AirDate.HasValue && result.Started == firstEpisode.AirDate.Value) if (series.FirstAired.HasValue && result.Started == series.FirstAired.Value)
return result;
if (firstEpisode != null && firstEpisode.AirDate.HasValue && result.Started == firstEpisode.AirDate.Value)
return result; return result;
} }

@ -58,6 +58,8 @@ namespace NzbDrone.Core.Repository
public int UtcOffset { get; set; } public int UtcOffset { get; set; }
public DateTime? FirstAired { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this <see cref="Series"/> is hidden. /// Gets or sets a value indicating whether this <see cref="Series"/> is hidden.
/// </summary> /// </summary>

Loading…
Cancel
Save