1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 18:17:13 +00:00
Lidarr/NzbDrone.Api/Resolvers/AirTimeResolver.cs
2013-02-19 23:45:52 -08:00

22 lines
705 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using NzbDrone.Api.QualityProfiles;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Resolvers
{
public class AirTimeResolver : ValueResolver<Episode, DateTime?>
{
protected override DateTime? ResolveCore(Episode source)
{
if(String.IsNullOrWhiteSpace(source.Series.AirTime) || !source.AirDate.HasValue)
return source.AirDate;
return source.AirDate.Value.Add(Convert.ToDateTime(source.Series.AirTime).TimeOfDay)
.AddHours(source.Series.UtcOffset * -1);
}
}
}