mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-26 01:37:07 +00:00
Fixed issue with invalid AirTimes for series causing Upcoming Views to fail.
This commit is contained in:
parent
dcc4410f84
commit
1d31c1687c
1 changed files with 16 additions and 8 deletions
|
@ -38,9 +38,9 @@ namespace NzbDrone.Web.Controllers
|
||||||
EpisodeNumber = u.EpisodeNumber,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
Title = u.Title,
|
Title = u.Title,
|
||||||
Overview = u.Overview,
|
Overview = u.Overview,
|
||||||
AirDateTime = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay),
|
AirDateTime = GetDateTime(u.AirDate.Value, u.Series.AirTimes),
|
||||||
AirDate = u.AirDate.Value.ToBestDateString(),
|
AirDate = u.AirDate.Value.ToBestDateString(),
|
||||||
AirTime = Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
AirTime = String.IsNullOrEmpty(u.Series.AirTimes) ? "?" : Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
||||||
Status = u.Status.ToString()
|
Status = u.Status.ToString()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ namespace NzbDrone.Web.Controllers
|
||||||
EpisodeNumber = u.EpisodeNumber,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
Title = u.Title,
|
Title = u.Title,
|
||||||
Overview = u.Overview,
|
Overview = u.Overview,
|
||||||
AirDateTime = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay),
|
AirDateTime = GetDateTime(u.AirDate.Value, u.Series.AirTimes),
|
||||||
AirDate = u.AirDate.Value.ToBestDateString(),
|
AirDate = u.AirDate.Value.ToBestDateString(),
|
||||||
AirTime = Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
AirTime = String.IsNullOrEmpty(u.Series.AirTimes) ? "?" : Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
||||||
Status = u.Status.ToString()
|
Status = u.Status.ToString()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -80,9 +80,9 @@ namespace NzbDrone.Web.Controllers
|
||||||
EpisodeNumber = u.EpisodeNumber,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
Title = u.Title,
|
Title = u.Title,
|
||||||
Overview = u.Overview,
|
Overview = u.Overview,
|
||||||
AirDateTime = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay),
|
AirDateTime = GetDateTime(u.AirDate.Value, u.Series.AirTimes),
|
||||||
AirDate = u.AirDate.Value.ToBestDateString(),
|
AirDate = u.AirDate.Value.ToBestDateString(),
|
||||||
AirTime = Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
AirTime = String.IsNullOrEmpty(u.Series.AirTimes) ? "?" : Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
||||||
Status = u.Status.ToString()
|
Status = u.Status.ToString()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -101,13 +101,21 @@ namespace NzbDrone.Web.Controllers
|
||||||
EpisodeNumber = u.EpisodeNumber,
|
EpisodeNumber = u.EpisodeNumber,
|
||||||
Title = u.Title,
|
Title = u.Title,
|
||||||
Overview = u.Overview,
|
Overview = u.Overview,
|
||||||
AirDateTime = u.AirDate.Value.Add(Convert.ToDateTime(u.Series.AirTimes).TimeOfDay),
|
AirDateTime = GetDateTime(u.AirDate.Value, u.Series.AirTimes),
|
||||||
AirDate = u.AirDate.Value.ToBestDateString(),
|
AirDate = u.AirDate.Value.ToBestDateString(),
|
||||||
AirTime = Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
AirTime = String.IsNullOrEmpty(u.Series.AirTimes) ? "?" : Convert.ToDateTime(u.Series.AirTimes).ToShortTimeString(),
|
||||||
Status = u.Status.ToString()
|
Status = u.Status.ToString()
|
||||||
});
|
});
|
||||||
|
|
||||||
return View(new GridModel(upcoming));
|
return View(new GridModel(upcoming));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTime GetDateTime(DateTime airDate, string airTime)
|
||||||
|
{
|
||||||
|
if (String.IsNullOrWhiteSpace(airTime))
|
||||||
|
return airDate;
|
||||||
|
|
||||||
|
return airDate.Add(Convert.ToDateTime(airTime).TimeOfDay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue