From 5677ce101101c06c612767e569a68a1bed64fd4a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 23 May 2014 19:58:28 -0400 Subject: [PATCH] factor device pixel ratio into downloaded image size --- dashboard-ui/channelitems.html | 2 +- dashboard-ui/css/posteritem.css | 39 +++++--- dashboard-ui/livetvchannels.html | 28 ++++++ dashboard-ui/livetvguide.html | 5 ++ dashboard-ui/scripts/allusersettings.js | 8 +- dashboard-ui/scripts/backdrops.js | 9 +- dashboard-ui/scripts/dashboardpage.js | 17 ++-- dashboard-ui/scripts/editcollectionitems.js | 10 ++- dashboard-ui/scripts/edititemimages.js | 2 +- dashboard-ui/scripts/itemdetailpage.js | 10 +-- dashboard-ui/scripts/librarybrowser.js | 89 ++++++++++--------- dashboard-ui/scripts/librarylist.js | 10 ++- dashboard-ui/scripts/livetvchannels.js | 60 ++++++++++++- dashboard-ui/scripts/livetvguide.js | 20 +++-- dashboard-ui/scripts/livetvseriestimer.js | 4 +- dashboard-ui/scripts/livetvtimer.js | 8 +- dashboard-ui/scripts/livetvtimers.js | 4 +- dashboard-ui/scripts/loginpage.js | 2 +- dashboard-ui/scripts/mediaplayer-video.js | 4 +- dashboard-ui/scripts/mediaplayer.js | 12 +-- dashboard-ui/scripts/musicalbumartists.js | 9 ++ dashboard-ui/scripts/musicartists.js | 9 ++ dashboard-ui/scripts/nowplayingbar.js | 12 +-- dashboard-ui/scripts/nowplayingpage.js | 16 ++-- dashboard-ui/scripts/search.js | 8 +- dashboard-ui/scripts/site.js | 4 +- .../thirdparty/mediabrowser.apiclient.js | 89 ++++--------------- 27 files changed, 295 insertions(+), 195 deletions(-) diff --git a/dashboard-ui/channelitems.html b/dashboard-ui/channelitems.html index da19708df..cdea9f0fa 100644 --- a/dashboard-ui/channelitems.html +++ b/dashboard-ui/channelitems.html @@ -28,7 +28,7 @@
-

Loading channel content...

+

${MessageLoadingChannels}

