mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Updated petapoco to 4.0.3
This commit is contained in:
parent
06eeea6a5c
commit
5a4e8330b2
@ -10,8 +10,6 @@
|
|||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using PetaPoco;
|
|
||||||
using TvdbLib.Data;
|
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
|
@ -85,16 +85,17 @@ public void American_dad_fix()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
seasonsNumbers.Should().HaveCount(8);
|
seasonsNumbers.Should().HaveCount(7);
|
||||||
seasons[1].Should().HaveCount(23);
|
seasons[1].Should().HaveCount(23);
|
||||||
seasons[2].Should().HaveCount(19);
|
seasons[2].Should().HaveCount(19);
|
||||||
seasons[3].Should().HaveCount(16);
|
seasons[3].Should().HaveCount(16);
|
||||||
seasons[4].Should().HaveCount(20);
|
seasons[4].Should().HaveCount(20);
|
||||||
seasons[5].Should().HaveCount(18);
|
seasons[5].Should().HaveCount(18);
|
||||||
|
seasons[6].Should().HaveCount(19);
|
||||||
|
|
||||||
foreach (var season in seasons)
|
foreach (var season in seasons)
|
||||||
{
|
{
|
||||||
season.Value.Should().OnlyHaveUniqueItems();
|
season.Value.Should().OnlyHaveUniqueItems("Season {0}", season.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Make sure no episode number is skipped
|
//Make sure no episode number is skipped
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Datastore
|
namespace NzbDrone.Core.Datastore
|
||||||
{
|
{
|
||||||
public class CustomeMapper : DefaultMapper
|
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"
|
// 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))
|
if (genericArgument == typeof(DayOfWeek))
|
||||||
{
|
{
|
||||||
return delegate(object s)
|
return delegate(object s)
|
||||||
@ -30,7 +31,14 @@ public override Func<object, object> GetFromDbConverter(DestinationInfo destinat
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
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
@ -14,9 +14,6 @@ public class TvDbProvider
|
|||||||
private const string TVDB_APIKEY = "5D2D188E86E07F4F";
|
private const string TVDB_APIKEY = "5D2D188E86E07F4F";
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
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;
|
private readonly TvdbHandler _handler;
|
||||||
|
|
||||||
public TvDbProvider()
|
public TvDbProvider()
|
||||||
@ -48,6 +45,8 @@ public virtual TvdbSeries GetSeries(int id, bool loadEpisodes)
|
|||||||
//Fix American Dad's scene gongshow
|
//Fix American Dad's scene gongshow
|
||||||
if (result != null && result.Id == 73141)
|
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 seasonOneEpisodeCount = result.Episodes.Where(e => e.SeasonNumber == 1).Count();
|
||||||
var seasonOneId = result.Episodes.Where(e => e.SeasonNumber == 1).First().SeasonId;
|
var seasonOneId = result.Episodes.Where(e => e.SeasonNumber == 1).First().SeasonId;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user