2013-02-14 03:56:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using AutoMapper;
|
|
|
|
|
using NzbDrone.Api.QualityProfiles;
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Resolvers
|
|
|
|
|
{
|
2013-02-19 07:20:51 +00:00
|
|
|
|
public class NextAiringResolver : ValueResolver<Core.Tv.Series, DateTime?>
|
2013-02-14 03:56:06 +00:00
|
|
|
|
{
|
2013-02-19 07:20:51 +00:00
|
|
|
|
protected override DateTime? ResolveCore(Core.Tv.Series source)
|
2013-02-14 03:56:06 +00:00
|
|
|
|
{
|
|
|
|
|
if(String.IsNullOrWhiteSpace(source.AirTime) || !source.NextAiring.HasValue)
|
|
|
|
|
return source.NextAiring;
|
|
|
|
|
|
|
|
|
|
return source.NextAiring.Value.Add(Convert.ToDateTime(source.AirTime).TimeOfDay)
|
|
|
|
|
.AddHours(source.UtcOffset * -1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|