From fab42af1a5265555f5f63a8cce979d6338213a83 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 4 Nov 2016 19:57:21 -0400 Subject: [PATCH] add udp error handling --- .../playlisteditor/playlisteditor.js | 6 ++++++ dashboard-ui/scripts/itemdetailpage.js | 10 +++++----- dashboard-ui/scripts/sections.js | 8 +++++++- dashboard-ui/scripts/shared.js | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js b/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js index c104523b19..5ce0e60383 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js +++ b/dashboard-ui/bower_components/emby-webcomponents/playlisteditor/playlisteditor.js @@ -127,6 +127,12 @@ select.innerHTML = html; select.value = userSettings.get('playlisteditor-lastplaylistid') || ''; + + // If the value is empty set it again, in case we tried to set a lastplaylistid that is no longer valid + if (!select.value) { + select.value = ''; + } + triggerChange(select); loading.hide(); diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 375dcc4931..90c0b25add 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -460,7 +460,7 @@ } if (item.MediaSources && item.MediaSources.length) { - renderMediaSources(page, item); + renderMediaSources(page, user, item); } var chapters = item.Chapters || []; @@ -1704,11 +1704,11 @@ } } - function renderMediaSources(page, item) { + function renderMediaSources(page, user, item) { var html = item.MediaSources.map(function (v) { - return getMediaSourceHtml(item, v); + return getMediaSourceHtml(user, item, v); }).join('
'); @@ -1720,7 +1720,7 @@ mediaInfoContent.innerHTML = html; } - function getMediaSourceHtml(item, version) { + function getMediaSourceHtml(user, item, version) { var html = ''; @@ -1848,7 +1848,7 @@ //html += '
'+Globalize.translate('MediaInfoFormat')+'' + version.Formats.join(',') + '
'; } - if (version.Path && version.Protocol != 'Http') { + if (version.Path && version.Protocol != 'Http' && user && user.Policy.IsAdministrator) { html += '
' + Globalize.translate('MediaInfoPath') + '' + version.Path + '
'; } diff --git a/dashboard-ui/scripts/sections.js b/dashboard-ui/scripts/sections.js index 935cc1a05d..afa7ce4be9 100644 --- a/dashboard-ui/scripts/sections.js +++ b/dashboard-ui/scripts/sections.js @@ -434,13 +434,19 @@ var screenWidth = dom.getWindowSize().innerWidth; + var limit = screenWidth >= 1920 ? 8 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6)); + + if (!enableScrollX()) { + limit = Math.min(limit, 5); + } + var options = { SortBy: "DatePlayed", SortOrder: "Descending", MediaTypes: "Video", Filters: "IsResumable", - Limit: screenWidth >= 1920 ? 8 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6)), + Limit: limit, Recursive: true, Fields: "PrimaryImageAspectRatio,BasicSyncInfo", CollapseBoxSetItems: false, diff --git a/dashboard-ui/scripts/shared.js b/dashboard-ui/scripts/shared.js index b887203b5e..7518fb6803 100644 --- a/dashboard-ui/scripts/shared.js +++ b/dashboard-ui/scripts/shared.js @@ -36,7 +36,7 @@ $('.collectionItems', page).empty(); if (item.MediaSources && item.MediaSources.length) { - ItemDetailPage.renderMediaSources(page, item); + ItemDetailPage.renderMediaSources(page, null, item); } var chapters = item.Chapters || [];