mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
TVRageMapping updates
Fixed: Issue matching TVDB series to TVRage series in some situations
This commit is contained in:
parent
afef5ba0f4
commit
89cfb5c9b1
@ -31,6 +31,7 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
|
||||
.With(s => s.TvRageId = 0)
|
||||
.With(s => s.TvRageTitle = null)
|
||||
.With(s => s.UtcOffset = 0)
|
||||
.With(s => s.FirstAired = DateTime.Today.AddDays(-180))
|
||||
.Build();
|
||||
|
||||
_episode = Builder<Episode>
|
||||
|
@ -25,7 +25,10 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
|
||||
.CreateListOfSize(5)
|
||||
.Build();
|
||||
|
||||
_series = Builder<Series>.CreateNew().Build();
|
||||
_series = Builder<Series>
|
||||
.CreateNew()
|
||||
.With(s => s.FirstAired = DateTime.Today.AddDays(-180))
|
||||
.Build();
|
||||
|
||||
_episode = Builder<Episode>
|
||||
.CreateNew()
|
||||
@ -63,7 +66,18 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageMappingProviderTests
|
||||
}
|
||||
|
||||
[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;
|
||||
|
||||
|
16
NzbDrone.Core/Datastore/Migrations/Migration20121226.cs
Normal file
16
NzbDrone.Core/Datastore/Migrations/Migration20121226.cs
Normal file
@ -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\MigrationsHelper.cs" />
|
||||
<Compile Include="Datastore\CustomeMapper.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121226.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121218.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121209.cs" />
|
||||
<Compile Include="Datastore\Migrations\Migration20121202.cs" />
|
||||
|
@ -110,6 +110,11 @@ namespace NzbDrone.Core.Providers
|
||||
series.BannerUrl = tvDbSeries.BannerPath;
|
||||
series.Network = tvDbSeries.Network;
|
||||
|
||||
if (tvDbSeries.FirstAired.Year > 1900)
|
||||
series.FirstAired = tvDbSeries.FirstAired.Date;
|
||||
else
|
||||
series.FirstAired = null;
|
||||
|
||||
try
|
||||
{
|
||||
if(series.TvRageId == 0)
|
||||
|
@ -59,7 +59,10 @@ namespace NzbDrone.Core.Providers
|
||||
if (!String.IsNullOrWhiteSpace(sceneCleanName) && Parser.NormalizeTitle(result.Name).Equals(sceneCleanName))
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,8 @@ namespace NzbDrone.Core.Repository
|
||||
|
||||
public int UtcOffset { get; set; }
|
||||
|
||||
public DateTime? FirstAired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Series"/> is hidden.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user