1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fixing bug #5584 by sending the proper Sort params to the API

This commit is contained in:
MrK 2023-09-17 23:27:44 +01:00
parent 319477eb5a
commit 6cfcf36c3c
3 changed files with 33 additions and 5 deletions

View file

@ -1806,12 +1806,18 @@ class PlaybackManager {
MediaTypes: 'Audio'
});
} else if (firstItem.MediaType === 'Photo') {
const sortOptions = options.sortOptions || {};
let sortByValue = options.shuffle ? 'Random' : sortOptions.sortBy;
if (sortByValue == null) {
sortByValue = 'SortName';
}
promise = getItemsForPlayback(serverId, {
ParentId: firstItem.ParentId,
Filters: 'IsNotFolder',
// Setting this to true may cause some incorrect sorting
Recursive: false,
SortBy: options.shuffle ? 'Random' : 'SortName',
SortBy: sortByValue,
SortOrder: sortOptions.sortOrder,
MediaTypes: 'Photo,Video',
Limit: UNLIMITED_ITEMS
}).then(function (result) {
@ -1849,11 +1855,17 @@ class PlaybackManager {
MediaTypes: 'Audio'
});
} else if (firstItem.IsFolder && firstItem.CollectionType === 'homevideos') {
const sortOptions = options.sortOptions || {};
let sortByValue = options.shuffle ? 'Random' : sortOptions.sortBy;
if (sortByValue == null) {
sortByValue = 'SortName';
}
promise = getItemsForPlayback(serverId, mergePlaybackQueries({
ParentId: firstItem.Id,
Filters: 'IsNotFolder',
Recursive: true,
SortBy: options.shuffle ? 'Random' : 'SortName',
SortBy: sortByValue,
SortOrder: sortOptions.sortOrder,
// Only include Photos because we do not handle mixed queues currently
MediaTypes: 'Photo',
Limit: UNLIMITED_ITEMS

View file

@ -11,6 +11,7 @@ import dom from '../scripts/dom';
import recordingHelper from './recordingcreator/recordinghelper';
import ServerConnections from './ServerConnections';
import toast from './toast/toast';
import * as userSettings from '../scripts/settings/userSettings';
function playAllFromHere(card, serverId, queue) {
const parent = card.parentNode;
@ -165,6 +166,14 @@ function showPlayMenu(card, target) {
});
}
function getSortValues(parentId) {
const basekey = 'items-' + parentId + '-Folder';
return {
sortBy: userSettings.getFilter(basekey + '-sortby'),
sortOrder: userSettings.getFilter(basekey + '-sortorder') === 'Descending' ? 'Descending' : 'Ascending'
};
}
function executeAction(card, target, action) {
target = target || card;
@ -175,6 +184,10 @@ function executeAction(card, target, action) {
id = card.getAttribute('data-id');
}
const itemsContainer = dom.parentWithClass(card, 'itemsContainer');
const parentId = itemsContainer.getAttribute('data-parentid');
const item = getItemInfoFromCard(card);
const serverId = item.ServerId;
@ -205,7 +218,8 @@ function executeAction(card, target, action) {
playbackManager.play({
ids: [playableItemId],
startPositionTicks: startPositionTicks,
serverId: serverId
serverId: serverId,
sortOptions: getSortValues(parentId)
});
} else {
console.warn('Unable to play item', item);

View file

@ -722,11 +722,13 @@ class ItemsView {
function play() {
const currentItem = self.currentItem;
const values = self.getSortValues();
if (currentItem && !self.hasFilters) {
playbackManager.play({
items: [currentItem],
autoplay: true
autoplay: true,
sortOptions: values
});
} else {
getItems(self, self.params, currentItem, null, 0, 300).then(function (result) {