diff --git a/dashboard-ui/css/posteritem.css b/dashboard-ui/css/posteritem.css index d861ceaa3..da3e649eb 100644 --- a/dashboard-ui/css/posteritem.css +++ b/dashboard-ui/css/posteritem.css @@ -128,14 +128,6 @@ } -.backdropPosterItem { - width: 148px; -} - - .backdropPosterItem .posterItemImage { - height: 83.25px; - } - .myLibraryPosterItem { width: 148px; } @@ -180,12 +172,20 @@ background-color: rgba(255, 233, 127, 0.5); } +.backdropPosterItem { + width: 128px; +} + + .backdropPosterItem .posterItemImage { + height: 72px; + } + .smallBackdropPosterItem { - width: 157px; + width: 120px; } .smallBackdropPosterItem .posterItemImage { - height: 88.3125px; + height: 67.5px; } .portraitPosterItem { @@ -254,6 +254,25 @@ } } +@media all and (min-width: 360px) { + + .backdropPosterItem { + width: 148px; + } + + .backdropPosterItem .posterItemImage { + height: 83.25px; + } + + .smallBackdropPosterItem { + width: 157px; + } + + .smallBackdropPosterItem .posterItemImage { + height: 88.3125px; + } +} + @media all and (min-width: 540px) { .backdropPosterItem { diff --git a/dashboard-ui/livetvchannels.html b/dashboard-ui/livetvchannels.html index f47d512d3..df4119d23 100644 --- a/dashboard-ui/livetvchannels.html +++ b/dashboard-ui/livetvchannels.html @@ -15,11 +15,39 @@
+
+ +
+ +
+
+

${MessageLoadingChannels}

+
+
+ +
+
+
+ + ${HeaderFilters} + + + + + + + + + +
+
+
+ diff --git a/dashboard-ui/livetvguide.html b/dashboard-ui/livetvguide.html index df49be043..65e17d335 100644 --- a/dashboard-ui/livetvguide.html +++ b/dashboard-ui/livetvguide.html @@ -41,6 +41,11 @@ +
+
+

${MessageLoadingChannels}

+
+
diff --git a/dashboard-ui/scripts/allusersettings.js b/dashboard-ui/scripts/allusersettings.js index 51b0514ea..234f2d9fe 100644 --- a/dashboard-ui/scripts/allusersettings.js +++ b/dashboard-ui/scripts/allusersettings.js @@ -2,8 +2,8 @@ function loadPage(page, config) { - $('#chkMobileClients', page).checked(config.RequireManualLoginForMobileApps).checkboxradio("refresh"); - $('#chkOtherApps', page).checked(config.RequireManualLoginForOtherApps).checkboxradio("refresh"); + $('#chkMobileClients', page).checked(config.RequireMobileManualLogin).checkboxradio("refresh"); + $('#chkOtherApps', page).checked(config.RequireNonMobileManualLogin).checkboxradio("refresh"); Dashboard.hideLoadingMsg(); } @@ -32,8 +32,8 @@ ApiClient.getServerConfiguration().done(function (config) { - config.RequireManualLoginForMobileApps = $('#chkMobileClients', form).checked(); - config.RequireManualLoginForOtherApps = $('#chkOtherApps', form).checked(); + config.RequireMobileManualLogin = $('#chkMobileClients', form).checked(); + config.RequireNonMobileManualLogin = $('#chkOtherApps', form).checked(); ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); }); diff --git a/dashboard-ui/scripts/backdrops.js b/dashboard-ui/scripts/backdrops.js index c5e0a61bb..496fee31e 100644 --- a/dashboard-ui/scripts/backdrops.js +++ b/dashboard-ui/scripts/backdrops.js @@ -68,9 +68,12 @@ var index = getRandom(0, images.length - 1); var item = images[index]; - var imgUrl = ApiClient.getImageUrl(item.id, { + var screenWidth = $(window).width(); + + var imgUrl = ApiClient.getScaledImageUrl(item.id, { type: "Backdrop", - tag: item.tag + tag: item.tag, + maxWidth: screenWidth }); getElement().css('backgroundImage', 'url(\'' + imgUrl + '\')'); @@ -99,7 +102,7 @@ var val = LocalSettings.val('enableBackdrops', userId); - return val != '0'; + return val == '1'; } $(document).on('pagebeforeshow', ".backdropPage", function () { diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 7377c0f18..87b8dff7a 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -389,10 +389,11 @@ if (nowPlayingItem.LogoItemId) { - imgUrl = ApiClient.getImageUrl(nowPlayingItem.LogoItemId, { + imgUrl = ApiClient.getScaledImageUrl(nowPlayingItem.LogoItemId, { tag: session.LogoImageTag, - height: 48, + maxHeight: 24, + maxWidth: 130, type: 'Logo' }); @@ -579,27 +580,27 @@ if (item && item.BackdropImageTag) { - return ApiClient.getImageUrl(item.BackdropItemId, { + return ApiClient.getScaledImageUrl(item.BackdropItemId, { type: "Backdrop", - width: 810, + width: 275, tag: item.BackdropImageTag }); } if (item && item.ThumbImageTag) { - return ApiClient.getImageUrl(item.ThumbItemId, { + return ApiClient.getScaledImageUrl(item.ThumbItemId, { type: "Thumb", - width: 810, + width: 275, tag: item.ThumbImageTag }); } if (item && item.PrimaryImageTag) { - return ApiClient.getImageUrl(item.PrimaryImageItemId, { + return ApiClient.getScaledImageUrl(item.PrimaryImageItemId, { type: "Primary", - width: 810, + width: 275, tag: item.PrimaryImageTag }); } diff --git a/dashboard-ui/scripts/editcollectionitems.js b/dashboard-ui/scripts/editcollectionitems.js index e04082456..40a212c7a 100644 --- a/dashboard-ui/scripts/editcollectionitems.js +++ b/dashboard-ui/scripts/editcollectionitems.js @@ -35,9 +35,10 @@ html += '
'; if (item.ImageTags.Primary) { - var imgUrl = ApiClient.getImageUrl(item.Id, { + var imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Primary", - width: 300, + maxWidth: 120, + maxHeight: 180, tag: item.ImageTags.Primary }); @@ -65,9 +66,10 @@ if (item.PrimaryImageTag) { - var imgUrl = ApiClient.getImageUrl(item.ItemId, { + var imgUrl = ApiClient.getScaledImageUrl(item.ItemId, { type: "Primary", - width: 200, + maxWidth: 100, + maxHeight: 150, tag: item.PrimaryImageTag }); diff --git a/dashboard-ui/scripts/edititemimages.js b/dashboard-ui/scripts/edititemimages.js index eba486b3e..14731db58 100644 --- a/dashboard-ui/scripts/edititemimages.js +++ b/dashboard-ui/scripts/edititemimages.js @@ -310,7 +310,7 @@ html += '
'; - html += '
'; + html += '
'; html += '
'; diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index ed907f91c..558009545 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -184,7 +184,7 @@ $('#movieTabs', page).show(); } - if (item.Type == "video.channelItem" || item.Type == "audio.channelItem" || item.Type == "folder.ChannelItem") { + if (item.Type == "ChannelVideoItem" || item.Type == "ChannelAudioItem" || item.Type == "ChannelFolderItem") { $('#channelTabs', page).show(); $('.channelHeader', page).show().html('' + item.ChannelName + '').trigger('create'); } else { @@ -1018,8 +1018,8 @@ if (chapter.ImageTag) { - imgUrl = ApiClient.getImageUrl(item.Id, { - maxwidth: 400, + imgUrl = ApiClient.getScaledImageUrl(item.Id, { + maxWidth: 210, tag: chapter.ImageTag, type: "Chapter", index: i @@ -1212,8 +1212,8 @@ if (imageTags.Primary) { - imgUrl = ApiClient.getImageUrl(item.Id, { - maxwidth: 500, + imgUrl = ApiClient.getScaledImageUrl(item.Id, { + maxWidth: 210, tag: imageTags.Primary, type: "primary" }); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 35b421996..ccc3ed6b5 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -457,7 +457,7 @@ } // For search hints - return ApiClient.getImageUrl(item.Id || item.ItemId, options); + return ApiClient.getScaledImageUrl(item.Id || item.ItemId, options); }, @@ -541,38 +541,40 @@ var forceName = false; + var downloadHeight = 576; + if (options.preferBackdrop && item.BackdropImageTags && item.BackdropImageTags.length) { - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Backdrop", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.BackdropImageTags[0] }); } else if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) { - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Thumb", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.ImageTags.Thumb }); } else if (options.preferBanner && item.ImageTags && item.ImageTags.Banner) { - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Banner", - maxwidth: 1200, + maxWidth: 500, tag: item.ImageTags.Banner }); } else if (options.preferThumb && item.SeriesThumbImageTag) { - imgUrl = ApiClient.getImageUrl(item.SeriesId, { + imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, { type: "Thumb", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.SeriesThumbImageTag }); @@ -581,15 +583,15 @@ imgUrl = ApiClient.getThumbImageUrl(item.ParentThumbItemId, { type: "Thumb", - maxwidth: 576 + maxWidth: downloadHeight }); } else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) { - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Backdrop", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.BackdropImageTags[0] }); @@ -610,10 +612,10 @@ } else if (item.AlbumId && item.AlbumPrimaryImageTag) { - height = 400; + height = 220; width = primaryImageAspectRatio ? Math.round(height * primaryImageAspectRatio) : null; - imgUrl = ApiClient.getImageUrl(item.AlbumId, { + imgUrl = ApiClient.getScaledImageUrl(item.AlbumId, { type: "Primary", height: height, width: width, @@ -623,27 +625,27 @@ } else if (item.BackdropImageTags && item.BackdropImageTags.length) { - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Backdrop", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.BackdropImageTags[0] }); } else if (item.ImageTags && item.ImageTags.Thumb) { - imgUrl = ApiClient.getImageUrl(item.Id, { + imgUrl = ApiClient.getScaledImageUrl(item.Id, { type: "Thumb", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.ImageTags.Thumb }); } else if (item.SeriesThumbImageTag) { - imgUrl = ApiClient.getImageUrl(item.SeriesId, { + imgUrl = ApiClient.getScaledImageUrl(item.SeriesId, { type: "Thumb", - maxwidth: 576, + maxWidth: downloadHeight, tag: item.SeriesThumbImageTag }); @@ -652,7 +654,7 @@ imgUrl = ApiClient.getThumbImageUrl(item, { type: "Thumb", - maxwidth: 576 + maxWidth: downloadHeight }); } @@ -958,7 +960,11 @@ var name = item.EpisodeTitle || item.Name; if (item.Type == "TvChannel") { - return item.Number + ' ' + name; + + if (item.Number) { + return item.Number + ' ' + name; + } + return name; } if (displayAsSpecial && item.Type == "Episode" && item.ParentIndexNumber == 0) { @@ -1474,45 +1480,45 @@ var url; - var imageHeight = 600; + var imageHeight = 280; if (imageTags.Primary) { - url = ApiClient.getImageUrl(item.Id, { + url = ApiClient.getScaledImageUrl(item.Id, { type: "Primary", - maxheight: imageHeight, + maxHeight: imageHeight, tag: item.ImageTags.Primary }); } else if (item.BackdropImageTags && item.BackdropImageTags.length) { - url = ApiClient.getImageUrl(item.Id, { + url = ApiClient.getScaledImageUrl(item.Id, { type: "Backdrop", - maxheight: imageHeight, + maxHeight: imageHeight, tag: item.BackdropImageTags[0] }); } else if (imageTags.Thumb) { - url = ApiClient.getImageUrl(item.Id, { + url = ApiClient.getScaledImageUrl(item.Id, { type: "Thumb", - maxheight: imageHeight, + maxHeight: imageHeight, tag: item.ImageTags.Thumb }); } else if (imageTags.Disc) { - url = ApiClient.getImageUrl(item.Id, { + url = ApiClient.getScaledImageUrl(item.Id, { type: "Disc", - maxheight: imageHeight, + maxHeight: imageHeight, tag: item.ImageTags.Disc }); } else if (item.AlbumId && item.AlbumPrimaryImageTag) { - url = ApiClient.getImageUrl(item.AlbumId, { + url = ApiClient.getScaledImageUrl(item.AlbumId, { type: "Primary", - maxheight: imageHeight, + maxHeight: imageHeight, tag: item.AlbumPrimaryImageTag }); @@ -1800,8 +1806,11 @@ if (item.BackdropImageTags && item.BackdropImageTags.length) { - imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, { - maxwidth: screenWidth + imgUrl = ApiClient.getScaledImageUrl(item.Id, { + type: "Backdrop", + index: 0, + maxWidth: screenWidth, + tag: item.BackdropImageTags[0] }); $('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")'); @@ -1809,11 +1818,11 @@ } else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) { - imgUrl = ApiClient.getImageUrl(item.ParentBackdropItemId, { + imgUrl = ApiClient.getScaledImageUrl(item.ParentBackdropItemId, { type: 'Backdrop', index: 0, tag: item.ParentBackdropImageTags[0], - maxwidth: screenWidth + maxWidth: screenWidth }); $('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")'); @@ -1951,7 +1960,6 @@ createGalleryImage: function (item, type, tag, index) { var screenWidth = Math.max(screen.height, screen.width); - screenWidth = Math.min(screenWidth, 1280); var html = ''; @@ -1959,8 +1967,9 @@ html += ''; @@ -1969,7 +1978,7 @@ html += 'Close'; html += ''; diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index a4a5d5dce..94f483c28 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -48,8 +48,8 @@ if (parentName && item.ParentLogoItemId) { - imgUrl = ApiClient.getImageUrl(item.ParentLogoItemId, { - height: logoHeight * 2, + imgUrl = ApiClient.getScaledImageUrl(item.ParentLogoItemId, { + height: logoHeight, type: 'logo', tag: item.ParentLogoImageTag }); @@ -59,8 +59,10 @@ } else if (item.ImageTags.Logo) { - imgUrl = LibraryBrowser.getImageUrl(item, 'Logo', 0, { - height: logoHeight * 2, + imgUrl = ApiClient.getScaledImageUrl(item.Id, { + height: logoHeight, + type: 'logo', + tag: item.ImageTags.Logo }); html += ''; diff --git a/dashboard-ui/scripts/livetvchannels.js b/dashboard-ui/scripts/livetvchannels.js index 7df76fde5..19c50a4aa 100644 --- a/dashboard-ui/scripts/livetvchannels.js +++ b/dashboard-ui/scripts/livetvchannels.js @@ -14,15 +14,26 @@ }); } + function showLoadingMessage(page) { + + $('.popupLoading', page).popup('open'); + } + + function hideLoadingMessage(page) { + $('.popupLoading', page).popup('close'); + } + function renderChannels(page, result) { $('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create'); + updateFilterControls(this); + var html = getChannelsHtml(result.Items); html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount); - $('#items', page).html(html).trigger('create'); + $('#items', page).html(html).trigger('create').createPosterItemMenus(); $('.btnNextPage', page).on('click', function () { query.StartIndex += query.Limit; @@ -44,13 +55,54 @@ } function reloadItems(page) { + + showLoadingMessage(page); + apiClient.getLiveTvChannels(query).done(function (result) { renderChannels(page, result); + + hideLoadingMessage(page); }); } - $(document).on('pagebeforeshow', "#liveTvChannelsPage", function () { + function updateFilterControls(page) { + + $('#chkFavorite', page).checked(query.IsFavorite == true).checkboxradio('refresh'); + $('#chkLikes', page).checked(query.IsLiked == true).checkboxradio('refresh'); + $('#chkDislikes', page).checked(query.IsDisliked == true).checkboxradio('refresh'); + } + + $(document).on('pageinit', "#liveTvChannelsPage", function () { + + var page = this; + + $('#chkFavorite', this).on('change', function () { + + query.StartIndex = 0; + query.IsFavorite = this.checked ? true : null; + + reloadItems(page); + }); + + + $('#chkLikes', this).on('change', function () { + + query.StartIndex = 0; + query.IsLiked = this.checked ? true : null; + + reloadItems(page); + }); + + $('#chkDislikes', this).on('change', function () { + + query.StartIndex = 0; + query.IsDisliked = this.checked ? true : null; + + reloadItems(page); + }); + + }).on('pagebeforeshow', "#liveTvChannelsPage", function () { var page = this; @@ -67,6 +119,10 @@ LibraryBrowser.loadSavedQueryValues('movies', query); reloadItems(page); + + }).on('pageshow', "#liveTvChannelsPage", function () { + + updateFilterControls(this); }); })(jQuery, document, ApiClient); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvguide.js b/dashboard-ui/scripts/livetvguide.js index 23016d769..40b06d37d 100644 --- a/dashboard-ui/scripts/livetvguide.js +++ b/dashboard-ui/scripts/livetvguide.js @@ -16,6 +16,15 @@ }; var channelsPromise; + function showLoadingMessage(page) { + + $('.popupLoading', page).popup('open'); + } + + function hideLoadingMessage(page) { + $('.popupLoading', page).popup('close'); + } + function normalizeDateToTimeslot(date) { var minutesOffset = date.getMinutes() - cellCurationMinutes; @@ -39,7 +48,7 @@ function reloadGuide(page) { - Dashboard.showLoadingMsg(); + showLoadingMessage(page); channelQuery.userId = Dashboard.getCurrentUserId(); @@ -64,7 +73,8 @@ }).done(function (programsResult) { renderGuide(page, date, channelsResult.Items, programsResult.Items); - Dashboard.hideLoadingMsg(); + hideLoadingMessage(page); + }); var channelPagingHtml = LibraryBrowser.getPagingHtml(channelQuery, channelsResult.TotalRecordCount, false, [10, 20, 30, 50, 100]); @@ -327,9 +337,9 @@ if (channel.ImageTags.Primary) { - var url = ApiClient.getImageUrl(channel.Id, { - maxheight: 200, - maxwidth: 200, + var url = ApiClient.getScaledImageUrl(channel.Id, { + maxHeight: 35, + maxWidth: 60, tag: channel.ImageTags.Primary, type: "Primary" }); diff --git a/dashboard-ui/scripts/livetvseriestimer.js b/dashboard-ui/scripts/livetvseriestimer.js index 39f573439..8260ef027 100644 --- a/dashboard-ui/scripts/livetvseriestimer.js +++ b/dashboard-ui/scripts/livetvseriestimer.js @@ -161,8 +161,8 @@ var programImages = program.ImageTags || {}; if (programImages.Primary) { - imgUrl = ApiClient.getImageUrl(program.Id, { - height: 160, + imgUrl = ApiClient.getScaledImageUrl(program.Id, { + height: 80, tag: programImages.Primary, type: "Primary" }); diff --git a/dashboard-ui/scripts/livetvtimer.js b/dashboard-ui/scripts/livetvtimer.js index fffd749b7..49b885a57 100644 --- a/dashboard-ui/scripts/livetvtimer.js +++ b/dashboard-ui/scripts/livetvtimer.js @@ -39,15 +39,15 @@ if (programInfo.ImageTags && programInfo.ImageTags.Primary) { - var imgUrl = ApiClient.getImageUrl(programInfo.Id, { - maxwidth: 200, - maxheight: 200, + var imgUrl = ApiClient.getScaledImageUrl(programInfo.Id, { + maxWidth: 200, + maxHeight: 200, tag: programInfo.ImageTags.Primary, type: "Primary" }); $('.timerPageImageContainer', page).css("display", "inline-block") - .html(''); + .html(''); } else { $('.timerPageImageContainer', page).hide(); diff --git a/dashboard-ui/scripts/livetvtimers.js b/dashboard-ui/scripts/livetvtimers.js index 682abdf4b..79ac2fa56 100644 --- a/dashboard-ui/scripts/livetvtimers.js +++ b/dashboard-ui/scripts/livetvtimers.js @@ -45,8 +45,8 @@ if (program.ImageTags && program.ImageTags.Primary) { - imgUrl = ApiClient.getImageUrl(program.Id, { - height: 160, + imgUrl = ApiClient.getScaledImageUrl(program.Id, { + height: 80, tag: program.ImageTags.Primary, type: "Primary" }); diff --git a/dashboard-ui/scripts/loginpage.js b/dashboard-ui/scripts/loginpage.js index 0a6e7bb43..d6ca6a358 100644 --- a/dashboard-ui/scripts/loginpage.js +++ b/dashboard-ui/scripts/loginpage.js @@ -34,7 +34,7 @@ var users = response1[0]; var config = response2[0]; - var showManualForm = config.RequireManualLoginForMobileApps || !users.length; + var showManualForm = config.RequireMobileManualLogin || !users.length; if (showManualForm) { diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 3aeef74bc..0f0d11178 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -430,8 +430,8 @@ if (chapter.ImageTag) { - imgUrl = ApiClient.getImageUrl(currentItem.Id, { - maxwidth: 200, + imgUrl = ApiClient.getScaledImageUrl(currentItem.Id, { + maxWidth: 100, tag: chapter.ImageTag, type: "Chapter", index: i diff --git a/dashboard-ui/scripts/mediaplayer.js b/dashboard-ui/scripts/mediaplayer.js index 3bd5507b6..32cf50d75 100644 --- a/dashboard-ui/scripts/mediaplayer.js +++ b/dashboard-ui/scripts/mediaplayer.js @@ -486,26 +486,26 @@ if (state.NowPlayingItem.PrimaryImageTag) { - url = ApiClient.getImageUrl(state.NowPlayingItem.PrimaryImageItemId, { + url = ApiClient.getScaledImageUrl(state.NowPlayingItem.PrimaryImageItemId, { type: "Primary", - height: 80, + height: 40, tag: state.NowPlayingItem.PrimaryImageTag }); } else if (state.NowPlayingItem.BackdropImageTag) { - url = ApiClient.getImageUrl(state.NowPlayingItem.BackdropItemId, { + url = ApiClient.getScaledImageUrl(state.NowPlayingItem.BackdropItemId, { type: "Backdrop", - height: 80, + height: 40, tag: state.NowPlayingItem.BackdropImageTag, index: 0 }); } else if (state.NowPlayingItem.ThumbImageTag) { - url = ApiClient.getImageUrl(state.NowPlayingItem.ThumbImageItemId, { + url = ApiClient.getScaledImageUrl(state.NowPlayingItem.ThumbImageItemId, { type: "Thumb", - height: 80, + height: 40, tag: state.NowPlayingItem.ThumbImageTag }); } diff --git a/dashboard-ui/scripts/musicalbumartists.js b/dashboard-ui/scripts/musicalbumartists.js index 9a8d5662e..9c4a68ab5 100644 --- a/dashboard-ui/scripts/musicalbumartists.js +++ b/dashboard-ui/scripts/musicalbumartists.js @@ -69,6 +69,15 @@ function updateFilterControls(page) { + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); } diff --git a/dashboard-ui/scripts/musicartists.js b/dashboard-ui/scripts/musicartists.js index 84c562a76..6bcc59a1f 100644 --- a/dashboard-ui/scripts/musicartists.js +++ b/dashboard-ui/scripts/musicartists.js @@ -68,6 +68,15 @@ function updateFilterControls(page) { + $('.chkStandardFilter', page).each(function () { + + var filters = "," + (query.Filters || ""); + var filterName = this.getAttribute('data-filter'); + + this.checked = filters.indexOf(',' + filterName) != -1; + + }).checkboxradio('refresh'); + $('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater); } diff --git a/dashboard-ui/scripts/nowplayingbar.js b/dashboard-ui/scripts/nowplayingbar.js index ede46f751..42fd13b4e 100644 --- a/dashboard-ui/scripts/nowplayingbar.js +++ b/dashboard-ui/scripts/nowplayingbar.js @@ -284,26 +284,26 @@ if (nowPlayingItem.PrimaryImageTag) { - url = ApiClient.getImageUrl(nowPlayingItem.PrimaryImageItemId, { + url = ApiClient.getScaledImageUrl(nowPlayingItem.PrimaryImageItemId, { type: "Primary", - height: 80, + height: 40, tag: nowPlayingItem.PrimaryImageTag }); } else if (nowPlayingItem.BackdropImageTag) { - url = ApiClient.getImageUrl(nowPlayingItem.BackdropItemId, { + url = ApiClient.getScaledImageUrl(nowPlayingItem.BackdropItemId, { type: "Backdrop", - height: 80, + height: 40, tag: nowPlayingItem.BackdropImageTag, index: 0 }); } else if (nowPlayingItem.ThumbImageTag) { - url = ApiClient.getImageUrl(nowPlayingItem.ThumbImageItemId, { + url = ApiClient.getScaledImageUrl(nowPlayingItem.ThumbImageItemId, { type: "Thumb", - height: 80, + height: 40, tag: nowPlayingItem.ThumbImageTag }); } diff --git a/dashboard-ui/scripts/nowplayingpage.js b/dashboard-ui/scripts/nowplayingpage.js index 14de3e3a5..fcd000bce 100644 --- a/dashboard-ui/scripts/nowplayingpage.js +++ b/dashboard-ui/scripts/nowplayingpage.js @@ -18,8 +18,8 @@ if (chapter.ImageTag) { - imgUrl = ApiClient.getImageUrl(itemId, { - width: 800, + imgUrl = ApiClient.getScaledImageUrl(itemId, { + width: 240, tag: chapter.ImageTag, type: "Chapter", index: i @@ -509,26 +509,26 @@ } else if (item.PrimaryImageTag) { - url = ApiClient.getImageUrl(item.PrimaryImageItemId, { + url = ApiClient.getScaledImageUrl(item.PrimaryImageItemId, { type: "Primary", - height: 600, + height: 300, tag: item.PrimaryImageTag }); } else if (item.BackdropImageTag) { - url = ApiClient.getImageUrl(item.BackdropItemId, { + url = ApiClient.getScaledImageUrl(item.BackdropItemId, { type: "Backdrop", - height: 600, + height: 300, tag: item.BackdropImageTag, index: 0 }); } else if (item.ThumbImageTag) { - url = ApiClient.getImageUrl(item.ThumbImageItemId, { + url = ApiClient.getScaledImageUrl(item.ThumbImageItemId, { type: "Thumb", - height: 600, + height: 300, tag: item.ThumbImageTag }); } diff --git a/dashboard-ui/scripts/search.js b/dashboard-ui/scripts/search.js index b31ac3944..88ae5d44e 100644 --- a/dashboard-ui/scripts/search.js +++ b/dashboard-ui/scripts/search.js @@ -77,7 +77,13 @@ if (hint.PrimaryImageTag) { hint.ImageTags = { Primary: hint.PrimaryImageTag }; - imgUrl = LibraryBrowser.getImageUrl(hint, "Primary", 0, { maxwidth: 150, maxheight: 150 }); + + imgUrl = ApiClient.getImageUrl(hint.ItemId, { + type: "Primary", + maxWidth: 150, + maxHeight: 150, + tag: hint.PrimaryImageTag + }); } else if (hint.MediaType == "Game") { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index c794747a0..fe5a4871d 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1129,8 +1129,8 @@ var Dashboard = { if (imageTags.Primary) { - notification.icon = ApiClient.getImageUrl(item.Id, { - width: 100, + notification.icon = ApiClient.getScaledImageUrl(item.Id, { + width: 60, tag: imageTags.Primary, type: "Primary" }); diff --git a/dashboard-ui/thirdparty/mediabrowser.apiclient.js b/dashboard-ui/thirdparty/mediabrowser.apiclient.js index 7953f680f..79c8e5c5e 100644 --- a/dashboard-ui/thirdparty/mediabrowser.apiclient.js +++ b/dashboard-ui/thirdparty/mediabrowser.apiclient.js @@ -2197,35 +2197,28 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi return self.getUrl(url, options); }; + + self.getScaledImageUrl = function (itemId, options) { - /** - * Constructs a url for an item logo image - * If the item doesn't have a logo, it will inherit a logo from a parent - * @param {Object} item A BaseItem - * @param {Object} options - * Options supports the following properties: - * width - download the image at a fixed width - * height - download the image at a fixed height - * maxWidth - download the image at a maxWidth - * maxHeight - download the image at a maxHeight - * quality - A scale of 0-100. This should almost always be omitted as the default will suffice. - * For best results do not specify both width and height together, as aspect ratio might be altered. - */ - self.getLogoImageUrl = function (item, options) { - - if (!item) { - throw new Error("null item"); + if (!itemId) { + throw new Error("itemId cannot be empty"); } - options = options || { + options = options || {}; - }; + var url = "Items/" + itemId + "/Images/" + options.type; - options.imageType = "logo"; + if (options.index != null) { + url += "/" + options.index; + } - var logoItemId = item.ImageTags && item.ImageTags.Logo ? item.Id : item.ParentLogoItemId; + // Don't put these on the query string + delete options.type; + delete options.index; - return logoItemId ? self.getImageUrl(logoItemId, options) : null; + normalizeImageOptions(options); + + return self.getUrl(url, options); }; self.getThumbImageUrl = function (item, options) { @@ -2245,58 +2238,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi return itemId ? self.getImageUrl(itemId, options) : null; }; - /** - * Constructs an array of backdrop image url's for an item - * If the item doesn't have any backdrops, it will inherit them from a parent - * @param {Object} item A BaseItem - * @param {Object} options - * Options supports the following properties: - * width - download the image at a fixed width - * height - download the image at a fixed height - * maxWidth - download the image at a maxWidth - * maxHeight - download the image at a maxHeight - * quality - A scale of 0-100. This should almost always be omitted as the default will suffice. - * For best results do not specify both width and height together, as aspect ratio might be altered. - */ - self.getBackdropImageUrl = function (item, options) { - - if (!item) { - throw new Error("null item"); - } - - options = options || { - - }; - - options.imageType = "backdrop"; - - var backdropItemId; - var backdropCount; - - if (!item.BackdropCount) { - backdropItemId = item.ParentBackdropItemId; - backdropCount = item.ParentBackdropCount || 0; - } else { - backdropItemId = item.Id; - backdropCount = item.BackdropCount; - } - - if (!backdropItemId) { - return []; - } - - var files = []; - - for (var i = 0; i < backdropCount; i++) { - - options.imageIndex = i; - - files[i] = self.getImageUrl(backdropItemId, options); - } - - return files; - }; - /** * Authenticates a user * @param {String} name