2013-04-25 16:28:01 -07:00
|
|
|
|
(function ($, document) {
|
|
|
|
|
|
|
|
|
|
$(document).on('pagebeforeshow', "#musicRecommendedPage", function () {
|
|
|
|
|
|
2014-02-17 14:35:08 -07:00
|
|
|
|
var screenWidth = $(window).width();
|
2014-07-04 22:21:13 -07:00
|
|
|
|
var userId = Dashboard.getCurrentUserId();
|
2014-02-17 14:35:08 -07:00
|
|
|
|
|
2013-04-25 16:28:01 -07:00
|
|
|
|
var page = this;
|
|
|
|
|
|
2014-05-01 19:54:33 -07:00
|
|
|
|
var parentId = LibraryMenu.getTopParentId();
|
|
|
|
|
|
2013-04-25 16:28:01 -07:00
|
|
|
|
var options = {
|
|
|
|
|
IncludeItemTypes: "Audio",
|
2015-01-04 07:18:28 -07:00
|
|
|
|
Limit: 20,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,SyncInfo",
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ParentId: parentId,
|
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2013-04-25 16:28:01 -07:00
|
|
|
|
};
|
|
|
|
|
|
2014-07-04 22:21:13 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
|
2013-04-25 16:28:01 -07:00
|
|
|
|
|
|
|
|
|
$('#recentlyAddedSongs', page).html(LibraryBrowser.getPosterViewHtml({
|
2014-07-04 22:21:13 -07:00
|
|
|
|
items: items,
|
2013-12-27 14:20:27 -07:00
|
|
|
|
showUnplayedIndicator: false,
|
2014-07-04 22:21:13 -07:00
|
|
|
|
showChildCountIndicator: true,
|
2015-01-04 07:18:28 -07:00
|
|
|
|
shape: "square",
|
2013-04-25 17:52:55 -07:00
|
|
|
|
showTitle: true,
|
|
|
|
|
showParentTitle: true
|
2014-08-01 19:34:45 -07:00
|
|
|
|
})).createCardMenus();
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
|
|
SortBy: "DatePlayed",
|
|
|
|
|
SortOrder: "Descending",
|
|
|
|
|
IncludeItemTypes: "Audio",
|
2015-01-04 07:18:28 -07:00
|
|
|
|
Limit: 10,
|
2013-04-25 17:52:55 -07:00
|
|
|
|
Recursive: true,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,AudioInfo,SyncInfo",
|
2014-05-01 19:54:33 -07:00
|
|
|
|
Filters: "IsPlayed",
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ParentId: parentId,
|
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2013-04-25 17:52:55 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
$('#recentlyPlayed', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#recentlyPlayed', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#recentlyPlayedSongs', page).html(LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
2013-12-27 14:20:27 -07:00
|
|
|
|
showUnplayedIndicator: false,
|
2015-01-04 07:18:28 -07:00
|
|
|
|
shape: "square",
|
2013-04-25 17:52:55 -07:00
|
|
|
|
showTitle: true,
|
2014-09-01 13:10:54 -07:00
|
|
|
|
showParentTitle: true,
|
|
|
|
|
defaultAction: 'play'
|
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
})).createCardMenus();
|
2013-04-25 17:52:55 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
|
|
SortBy: "PlayCount",
|
|
|
|
|
SortOrder: "Descending",
|
|
|
|
|
IncludeItemTypes: "Audio",
|
2015-01-04 07:18:28 -07:00
|
|
|
|
Limit: 20,
|
2013-04-25 17:52:55 -07:00
|
|
|
|
Recursive: true,
|
2014-12-10 23:20:28 -07:00
|
|
|
|
Fields: "PrimaryImageAspectRatio,AudioInfo,SyncInfo",
|
2014-05-01 19:54:33 -07:00
|
|
|
|
Filters: "IsPlayed",
|
2014-11-30 12:01:33 -07:00
|
|
|
|
ParentId: parentId,
|
|
|
|
|
ImageTypeLimit: 1,
|
2014-12-01 05:43:34 -07:00
|
|
|
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
2013-04-25 17:52:55 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
|
|
|
|
|
|
|
|
|
if (result.Items.length) {
|
|
|
|
|
$('#topPlayed', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#topPlayed', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#topPlayedSongs', page).html(LibraryBrowser.getPosterViewHtml({
|
|
|
|
|
items: result.Items,
|
2013-12-27 14:20:27 -07:00
|
|
|
|
showUnplayedIndicator: false,
|
2015-01-04 07:18:28 -07:00
|
|
|
|
shape: "square",
|
2013-04-25 17:52:55 -07:00
|
|
|
|
showTitle: true,
|
2014-09-01 13:10:54 -07:00
|
|
|
|
showParentTitle: true,
|
|
|
|
|
defaultAction: 'play'
|
|
|
|
|
|
2014-08-01 19:34:45 -07:00
|
|
|
|
})).createCardMenus();
|
2013-04-25 16:28:01 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, document);
|