jellyfin-web/dashboard-ui/scripts/musicrecommended.js

107 lines
3.1 KiB
JavaScript
Raw Normal View History

2013-04-25 16:28:01 -07:00
(function ($, document) {
$(document).on('pagebeforeshow', "#musicRecommendedPage", function () {
var userId = Dashboard.getCurrentUserId();
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
};
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({
items: items,
2013-12-27 14:20:27 -07:00
showUnplayedIndicator: false,
showChildCountIndicator: true,
2015-01-04 07:18:28 -07:00
shape: "square",
2013-04-25 17:52:55 -07:00
showTitle: true,
2015-01-22 23:15:15 -07:00
showParentTitle: true,
lazy: true
})).lazyChildren();
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,
showParentTitle: true,
2015-01-22 23:15:15 -07:00
defaultAction: 'play',
lazy: true
2015-01-22 23:15:15 -07:00
})).lazyChildren();
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,
showParentTitle: true,
2015-01-22 23:15:15 -07:00
defaultAction: 'play',
lazy: true
2015-01-22 23:15:15 -07:00
})).lazyChildren();
2013-04-25 16:28:01 -07:00
});
});
})(jQuery, document);