diff --git a/ApiClient.js b/ApiClient.js index 7db97e6603..d139adfc3e 100644 --- a/ApiClient.js +++ b/ApiClient.js @@ -3171,144 +3171,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; - /** - Gets a variety of item counts that a person appears in - */ - self.getPersonItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Persons/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - /** - Gets a variety of item counts that a genre appears in - */ - self.getGenreItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Genres/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - self.getMusicGenreItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("MusicGenres/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - self.getGameGenreItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("GameGenres/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - /** - Gets a variety of item counts that an artist appears in - */ - self.getArtistItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Artists/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - - /** - Gets a variety of item counts that a studio appears in - */ - self.getStudioItemCounts = function (userId, name) { - - if (!userId) { - throw new Error("null userId"); - } - - if (!name) { - throw new Error("null name"); - } - - var url = self.getUrl("Studios/" + self.encodeName(name) + "/Counts", { - userId: userId - }); - - return self.ajax({ - type: "GET", - url: url, - dataType: "json" - }); - }; - /** * Clears a user's personal rating for an item * @param {String} userId diff --git a/dashboard-ui/scripts/gamegenrepage.js b/dashboard-ui/scripts/gamegenrepage.js index 16471c9cb2..4fac33383b 100644 --- a/dashboard-ui/scripts/gamegenrepage.js +++ b/dashboard-ui/scripts/gamegenrepage.js @@ -25,8 +25,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Game", - countNamePlural: "Games", context: "games" }); diff --git a/dashboard-ui/scripts/gamestudiospage.js b/dashboard-ui/scripts/gamestudiospage.js index 076b62ccd7..9987d00ff9 100644 --- a/dashboard-ui/scripts/gamestudiospage.js +++ b/dashboard-ui/scripts/gamestudiospage.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Game", - countNamePlural: "Games", context: "games" }); diff --git a/dashboard-ui/scripts/itembynamedetailpage.js b/dashboard-ui/scripts/itembynamedetailpage.js index fabd83b9e8..b05a5ab7a5 100644 --- a/dashboard-ui/scripts/itembynamedetailpage.js +++ b/dashboard-ui/scripts/itembynamedetailpage.js @@ -147,104 +147,77 @@ function renderTabs(page, item) { - var promise; + var html = '
'; - if (item.Type == "Person") { - promise = ApiClient.getPersonItemCounts(Dashboard.getCurrentUserId(), item.Name); - } - else if (item.Type == "Genre") { - promise = ApiClient.getGenreItemCounts(Dashboard.getCurrentUserId(), item.Name); - } - else if (item.Type == "MusicGenre") { - promise = ApiClient.getMusicGenreItemCounts(Dashboard.getCurrentUserId(), item.Name); - } - else if (item.Type == "GameGenre") { - promise = ApiClient.getGameGenreItemCounts(Dashboard.getCurrentUserId(), item.Name); - } - else if (item.Type == "Studio") { - promise = ApiClient.getStudioItemCounts(Dashboard.getCurrentUserId(), item.Name); - } - else if (item.Type == "Artist") { - promise = ApiClient.getArtistItemCounts(Dashboard.getCurrentUserId(), item.Name); - } - else { - throw new Error("Unknown item type: " + item.Type); + html += ''; + + if (item.MovieCount) { + + html += ''; + html += ''; } - promise.done(function (result) { + if (item.SeriesCount) { - var html = '
'; + html += ''; + html += ''; + } - html += ''; + if (item.EpisodeCount) { - if (result.MovieCount) { + html += ''; + html += ''; + } - html += ''; - html += ''; - } + if (item.TrailerCount) { - if (result.SeriesCount) { + html += ''; + html += ''; + } - html += ''; - html += ''; - } + if (item.GameCount) { - if (result.EpisodeCount) { + html += ''; + html += ''; + } - html += ''; - html += ''; - } + if (item.AlbumCount) { - if (result.TrailerCount) { + html += ''; + html += ''; + } - html += ''; - html += ''; - } + if (item.SongCount) { - if (result.GameCount) { + html += ''; + html += ''; + } - html += ''; - html += ''; - } + if (item.MusicVideoCount) { - if (result.AlbumCount) { + html += ''; + html += ''; + } - html += ''; - html += ''; - } + html += '
'; - if (result.SongCount) { + var elem = $('#itemTabs', page).html(html).trigger('create'); - html += ''; - html += ''; - } + bindRadioEvents(page); - if (result.MusicVideoCount) { + var context = getParameterByName('context'); + var selectedRadio = null; - html += ''; - html += ''; - } + if (context) { + selectedRadio = $('.context-' + context + ':first', elem); + } - html += '
'; + if (selectedRadio && selectedRadio.length) { + selectedRadio.attr("checked", "checked").checkboxradio("refresh").trigger('click'); + } else { + $('input:first', elem).attr("checked", "checked").checkboxradio("refresh").trigger('click'); + } - var elem = $('#itemTabs', page).html(html).trigger('create'); - - bindRadioEvents(page); - - var context = getParameterByName('context'); - var selectedRadio = null; - - if (context) { - selectedRadio = $('.context-' + context + ':first', elem); - } - - if (selectedRadio && selectedRadio.length) { - selectedRadio.attr("checked", "checked").checkboxradio("refresh").trigger('click'); - } else { - $('input:first', elem).attr("checked", "checked").checkboxradio("refresh").trigger('click'); - } - - }); } function bindRadioEvents(page) { diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 47cd2ba5f1..f9d3778e0e 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -199,9 +199,7 @@ } else if (item.Type == "Genre" || item.Type == "Studio" || item.Type == "Person" || item.Type == "Artist" || item.Type == "MusicGenre" || item.Type == "GameGenre") { - childText = item.ChildCount == 1 ? "1 " + options.countNameSingular : item.ChildCount + " " + options.countNamePlural; - - html += '

' + childText + '

'; + html += LibraryBrowser.getItemCountsHtml(options, item); } else if (item.Type == "Game") { @@ -236,6 +234,56 @@ return html; }, + getItemCountsHtml: function (options, item) { + + var childText; + + if (options.context == "movies") { + + if (item.MovieCount) { + + childText = item.MovieCount == 1 ? "1 Movie" : item.MovieCount + " Movies"; + } + else if (item.TrailerCount) { + + childText = item.TrailerCount == 1 ? "1 Trailer" : item.TrailerCount + " Trailers"; + } + + } + else if (options.context == "tv") { + + if (item.SeriesCount) { + + childText = item.SeriesCount == 1 ? "1 Show" : item.SeriesCount + " Shows"; + } + else if (item.EpisodeCount) { + + childText = item.EpisodeCount == 1 ? "1 Episode" : item.EpisodeCount + " Episodes"; + } + + } + else if (options.context == "games") { + + if (item.GameCount) { + + childText = item.GameCount == 1 ? "1 Game" : item.GameCount + " Games"; + } + } + else if (options.context == "music") { + + if (item.SongCount) { + + childText = item.SongCount == 1 ? "1 Song" : item.SongCount + " Songs"; + } + else if (item.MusicVideoCount) { + + childText = item.MusicVideoCount == 1 ? "1 Music Video" : item.MusicVideoCount + " Music Videos"; + } + } + + return childText ? '

' + childText + '

' : ''; + }, + getSongHeaderCellHtml: function (text, cssClass, enableSorting, sortField, selectedSortField, sortDirection) { var html = cssClass ? '' : ''; @@ -1008,6 +1056,8 @@ options += getOption(100); options += getOption(200); options += getOption(300); + options += getOption(400); + options += getOption(500); html += ''; } diff --git a/dashboard-ui/scripts/moviegenres.js b/dashboard-ui/scripts/moviegenres.js index 46c50739c8..b99df9ad1b 100644 --- a/dashboard-ui/scripts/moviegenres.js +++ b/dashboard-ui/scripts/moviegenres.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Movie", - countNamePlural: "Movies", context: "movies" }); diff --git a/dashboard-ui/scripts/moviepeople.js b/dashboard-ui/scripts/moviepeople.js index dc54635fb6..55bc2c0541 100644 --- a/dashboard-ui/scripts/moviepeople.js +++ b/dashboard-ui/scripts/moviepeople.js @@ -27,8 +27,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Movie", - countNamePlural: "Movies", context: "movies" }); diff --git a/dashboard-ui/scripts/moviestudios.js b/dashboard-ui/scripts/moviestudios.js index 7336b4bd3f..cc391e2889 100644 --- a/dashboard-ui/scripts/moviestudios.js +++ b/dashboard-ui/scripts/moviestudios.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Movie", - countNamePlural: "Movies", context: "movies" }); diff --git a/dashboard-ui/scripts/musicartists.js b/dashboard-ui/scripts/musicartists.js index 9a065bd629..22ceddb0ef 100644 --- a/dashboard-ui/scripts/musicartists.js +++ b/dashboard-ui/scripts/musicartists.js @@ -25,8 +25,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Song", - countNamePlural: "Songs", preferBackdrop: false, context: "music", shape: "square" diff --git a/dashboard-ui/scripts/musicgenres.js b/dashboard-ui/scripts/musicgenres.js index b63545aec2..b7c880ed49 100644 --- a/dashboard-ui/scripts/musicgenres.js +++ b/dashboard-ui/scripts/musicgenres.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Song", - countNamePlural: "Songs", context: "music" }); diff --git a/dashboard-ui/scripts/tvgenres.js b/dashboard-ui/scripts/tvgenres.js index c3f8e08a23..5a2df21a2d 100644 --- a/dashboard-ui/scripts/tvgenres.js +++ b/dashboard-ui/scripts/tvgenres.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Show", - countNamePlural: "Shows", context: "tv" }); diff --git a/dashboard-ui/scripts/tvpeople.js b/dashboard-ui/scripts/tvpeople.js index 4e86fb0a5b..77e6b4278d 100644 --- a/dashboard-ui/scripts/tvpeople.js +++ b/dashboard-ui/scripts/tvpeople.js @@ -27,8 +27,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Show", - countNamePlural: "Shows", context: "tv" }); diff --git a/dashboard-ui/scripts/tvstudios.js b/dashboard-ui/scripts/tvstudios.js index ad2339d99b..35f27109dc 100644 --- a/dashboard-ui/scripts/tvstudios.js +++ b/dashboard-ui/scripts/tvstudios.js @@ -26,8 +26,6 @@ html += LibraryBrowser.getPosterDetailViewHtml({ items: result.Items, - countNameSingular: "Show", - countNamePlural: "Shows", context: "tv" }); diff --git a/packages.config b/packages.config index b3add5674e..0963ca767d 100644 --- a/packages.config +++ b/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file