add tv suggestions

This commit is contained in:
Luke Pulverenti 2015-08-20 22:36:30 -04:00
parent 7e0be1ddca
commit 06d5ac40fa
5 changed files with 20 additions and 79 deletions

View file

@ -1303,53 +1303,9 @@
}); });
}; };
self.getSimilarMovies = function (itemId, options) { self.getSimilarItems = function (itemId, options) {
var url = self.getUrl("Movies/" + itemId + "/Similar", options); var url = self.getUrl("Items/" + itemId + "/Similar", options);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getSimilarTrailers = function (itemId, options) {
var url = self.getUrl("Trailers/" + itemId + "/Similar", options);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getSimilarShows = function (itemId, options) {
var url = self.getUrl("Shows/" + itemId + "/Similar", options);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getSimilarAlbums = function (itemId, options) {
var url = self.getUrl("Albums/" + itemId + "/Similar", options);
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
self.getSimilarGames = function (itemId, options) {
var url = self.getUrl("Games/" + itemId + "/Similar", options);
return self.ajax({ return self.ajax({
type: "GET", type: "GET",

View file

@ -43,7 +43,7 @@
<div id="upcomingTvMovies" class="homePageSection"> <div id="upcomingTvMovies" class="homePageSection">
<div> <div>
<h1 class="listHeader" style="display:inline-block;vertical-align:middle;">${HeaderUpcomingMovies}</h1> <h1 class="listHeader" style="display:inline-block;vertical-align:middle;">${HeaderUpcomingMovies}</h1>
<a href="livetvitems.html?type=movies" class="clearLink" style="margin-left:1em;vertical-align:middle;"><paper-button raised class="more noIcon">${ButtonMoreItems}</paper-button></a> <a href="livetvitems.html?type=movies" class="clearLink" style="margin-left:1em;vertical-align:middle;"><paper-button raised class="more mini noIcon">${ButtonMoreItems}</paper-button></a>
</div> </div>
<div class="upcomingTvMovieItems itemsContainer"></div> <div class="upcomingTvMovieItems itemsContainer"></div>
<br /> <br />
@ -51,7 +51,7 @@
<div id="upcomingSports" class="homePageSection"> <div id="upcomingSports" class="homePageSection">
<div> <div>
<h1 class="listHeader" style="display:inline-block;vertical-align:middle;">${HeaderUpcomingSports}</h1> <h1 class="listHeader" style="display:inline-block;vertical-align:middle;">${HeaderUpcomingSports}</h1>
<a href="livetvitems.html?type=sports" class="clearLink" style="margin-left:1em;vertical-align:middle;"><paper-button raised class="more noIcon">${ButtonMoreItems}</paper-button></a> <a href="livetvitems.html?type=sports" class="clearLink" style="margin-left:1em;vertical-align:middle;"><paper-button raised class="more mini noIcon">${ButtonMoreItems}</paper-button></a>
</div> </div>
<div class="upcomingSportsItems itemsContainer"></div> <div class="upcomingSportsItems itemsContainer"></div>
<br /> <br />
@ -59,7 +59,7 @@
<div id="upcomingKids" class="homePageSection"> <div id="upcomingKids" class="homePageSection">
<div> <div>
<h1 class="listHeader" style="display:inline-block;vertical-align:middle;">${HeaderUpcomingForKids}</h1> <h1 class="listHeader" style="display:inline-block;vertical-align:middle;">${HeaderUpcomingForKids}</h1>
<a href="livetvitems.html?type=kids" class="clearLink" style="margin-left:1em;vertical-align:middle;"><paper-button raised class="more noIcon">${ButtonMoreItems}</paper-button></a> <a href="livetvitems.html?type=kids" class="clearLink" style="margin-left:1em;vertical-align:middle;"><paper-button raised class="more mini noIcon">${ButtonMoreItems}</paper-button></a>
</div> </div>
<div class="upcomingKidsItems itemsContainer"></div> <div class="upcomingKidsItems itemsContainer"></div>
<br /> <br />

View file

@ -216,7 +216,7 @@
IncludeItemTypes: "Audio", IncludeItemTypes: "Audio",
PersonTypes: "", PersonTypes: "",
ArtistIds: "", ArtistIds: "",
Limit: 100 Limit: 50
}, { }, {
playFromHere: true, playFromHere: true,
defaultAction: 'playallfromhere', defaultAction: 'playallfromhere',

View file

@ -583,7 +583,13 @@
function renderSimilarItems(page, item, context) { function renderSimilarItems(page, item, context) {
var promise; if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "Series" || item.Type == "Program" || item.Type == "Recording" || item.Type == "Game" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "ChannelVideoItem") {
$('#similarCollapsible', page).show();
}
else {
$('#similarCollapsible', page).hide();
return;
}
var screenWidth = $(window).width(); var screenWidth = $(window).width();
@ -593,28 +599,7 @@
fields: "PrimaryImageAspectRatio,UserData,SyncInfo" fields: "PrimaryImageAspectRatio,UserData,SyncInfo"
}; };
if (item.Type == "Movie") { ApiClient.getSimilarItems(item.Id, options).done(function (result) {
promise = ApiClient.getSimilarMovies(item.Id, options);
}
else if (item.Type == "Trailer" ||
(item.Type == "ChannelVideoItem" && item.ExtraType == "Trailer")) {
promise = ApiClient.getSimilarTrailers(item.Id, options);
}
else if (item.Type == "MusicAlbum") {
options.limit = 4;
promise = ApiClient.getSimilarAlbums(item.Id, options);
}
else if (item.Type == "Series") {
promise = ApiClient.getSimilarShows(item.Id, options);
}
else if (item.MediaType == "Game") {
promise = ApiClient.getSimilarGames(item.Id, options);
} else {
$('#similarCollapsible', page).hide();
return;
}
promise.done(function (result) {
if (!result.Items.length) { if (!result.Items.length) {
@ -628,15 +613,15 @@
var html = LibraryBrowser.getPosterViewHtml({ var html = LibraryBrowser.getPosterViewHtml({
items: result.Items, items: result.Items,
shape: item.Type == "MusicAlbum" ? "detailPageSquare" : "detailPagePortrait", shape: item.Type == "MusicAlbum" || item.Type == "MusicArtist" ? "detailPageSquare" : "detailPagePortrait",
showParentTitle: item.Type == "MusicAlbum", showParentTitle: item.Type == "MusicAlbum",
centerText: item.Type != "MusicAlbum", centerText: true,
showTitle: item.Type == "MusicAlbum" || item.Type == "Game", showTitle: item.Type == "MusicAlbum" || item.Type == "Game" || item.Type == "MusicArtist",
borderless: item.Type == "Game", borderless: item.Type == "Game",
context: context, context: context,
overlayText: item.Type != "MusicAlbum",
lazy: true, lazy: true,
showDetailsMenu: true showDetailsMenu: true,
coverImage: item.Type == "MusicAlbum" || item.Type == "MusicArtist"
}); });
$('#similarContent', page).html(html).lazyChildren(); $('#similarContent', page).html(html).lazyChildren();

View file

@ -165,7 +165,7 @@ paper-button.mini {
} }
paper-button.mini .content { paper-button.mini .content {
padding: 0.3em 0.7em; padding: 0.5em 0.7em;
} }
paper-button.mini.noIcon .content { paper-button.mini.noIcon .content {