Add limit setting to songs controller

This commit is contained in:
MrTimscampi 2020-04-03 23:19:21 +02:00
parent 835e9614b9
commit 3a3be4f71c
3 changed files with 15 additions and 7 deletions

View File

@ -30,7 +30,7 @@ define(["layoutManager", "playbackManager", "loading", "events", "libraryBrowser
Fields: "PrimaryImageAspectRatio,SortName,BasicSyncInfo",
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
StartIndex: 0,
StartIndex: 0
},
view: libraryBrowser.getSavedView(key) || "Poster"
};

View File

@ -14,7 +14,7 @@ define(["layoutManager", "loading", "events", "libraryBrowser", "imageLoader", "
Fields: "PrimaryImageAspectRatio,SortName,BasicSyncInfo",
StartIndex: 0,
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
};
if (userSettings.libraryPageSize() > 0) {

View File

@ -1,4 +1,4 @@
define(["events", "libraryBrowser", "imageLoader", "listView", "loading", "emby-itemscontainer"], function (events, libraryBrowser, imageLoader, listView, loading) {
define(["events", "libraryBrowser", "imageLoader", "listView", "loading", "userSettings", "emby-itemscontainer"], function (events, libraryBrowser, imageLoader, listView, loading, userSettings) {
"use strict";
return function (view, params, tabContent) {
@ -7,19 +7,23 @@ define(["events", "libraryBrowser", "imageLoader", "listView", "loading", "emby-
var pageData = data[key];
if (!pageData) {
pageData = data[key] = {
pageData = {
query: {
SortBy: "Album,SortName",
SortOrder: "Ascending",
IncludeItemTypes: "Audio",
Recursive: true,
Fields: "AudioInfo,ParentId",
Limit: 100,
StartIndex: 0,
ImageTypeLimit: 1,
EnableImageTypes: "Primary"
}
};
if (userSettings.libraryPageSize() > 0) {
pageData.query['Limit'] = userSettings.libraryPageSize();
}
pageData.query.ParentId = params.topParentId;
libraryBrowser.loadSavedQueryValues(key, pageData.query);
}
@ -49,7 +53,9 @@ define(["events", "libraryBrowser", "imageLoader", "listView", "loading", "emby-
return;
}
query.StartIndex += query.Limit;
if (userSettings.libraryPageSize() > 0) {
query.StartIndex += query.Limit;
}
reloadItems(tabContent);
}
@ -58,7 +64,9 @@ define(["events", "libraryBrowser", "imageLoader", "listView", "loading", "emby-
return;
}
query.StartIndex -= query.Limit;
if (userSettings.libraryPageSize() > 0) {
query.StartIndex = Math.max(0, query.StartIndex - query.Limit);
}
reloadItems(tabContent);
}