mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Upcoming view column width fixed for Air Date (added time).
This commit is contained in:
parent
975d8bc679
commit
ff0e0597b4
File diff suppressed because one or more lines are too long
@ -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 @@ public virtual Series UpdateSeriesInfo(int seriesId)
|
||||
|
||||
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 @@ public virtual bool SeriesPathExists(string cleanPath)
|
||||
|
||||
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 @@ public ActionResult _AjaxBindingYesterday()
|
||||
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 @@ public ActionResult _AjaxBindingToday()
|
||||
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 @@ public ActionResult _AjaxBindingWeek()
|
||||
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…
Reference in New Issue
Block a user