fixes #839 - Support getting latest channel items

This commit is contained in:
Luke Pulverenti 2014-06-15 19:30:04 -04:00
parent 77b267a916
commit 4beb349afe
17 changed files with 239 additions and 19 deletions

View File

@ -7,6 +7,7 @@
<div id="channelsPage" data-role="page" class="page libraryPage channelsPage" data-theme="b" data-contextname="${HeaderChannels}">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="channelslatest.html">${TabLatest}</a>
<a href="#" class="ui-btn-active">${TabChannels}</a>
</div>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>${TitleMediaBrowser}</title>
</head>
<body>
<div id="channelsLatestPage" data-role="page" class="page libraryPage channelsPage" data-theme="b" data-contextname="${HeaderChannels}">
<div class="libraryViewNav scopedLibraryViewNav">
<a href="#" class="ui-btn-active">${TabLatest}</a>
<a href="channels.html">${TabChannels}</a>
</div>
<div data-role="content">
<div class="viewSettings">
</div>
<div id="items" class="itemsContainer"></div>
</div>
</div>
</body>
</html>

View File

@ -46,10 +46,13 @@
}
.listHeader {
margin-top: .7em;
margin-top: .5em;
margin-bottom: 0;
padding-left: 4px;
}
.firstListHeader {
margin-top: 0;
}
.ehsContent {
padding: 0;
@ -69,7 +72,7 @@
}
.homePageSection + .homePageSection {
margin-top: 2em;
margin-top: 1em;
}
@media all and (min-width: 1000px) {

View File

@ -122,8 +122,7 @@
left: 0;
top: 51px;
z-index: 1000;
background-color: #181818;
background-color: rgba(24, 24, 24, 1);
background-color: #161616;
}
@media all and (max-width: 460px) {

View File

@ -27,6 +27,7 @@
<select id="selectHomeSection1" data-mini="true">
<option value="">${OptionAuto}</option>
<option value="latestmedia">${OptionLatestMedia}</option>
<option value="latestchannelmedia">${OptionLatestChannelMedia}</option>
<option value="librarytiles">${OptionMyLibrary}</option>
<option value="smalllibrarytiles">${OptionMyLibrarySmall}</option>
<option value="librarybuttons">${OptionMyLibraryButtons}</option>
@ -39,6 +40,7 @@
<select id="selectHomeSection2" data-mini="true">
<option value="">${OptionAuto}</option>
<option value="latestmedia">${OptionLatestMedia}</option>
<option value="latestchannelmedia">${OptionLatestChannelMedia}</option>
<option value="librarytiles">${OptionMyLibrary}</option>
<option value="smalllibrarytiles">${OptionMyLibrarySmall}</option>
<option value="librarybuttons">${OptionMyLibraryButtons}</option>
@ -52,6 +54,21 @@
<select id="selectHomeSection3" data-mini="true">
<option value="">${OptionAuto}</option>
<option value="latestmedia">${OptionLatestMedia}</option>
<option value="latestchannelmedia">${OptionLatestChannelMedia}</option>
<option value="librarytiles">${OptionMyLibrary}</option>
<option value="smalllibrarytiles">${OptionMyLibrarySmall}</option>
<option value="librarybuttons">${OptionMyLibraryButtons}</option>
<option value="folders">${OptionLibraryFolders}</option>
<option value="resume">${OptionResumablemedia}</option>
<option value="none">${OptionNone}</option>
</select>
</li>
<li>
<label for="selectHomeSection4">${LabelHomePageSection4}</label>
<select id="selectHomeSection4" data-mini="true">
<option value="">${OptionAuto}</option>
<option value="latestmedia">${OptionLatestMedia}</option>
<option value="latestchannelmedia">${OptionLatestChannelMedia}</option>
<option value="librarytiles">${OptionMyLibrary}</option>
<option value="smalllibrarytiles">${OptionMyLibrarySmall}</option>
<option value="librarybuttons">${OptionMyLibraryButtons}</option>

View File

@ -98,6 +98,11 @@
if ($.browser.msie) {
return false;
}
// For bandwidth
if ($.browser.mobile) {
return false;
}
var userId = Dashboard.getCurrentUserId();

View File

@ -38,7 +38,7 @@
}
var downloadableList = allChannelFeatures.filter(function (i) {
return i.CanDownloadAllMedia;
return i.SupportsContentDownloading;
});
populateDownloadList(page, config, downloadableList);

View File

