diff --git a/dashboard-ui/livetvtimers.html b/dashboard-ui/livetvtimers.html
index 94c515573e..e8119b0208 100644
--- a/dashboard-ui/livetvtimers.html
+++ b/dashboard-ui/livetvtimers.html
@@ -6,6 +6,7 @@
+
Suggested
Guide
Channels
Recordings
diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js
index eb11e6fad6..e4a87fde78 100644
--- a/dashboard-ui/scripts/librarymenu.js
+++ b/dashboard-ui/scripts/librarymenu.js
@@ -75,7 +75,7 @@
}
if (liveTvServices.length) {
- html += '';
+ html += '';
}
if (counts.SongCount || counts.MusicVideoCount) {
@@ -149,6 +149,7 @@
if (liveTvServices.length) {
html += getCollapsibleHtml('Live TV', [
+ { text: 'Suggested', href: 'livetvsuggested.html' },
{ text: 'Guide', href: 'livetvguide.html' },
{ text: 'Channels', href: 'livetvchannels.html' },
{ text: 'Recordings', href: 'livetvrecordings.html' },
diff --git a/dashboard-ui/scripts/livetvguide.js b/dashboard-ui/scripts/livetvguide.js
index ca0da5d109..68433bd22d 100644
--- a/dashboard-ui/scripts/livetvguide.js
+++ b/dashboard-ui/scripts/livetvguide.js
@@ -1,7 +1,11 @@
(function ($, document, apiClient) {
// 30 mins
- var cellDurationMs = 30 * 60 * 1000;
+ var cellCurationMinutes = 30;
+ var cellDurationMs = cellCurationMinutes * 60 * 1000;
+
+ var gridLocalStartDateMs;
+ var gridLocalEndDateMs;
function formatDigit(i) {
return i < 10 ? "0" + i : i;
@@ -19,21 +23,17 @@
function normalizeDateToTimeslot(date) {
- var minutesOffset = date.getMinutes() - 30;
+ var minutesOffset = date.getMinutes() - cellCurationMinutes;
if (minutesOffset >= 0) {
- date.setTime(date.getTime() - (minutesOffset * 60 * 1000));
+ date.setHours(date.getHours(), cellCurationMinutes, 0, 0);
} else {
- date.setTime(date.getTime() - (date.getMinutes() * 60 * 1000));
+ date.setHours(date.getHours(), 0, 0, 0);
}
- date.setTime(date.getTime() - (date.getSeconds() * 1000));
-
- date.setHours(date.getHours(), date.getMinutes(), 0, 0);
-
return date;
}
@@ -136,6 +136,29 @@
return null;
}
+ function getProgramWidth(program) {
+
+ var end = Math.min(gridLocalEndDateMs, program.EndDateLocal.getTime());
+ var start = Math.max(gridLocalStartDateMs, program.StartDateLocal.getTime());
+
+ var ms = end - start;
+
+ var width = 100 * ms / cellDurationMs;
+
+ // Round to the nearest cell
+ var overlap = width % 100;
+
+ if (overlap) {
+ width = width - overlap + 100;
+ }
+
+ if (width > 300) {
+ width += (width / 100) - 3;
+ }
+
+ return width;
+ }
+
function getChannelProgramsHtml(page, date, channel, programs) {
var html = '';
@@ -150,7 +173,7 @@
var programIndex = 0;
var cellIndex = 0;
-
+
while (date.getDate() == dateNumber) {
// Add 30 mins
@@ -165,31 +188,51 @@
html += '
';
+ var cellTagName;
+ var href;
var cssClass = "timeslotCellInner";
+ var style;
if (program) {
if (program.IsKids) {
cssClass += " childProgramInfo";
- }
- else if (program.IsSports) {
+ } else if (program.IsSports) {
cssClass += " sportsProgramInfo";
- }
- else if (program.IsNews) {
+ } else if (program.IsNews) {
cssClass += " newsProgramInfo";
- }
- else if (program.IsMovie) {
+ } else if (program.IsMovie) {
cssClass += " movieProgramInfo";
}
+ else {
+ cssClass += " plainProgramInfo";
+ }
+
+ cssClass += " timeslotCellInnerWithProgram";
+
+ cellTagName = "a";
+ href = ' href="livetvprogram.html?id=' + program.Id + '"';
+
+ var width = getProgramWidth(program);
+
+ if (width && width != 100) {
+ style = ' style="width:' + width + '%;"';
+ } else {
+ style = '';
+ }
+ } else {
+ cellTagName = "div";
+ href = '';
+ style = '';
}
- html += '
';
-
+ html += '<' + cellTagName + ' class="' + cssClass + '"' + href + style + '>';
+
if (program) {
html += '
';
html += program.Name;
html += '
';
-
+
html += '
';
if (program.IsLive) {
@@ -206,13 +249,23 @@
html += ' - ';
html += LiveTvHelpers.getDisplayTime(program.EndDateLocal);
+ if (program.SeriesTimerId) {
+ html += '
';
+ html += '
';
+ html += '
';
+ }
+ else if (program.TimerId) {
+
+ html += '
';
+ }
+
html += '
';
} else {
html += ' ';
}
- html += '
';
+ html += '' + cellTagName + '>';
html += '
';
date = cellEndDate;
@@ -245,9 +298,10 @@
html += '