Updated petapoco to 4.0.3

This commit is contained in:
kay.one 2011-07-02 16:12:20 -07:00
parent 06eeea6a5c
commit 5a4e8330b2
5 changed files with 1825 additions and 1761 deletions

View File

@ -10,8 +10,6 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework;
using PetaPoco;
using TvdbLib.Data;
// ReSharper disable InconsistentNaming
namespace NzbDrone.Core.Test

View File

@ -85,16 +85,17 @@ namespace NzbDrone.Core.Test
}
//assert
seasonsNumbers.Should().HaveCount(8);
seasonsNumbers.Should().HaveCount(7);
seasons[1].Should().HaveCount(23);
seasons[2].Should().HaveCount(19);
seasons[3].Should().HaveCount(16);
seasons[4].Should().HaveCount(20);
seasons[5].Should().HaveCount(18);
seasons[6].Should().HaveCount(19);
foreach (var season in seasons)
{
season.Value.Should().OnlyHaveUniqueItems();
season.Value.Should().OnlyHaveUniqueItems("Season {0}", season.Key);
}
//Make sure no episode number is skipped

View File

@ -1,17 +1,18 @@
using System;
using System.Reflection;
using PetaPoco;
namespace NzbDrone.Core.Datastore
{
public class CustomeMapper : DefaultMapper
{
public override Func<object, object> GetFromDbConverter(DestinationInfo destinationInfo, Type sourceType)
public override Func<object, object> GetFromDbConverter(Type destinationType, Type sourceType)
{
if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationInfo.Type.IsGenericType && destinationInfo.Type.GetGenericTypeDefinition() == typeof(Nullable<>))
if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationType.IsGenericType && destinationType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
// If it is NULLABLE, then get the underlying type. eg if "Nullable<int>" then this will return just "int"
Type genericArgument = destinationInfo.Type.GetGenericArguments()[0];
Type genericArgument = destinationType.GetGenericArguments()[0];
if (genericArgument == typeof(DayOfWeek))
{
return delegate(object s)
@ -30,7 +31,14 @@ namespace NzbDrone.Core.Datastore
};
}
return base.GetFromDbConverter(destinationInfo, sourceType);
return base.GetFromDbConverter(destinationType, sourceType);
}
public override Func<object, object> GetFromDbConverter(PropertyInfo propertyInfo, Type sourceType)
{
return GetFromDbConverter(propertyInfo.PropertyType, sourceType);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -14,9 +14,6 @@ namespace NzbDrone.Core.Providers
private const string TVDB_APIKEY = "5D2D188E86E07F4F";
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly Regex CleanUpRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private readonly TvdbHandler _handler;
public TvDbProvider()
@ -48,6 +45,8 @@ namespace NzbDrone.Core.Providers
//Fix American Dad's scene gongshow
if (result != null && result.Id == 73141)
{
result.Episodes = result.Episodes.Where(e => e.SeasonNumber == 0 || e.EpisodeNumber > 0).ToList();
var seasonOneEpisodeCount = result.Episodes.Where(e => e.SeasonNumber == 1).Count();
var seasonOneId = result.Episodes.Where(e => e.SeasonNumber == 1).First().SeasonId;