From d7b8e3c583476b321a5749f7f652909fb95dd554 Mon Sep 17 00:00:00 2001 From: Techywarrior Date: Tue, 26 Mar 2013 16:57:18 -0700 Subject: [PATCH] Media Info for items populated --- dashboard-ui/scripts/Itemdetailpage.js | 88 +++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 8 deletions(-) diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js index 61d32666d8..8cd7793912 100644 --- a/dashboard-ui/scripts/Itemdetailpage.js +++ b/dashboard-ui/scripts/Itemdetailpage.js @@ -4,6 +4,7 @@ ItemDetailPage.reload(); + $('#mediaInfoCollapsible', this).on('expand', ItemDetailPage.onMediaInfoExpand); $('#scenesCollapsible', this).on('expand', ItemDetailPage.onScenesExpand); $('#specialsCollapsible', this).on('expand', ItemDetailPage.onSpecialsExpand); $('#trailersCollapsible', this).on('expand', ItemDetailPage.onTrailersExpand); @@ -12,6 +13,7 @@ onPageHide: function () { + $('#mediaInfoCollapsible', this).off('expand', ItemDetailPage.onMediaInfoExpand); $('#scenesCollapsible', this).off('expand', ItemDetailPage.onScenesExpand); $('#specialsCollapsible', this).off('expand', ItemDetailPage.onSpecialsExpand); $('#trailersCollapsible', this).off('expand', ItemDetailPage.onTrailersExpand); @@ -49,26 +51,27 @@ ItemDetailPage.renderImage(item); ItemDetailPage.renderOverviewBlock(item); - ItemDetailPage.renderMediaInfo(item); ItemDetailPage.renderGallery(item); + if (!item.MediaStreams || !item.MediaStreams.length) { + $('#mediaInfoCollapsible', page).hide(); + }else { + $('#mediaInfoCollapsible', page).show(); + } if (!item.Chapters || !item.Chapters.length) { $('#scenesCollapsible', page).hide(); } else { $('#scenesCollapsible', page).show(); - ItemDetailPage.renderScenes(item); } if (!item.LocalTrailerCount || item.LocalTrailerCount == 0) { $('#trailersCollapsible', page).hide(); } else { $('#trailersCollapsible', page).show(); - ItemDetailPage.renderTrailers(item); } if (!item.SpecialFeatureCount || item.SpecialFeatureCount == 0) { $('#specialsCollapsible', page).hide(); } else { $('#specialsCollapsible', page).show(); - ItemDetailPage.renderSpecials(item); } $('#itemName', page).html(name); @@ -148,7 +151,7 @@ }, renderOverviewBlock: function (item) { -console.log(item); + var page = $.mobile.activePage; if (item.Taglines && item.Taglines.length) { @@ -426,15 +429,84 @@ console.log(item); return html; }, + onMediaInfoExpand: function () { + + if (ItemDetailPage.item) { + + ItemDetailPage.renderMediaInfo(ItemDetailPage.item); + + $(this).off('expand', ItemDetailPage.onMediaInfoExpand); + } + }, + renderMediaInfo: function (item) { var page = $.mobile.activePage; + var html = ''; - if (!item.MediaStreams || !item.MediaStreams.length) { - $('#mediaInfoCollapsible', page).hide(); - return; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + + for (var i = 0, length = item.MediaStreams.length; i < length; i++) { + + var stream = item.MediaStreams[i]; + + html += ''; + html += ''; + html += ''; + + if (stream.Language) + html += ''; + else html += ''; + + if (stream.Type == "Video") { + html += ''; + }else if (stream.Type == "Audio") { + html += ''; + }else if (stream.Type == "Subtitle") { + if (stream.IsExternal) { + html += ''; + }else { + html += ''; + } + }else { + html += ''; + } + + html += ''; + + if (stream.Type == "Video") { + html += ''; + }else if (stream.Type == "Audio") { + var notes = new Array(); + if (stream.IsDefault) notes.push("Default"); + if (stream.IsForced) notes.push("Forced"); + + html += ''; + }else if (stream.Type == "Subtitle") { + var notes = new Array(); + if (stream.IsDefault) notes.push("Default"); + if (stream.IsForced) notes.push("Forced"); + + html += ''; + }else { + html += ''; + } + + html += ''; } + html += '
TypeCodecLanguageMiscBitrateNotes
' + stream.Type + '' + stream.Codec +'' + stream.Language +''+ stream.Width +' '+ stream.Height +' ('+ stream.AspectRatio +')'+ stream.Channels +'ch '+ stream.SampleRate +'external file' + stream.BitRate +''+ stream.AverageFrameRate || stream.RealFrameRate +'' + notes.join(', ') + '' + notes.join(', ') + '
'; + + $('#mediaInfoContent', page).html(html).trigger('create'); $('#mediaInfoCollapsible', page).show(); },