Upcoming view column width fixed for Air Date (added time).

pull/4/head
Mark McDowall 14 years ago
parent 975d8bc679
commit ff0e0597b4

@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using NLog;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
@ -76,7 +77,7 @@ namespace NzbDrone.Core.Providers
series.SeriesId = tvDbSeries.Id;
series.Title = tvDbSeries.SeriesName;
series.AirTimes = tvDbSeries.AirsTime;
series.AirTimes = CleanAirsTime(tvDbSeries.AirsTime);
series.AirsDayOfWeek = tvDbSeries.AirsDayOfWeek;
series.Overview = tvDbSeries.Overview;
series.Status = tvDbSeries.Status;
@ -155,5 +156,29 @@ namespace NzbDrone.Core.Providers
return false;
}
/// <summary>
/// Cleans up the AirsTime Component from TheTVDB since it can be garbage that comes in.
/// </summary>
/// <param name = "input">The TVDB AirsTime</param>
/// <returns>String that contains the AirTimes</returns>
private string CleanAirsTime(string inputTime)
{
Regex timeRegex = new Regex(@"^(?<time>\d+:?\d*)\W*(?<meridiem>am|pm)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
var match = timeRegex.Match(inputTime);
var time = match.Groups["time"].Value;
var meridiem = match.Groups["meridiem"].Value;
//Lets assume that a string that doesn't contain a Merideim is aired at night... So we'll add it
if (String.IsNullOrEmpty(meridiem))
meridiem = "PM";
if (String.IsNullOrEmpty(time))
return String.Empty;
var dateTime = DateTime.Parse(time + " " + meridiem);
return dateTime.ToString("hh:mm tt");
}
}
}

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Web.Mvc;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
@ -34,7 +35,7 @@ namespace NzbDrone.Web.Controllers
EpisodeNumber = e.EpisodeNumber,
Title = e.Title,
Overview = e.Overview,
AirDate = e.AirDate
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
});
return View(new GridModel(upcoming));
@ -51,7 +52,7 @@ namespace NzbDrone.Web.Controllers
EpisodeNumber = e.EpisodeNumber,
Title = e.Title,
Overview = e.Overview,
AirDate = e.AirDate
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
});
return View(new GridModel(upcoming));
@ -68,7 +69,7 @@ namespace NzbDrone.Web.Controllers
EpisodeNumber = e.EpisodeNumber,
Title = e.Title,
Overview = e.Overview,
AirDate = e.AirDate
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
});
return View(new GridModel(upcoming));

@ -24,7 +24,7 @@ Upcoming
columns.Bound(c => c.SeasonNumber).Title("Season #").Width(40);
columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(40);
columns.Bound(c => c.Title).Title("Episode Title");
columns.Bound(c => c.AirDate).Title("Air Date").Width(0);
columns.Bound(c => c.AirDate).Title("Air Date").Width(160);
})
.DetailView(detailView => detailView.ClientTemplate(
"<fieldset>" +
@ -54,7 +54,7 @@ Upcoming
columns.Bound(c => c.SeasonNumber).Title("Season #").Width(40);
columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(40);
columns.Bound(c => c.Title).Title("Episode Title");
columns.Bound(c => c.AirDate).Title("Air Date").Width(0);
columns.Bound(c => c.AirDate).Title("Air Date").Width(160);
})
.DetailView(detailView => detailView.ClientTemplate(
"<fieldset>" +
@ -82,7 +82,7 @@ Upcoming
columns.Bound(c => c.SeasonNumber).Title("Season #").Width(40);
columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(40);
columns.Bound(c => c.Title).Title("Episode Title");
columns.Bound(c => c.AirDate).Title("Air Date").Width(0);
columns.Bound(c => c.AirDate).Title("Air Date").Width(160);
})
.DetailView(detailView => detailView.ClientTemplate(
"<fieldset>" +

Loading…
Cancel
Save