1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

live tv updates

This commit is contained in:
Luke Pulverenti 2013-12-20 15:09:49 -05:00
parent 736a8233a3
commit 97a67a7cf8
16 changed files with 397 additions and 117 deletions

View file

@ -288,7 +288,7 @@
$('#players', page).hide();
}
if (item.Artists && item.Artists.length) {
if (item.Artists && item.Artists.length && item.Type != "MusicAlbum") {
$('#artist', page).show().html(getArtistLinksHtml(item.Artists)).trigger('create');
} else {
$('#artist', page).hide();

View file

@ -2043,24 +2043,16 @@
if (item.Type == "Audio") {
miscInfo.push(Dashboard.getDisplayTime(item.RunTimeTicks));
} else {
minutes = item.RunTimeTicks / 600000000;
minutes = minutes || 1;
miscInfo.push(minutes.toFixed(0) + "min");
miscInfo.push(Math.round(minutes) + "min");
}
}
if (item.DurationMs) {
minutes = item.DurationMs / 60000;
minutes = minutes || 1;
miscInfo.push(minutes.toFixed(0) + "min");
}
if (item.OfficialRating && item.Type !== "Season" && item.Type !== "Episode") {
miscInfo.push(item.OfficialRating);
}
@ -2086,17 +2078,13 @@
renderOverview: function (elem, item) {
if (item.Overview || item.OverviewHtml) {
var overview = item.OverviewHtml || item.Overview;
var overview = item.OverviewHtml || item.Overview || '';
elem.html(overview).show().trigger('create');
elem.html(overview).show().trigger('create');
$('a', elem).each(function () {
$(this).attr("target", "_blank");
});
} else {
elem.hide();
}
$('a', elem).each(function () {
$(this).attr("target", "_blank");
});
},

View file

@ -15,85 +15,139 @@
var html = '';
var cssClass = "detailTable";
//var cssClass = "detailTable";
html += '<div class="detailTableContainer"><table class="' + cssClass + '">';
//html += '<div class="detailTableContainer"><table class="' + cssClass + '">';
html += '<tr>';
//html += '<tr>';
html += '<th>&nbsp;</th>';
html += '<th>Date</th>';
html += '<th>Start</th>';
html += '<th class="tabletColumn">End</th>';
html += '<th>Name</th>';
html += '<th class="desktopColumn">Genre</th>';
//html += '<th>&nbsp;</th>';
//html += '<th>Date</th>';
//html += '<th>Start</th>';
//html += '<th class="tabletColumn">End</th>';
//html += '<th>Name</th>';
html += '</tr>';
//html += '</tr>';
var currentIndexValue;
for (var i = 0, length = result.Items.length; i < length; i++) {
var program = result.Items[i];
html += '<tr>';
html += '<td>';
if (program.RecordingId) {
html += '<button data-recordingid="' + program.RecordingId + '" class="btnCancelRecording" type="button" data-icon="delete" data-inline="true" data-mini="true" data-iconpos="notext">Cancel</button>';
} else {
html += '<a href="livetvnewrecording.html?programid=' + program.Id + '" data-role="button" type="button" data-icon="facetime-video" data-inline="true" data-mini="true" data-theme="b" data-iconpos="notext">Record</a>';
}
html += '</td>';
var startDate = program.StartDate;
var startDateText = '';
try {
startDate = parseISO8601Date(startDate, { toLocal: true });
startDateText = LibraryBrowser.getFutureDateText(startDate);
} catch (err) {
}
html += '<td>' + startDate.toLocaleDateString() + '</td>';
if (startDateText != currentIndexValue) {
html += '<td>' + LiveTvHelpers.getDisplayTime(program.StartDate) + '</td>';
html += '<td class="tabletColumn">' + LiveTvHelpers.getDisplayTime(program.EndDate) + '</td>';
html += '<td>';
if (program.Name) {
//html += '<a href="livetvprogram.html?id=' + program.Id + '">';
html += program.Name;
//html += '</a>';
html += '<h2 class="detailSectionHeader tvProgramSectionHeader">' + startDateText + '</h2>';
currentIndexValue = startDateText;
}
html += '</td>';
html += '<a href="livetvprogram.html?id=' + program.Id + '" class="tvProgram">';
html += '<td class="desktopColumn">' + program.Genres.join(' / ') + '</td>';
html += '<div class="tvProgramTimeSlot">';
html += '<div class="tvProgramTimeSlotInner">' + LiveTvHelpers.getDisplayTime(startDate) + '</div>';
html += '</div>';
html += '</tr>';
var cssClass = "tvProgramInfo";
if (program.IsKids) {
cssClass += " childProgramInfo";
}
else if (program.IsSports) {
cssClass += " sportsProgramInfo";
}
else if (program.IsNews) {
cssClass += " newsProgramInfo";
}
else if (program.IsMovie) {
cssClass += " movieProgramInfo";
}
html += '<div class="' + cssClass + '">';
html += '<div class="tvProgramName">' + program.Name + '</div>';
html += '<div class="tvProgramTime">';
if (program.IsLive) {
html += '<span class="liveTvProgram">LIVE&nbsp;&nbsp;</span>';
}
else if (program.IsPremiere) {
html += '<span class="liveTvProgram">PREMIERE&nbsp;&nbsp;</span>';
}
else if (program.IsSeries && !program.IsRepeat) {
html += '<span class="newTvProgram">NEW&nbsp;&nbsp;</span>';
}
var minutes = program.RunTimeTicks / 600000000;
minutes = Math.round(minutes || 1) + ' min';
if (program.EpisodeTitle) {
html += program.EpisodeTitle + '&nbsp;&nbsp;(' + minutes + ')';
} else {
html += minutes;
}
html += '</div>';
html += '</div>';
//html += '<tr>';
//html += '<td>';
//if (program.RecordingId) {
// html += '<button data-recordingid="' + program.RecordingId + '" class="btnCancelRecording" type="button" data-icon="delete" data-inline="true" data-mini="true" data-iconpos="notext">Cancel</button>';
//} else {
// html += '<a href="livetvnewrecording.html?programid=' + program.Id + '" data-role="button" type="button" data-icon="facetime-video" data-inline="true" data-mini="true" data-theme="b" data-iconpos="notext">Record</a>';
//}
//html += '</td>';
//var startDate = program.StartDate;
//try {
// startDate = parseISO8601Date(startDate, { toLocal: true });
//} catch (err) {
//}
//html += '<td>' + startDate.toLocaleDateString() + '</td>';
//html += '<td>' + LiveTvHelpers.getDisplayTime(program.StartDate) + '</td>';
//html += '<td class="tabletColumn">' + LiveTvHelpers.getDisplayTime(program.EndDate) + '</td>';
//html += '<td>';
//if (program.Name) {
// //html += '<a href="livetvprogram.html?id=' + program.Id + '">';
// html += program.Name;
// //html += '</a>';
//}
//html += '</td>';
html += '</a>';
}
html += '</table></div>';
//html += '</table></div>';
var elem = $('#programList', page).html(html).trigger('create');
$('.btnCancelRecording', elem).on('click', function () {
var recordingId = this.getAttribute('data-recordingid');
cancelRecording(page, recordingId);
});
$('.btnScheduleRecording', elem).on('click', function () {
var recordingId = this.getAttribute('data-recordingid');
scheduleRecording(page, recordingId);
});
$('#programList', page).html(html).trigger('create');
}
function loadPrograms(page) {
@ -165,17 +219,19 @@
getDisplayTime: function (date) {
try {
if ((typeof date).toString().toLowerCase() === 'string') {
try {
date = parseISO8601Date(date, { toLocal: true });
date = parseISO8601Date(date, { toLocal: true });
} catch (err) {
return date;
} catch (err) {
return date;
}
}
date = date.toLocaleTimeString();
date = date.replace('0:00', '0');
date = date.replace('0:00', '0').replace(':00 ', '').replace(' ', '');
return date;
}

View file

@ -0,0 +1,85 @@
(function ($, document, apiClient) {
var currentItem;
function reload(page) {
Dashboard.showLoadingMsg();
ApiClient.getLiveTvProgram(getParameterByName('id'), Dashboard.getCurrentUserId()).done(function (item) {
var context = 'livetv';
currentItem = item;
var name = item.Name;
$('#itemImage', page).html(LibraryBrowser.getDetailImageHtml(item));
Dashboard.setPageTitle(name);
$('.itemName', page).html(name);
$('.itemChannelNumber', page).html('Channel:&nbsp;&nbsp;&nbsp;<a href="livetvchannel.html?id=' + item.ChannelId + '">' + item.ChannelName + '</a>').trigger('create');
if (item.EpisodeTitle) {
$('.itemEpisodeName', page).html('Episode:&nbsp;&nbsp;&nbsp;' + item.EpisodeTitle);
} else {
$('.itemEpisodeName', page).html('');
}
if (item.CommunityRating) {
$('.itemCommunityRating', page).html(LibraryBrowser.getRatingHtml(item)).show();
} else {
$('.itemCommunityRating', page).hide();
}
$('.userDataIcons', page).html(LibraryBrowser.getUserDataIconsHtml(item));
LibraryBrowser.renderGenres($('.itemGenres', page), item, context);
LibraryBrowser.renderOverview($('.itemOverview', page), item);
$('.itemMiscInfo', page).html(LibraryBrowser.getMiscInfoHtml(item));
if (ApiClient.isWebSocketOpen()) {
var vals = [item.Type, item.Id, item.Name];
vals.push('livetv');
ApiClient.sendWebSocketMessage("Context", vals.join('|'));
}
if (MediaPlayer.canPlay(item)) {
$('#playButtonContainer', page).show();
} else {
$('#playButtonContainer', page).hide();
}
Dashboard.getCurrentUser().done(function (user) {
if (user.Configuration.IsAdministrator && item.LocationType !== "Offline") {
$('#editButtonContainer', page).show();
} else {
$('#editButtonContainer', page).hide();
}
});
Dashboard.hideLoadingMsg();
});
}
$(document).on('pageinit', "#liveTvProgramPage", function () {
var page = this;
}).on('pageshow', "#liveTvProgramPage", function () {
var page = this;
reload(page);
}).on('pagehide', "#liveTvProgramPage", function () {
currentItem = null;
});
})(jQuery, document, ApiClient);

View file

@ -59,9 +59,11 @@
html += '<td>' + LiveTvHelpers.getDisplayTime(recording.StartDate) + '</td>';
var minutes = recording.DurationMs / 60000;
var minutes = recording.RunTimeTicks / 600000000;
html += '<td class="tabletColumn">' + minutes.toFixed(0) + ' mins</td>';
minutes = minutes || 1;
html += '<td class="tabletColumn">' + Math.round(minutes) + 'min</td>';
html += '<td class="tabletColumn">' + (recording.Status || '') + '</td>';

View file

@ -74,9 +74,11 @@
html += '<td>' + LiveTvHelpers.getDisplayTime(timer.StartDate) + '</td>';
var minutes = timer.DurationMs / 60000;
var minutes = timer.RunTimeTicks / 600000000;
html += '<td class="tabletColumn">' + minutes.toFixed(0) + ' mins</td>';
minutes = minutes || 1;
html += '<td class="tabletColumn">' + Math.round(minutes) + 'min</td>';
html += '<td class="tabletColumn">';