@ -0,0 +1,40 @@
(function ($, document) {
function reloadItems(page) {
Dashboard.showLoadingMsg();
var options = {
Limit: 30,
Fields: "PrimaryImageAspectRatio",
Filters: "IsUnplayed",
UserId: Dashboard.getCurrentUserId()
};
$.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
var html = '';
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: 'auto',
showTitle: true,
centerText: true,
context: 'channels',
lazy: true
});
$("#items", page).html(html).trigger('create').createPosterItemMenus();
Dashboard.hideLoadingMsg();
});
}
$(document).on('pagebeforeshow', "#channelsLatestPage", function () {
reloadItems(this);
});
})(jQuery, document);

View File

@ -108,6 +108,8 @@
return 'resume';
case 2:
return 'latestmedia';
case 3:
return 'latestchannelmedia';
default:
return '';
}
@ -147,7 +149,7 @@
SortBy: "DateCreated",
SortOrder: "Descending",
Limit: screenWidth >= 2400 ? 30 : (screenWidth >= 1920 ? 20 : (screenWidth >= 1440 ? 12 : (screenWidth >= 800 ? 12 : 8))),
Limit: screenWidth >= 2400 ? 30 : (screenWidth >= 1920 ? 20 : (screenWidth >= 1440 ? 12 : (screenWidth >= 800 ? 9 : 8))),
Recursive: true,
Fields: "PrimaryImageAspectRatio",
Filters: "IsUnplayed,IsNotFolder",
@ -179,6 +181,41 @@
});
}
function loadLatestChannelMedia(elem, userId) {
var screenWidth = $(window).width();
var options = {
Limit: 6,
Fields: "PrimaryImageAspectRatio",
Filters: "IsUnplayed",
UserId: userId
};
$.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
var html = '';
if (result.Items.length) {
html += '<h1 class="listHeader">' + Globalize.translate('HeaderLatestChannelMedia') + '</h1>';
html += '<div>';
html += LibraryBrowser.getPosterViewHtml({
items: result.Items,
preferThumb: true,
shape: 'auto',
showTitle: true,
centerText: true,
context: 'home',
lazy: true
});
html += '</div>';
}
$(elem).html(html).trigger('create').createPosterItemMenus();
});
}
function loadLibraryTiles(elem, userId, shape, index) {
getUserViews(userId).done(function (items) {
@ -289,7 +326,7 @@
var section = displayPreferences.CustomPrefs['home' + index] || getDefaultSection(index);
var elem = $('.section' + index, page);
if (section == 'latestmedia') {
loadRecentlyAdded(elem, userId);
}
@ -308,6 +345,9 @@
} else if (section == 'folders') {
loadLibraryFolders(elem, userId, 'backdrop', index);
} else if (section == 'latestchannelmedia') {
loadLatestChannelMedia(elem, userId);
} else {
elem.empty();
@ -317,7 +357,7 @@
function loadSections(page, userId, displayPreferences) {
var i, length;
var sectionCount = 3;
var sectionCount = 4;
var elem = $('.sections', page);

View File

@ -370,7 +370,7 @@
}
if (item.CollectionType == 'channels') {
return 'channels.html';
return 'channelslatest.html';
}
if (item.CollectionType == 'movies') {

View File

@ -235,6 +235,10 @@
self.updateTextStreamUrls = function (startPositionTicks) {
if (!self.supportsTextTracks()) {
return;
}
$('track', video).each(function () {
var currentSrc = this.src;
@ -242,6 +246,7 @@
currentSrc = replaceQueryString(currentSrc, 'startPositionTicks', startPositionTicks);
this.src = currentSrc;
});
};

View File

@ -232,11 +232,12 @@
self.supportsTextTracks = function () {
// Does not support changing tracks via mode property
if ($.browser.mozilla) {
// When seeking with transcoding, there repointing the track element
// to a new url (via src) doesn't seem to work.
if ($.browser.chrome) {
return false;
}
if (supportsTextTracks == null) {
supportsTextTracks = document.createElement('video').textTracks != null;

View File

@ -8,6 +8,7 @@
$('#selectHomeSection1', page).val(displayPreferences.CustomPrefs.home0 || '').selectmenu("refresh");
$('#selectHomeSection2', page).val(displayPreferences.CustomPrefs.home1 || '').selectmenu("refresh");
$('#selectHomeSection3', page).val(displayPreferences.CustomPrefs.home2 || '').selectmenu("refresh");
$('#selectHomeSection4', page).val(displayPreferences.CustomPrefs.home3 || '').selectmenu("refresh");
Dashboard.hideLoadingMsg();
}
@ -20,6 +21,7 @@
displayPreferences.CustomPrefs.home0 = $('#selectHomeSection1', page).val();
displayPreferences.CustomPrefs.home1 = $('#selectHomeSection2', page).val();
displayPreferences.CustomPrefs.home2 = $('#selectHomeSection3', page).val();
displayPreferences.CustomPrefs.home3 = $('#selectHomeSection4', page).val();
ApiClient.updateDisplayPreferences('home', displayPreferences, userId, 'webclient').done(function () {

View File

@ -413,6 +413,7 @@
var playerInfo = MediaController.getPlayerInfo();
var supportedCommands = playerInfo.supportedCommands;
var playState = state.PlayState || {};
$('.btnToggleFullscreen', page).buttonEnabled(item && item.MediaType == 'Video' && supportedCommands.indexOf('ToggleFullscreen') != -1);
@ -437,8 +438,6 @@
var btnPause = $('.btnPause', page).buttonEnabled(item != null);
var btnPlay = $('.btnPlay', page).buttonEnabled(item != null);
var playState = state.PlayState || {};
if (playState.IsPaused) {
hideButton(btnPause);

View File

@ -1,8 +1,6 @@
(function ($, document) {
function loadNextUp(page) {
var screenWidth = $(window).width();
function reload(page) {
var query = {
@ -18,10 +16,47 @@
$('.scopedLibraryViewNav', page).show();
$('.globalNav', page).hide();
$('.homeEhsContent', page).css('text-align', 'left');
$('.scopedContent', page).show();
loadResume(page);
} else {
$('.scopedLibraryViewNav', page).hide();
$('.globalNav', page).show();
$('.homeEhsContent', page).css('text-align', 'center');
$('.scopedContent', page).hide();
}
loadNextUp(page);
}
function loadNextUp(page) {
var screenWidth = $(window).width();
var query = {
Limit: 24,
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated",
UserId: Dashboard.getCurrentUserId(),
ExcludeLocationTypes: "Virtual"
};
query.ParentId = LibraryMenu.getTopParentId();
if (query.ParentId) {
$('.scopedLibraryViewNav', page).show();
$('.globalNav', page).hide();
$('.ehsContent', page).css('text-align', 'left').removeClass('homeEhsContent');
$('.scopedContent', page).show();
} else {
$('.scopedLibraryViewNav', page).hide();
$('.globalNav', page).show();
$('.ehsContent', page).css('text-align', 'center').addClass('homeEhsContent');
$('.scopedContent', page).hide();
}
ApiClient.getNextUpEpisodes(query).done(function (result) {
@ -46,11 +81,50 @@
});
}
function loadResume(page) {
var screenWidth = $(window).width();
var parentId = LibraryMenu.getTopParentId();
var options = {
SortBy: "DatePlayed",
SortOrder: "Descending",
IncludeItemTypes: "Episode",
Filters: "IsResumable",
Limit: screenWidth >= 1920 ? 5 : 4,
Recursive: true,
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
ExcludeLocationTypes: "Virtual",
ParentId: parentId
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
if (result.Items.length) {
$('#resumableSection', page).show();
} else {
$('#resumableSection', page).hide();
}
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "backdrop",
showTitle: true,
showParentTitle: true,
overlayText: screenWidth >= 600
})).createPosterItemMenus();
});
}
$(document).on('pagebeforeshow', "#tvRecommendedPage", function () {
var page = this;
loadNextUp(page);
reload(page);
});

View File

@ -3419,6 +3419,8 @@ MediaBrowser.SHA1 = function (msg) {
} else if (browser.webkit) {
browser.safari = true;
}
browser.mobile = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
jQuery.browser = browser;

View File

@ -23,10 +23,21 @@
</div>
<br />
<div data-role="content">
<table class="ehsContent homeEhsContent" style="text-align: center;">
<table class="ehsContent">
<tr>
<td>
<div class="scopedContent">
<div id="resumableSection" style="display: none;">
<h1 class="listHeader firstListHeader">${HeaderResume}</h1>
<div id="resumableItems">
</div>
</div>
<h1 class="listHeader">${HeaderNextUp}</h1>
</div>
<div id="nextUpItems">
</div>
<p class="noNextUpItems" style="display: none;">${NoNextUpItemsMessage}</p>