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:
parent
319477eb5a
commit
6cfcf36c3c
3 changed files with 33 additions and 5 deletions
|
@ -1806,12 +1806,18 @@ class PlaybackManager {
|
||||||
MediaTypes: 'Audio'
|
MediaTypes: 'Audio'
|
||||||
});
|
});
|
||||||
} else if (firstItem.MediaType === 'Photo') {
|
} else if (firstItem.MediaType === 'Photo') {
|
||||||
|
const sortOptions = options.sortOptions || {};
|
||||||
|
let sortByValue = options.shuffle ? 'Random' : sortOptions.sortBy;
|
||||||
|
if (sortByValue == null) {
|
||||||
|
sortByValue = 'SortName';
|
||||||
|
}
|
||||||
promise = getItemsForPlayback(serverId, {
|
promise = getItemsForPlayback(serverId, {
|
||||||
ParentId: firstItem.ParentId,
|
ParentId: firstItem.ParentId,
|
||||||
Filters: 'IsNotFolder',
|
Filters: 'IsNotFolder',
|
||||||
// Setting this to true may cause some incorrect sorting
|
// Setting this to true may cause some incorrect sorting
|
||||||
Recursive: false,
|
Recursive: false,
|
||||||
SortBy: options.shuffle ? 'Random' : 'SortName',
|
SortBy: sortByValue,
|
||||||
|
SortOrder: sortOptions.sortOrder,
|
||||||
MediaTypes: 'Photo,Video',
|
MediaTypes: 'Photo,Video',
|
||||||
Limit: UNLIMITED_ITEMS
|
Limit: UNLIMITED_ITEMS
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
|
@ -1849,11 +1855,17 @@ class PlaybackManager {
|
||||||
MediaTypes: 'Audio'
|
MediaTypes: 'Audio'
|
||||||
});
|
});
|
||||||
} else if (firstItem.IsFolder && firstItem.CollectionType === 'homevideos') {
|
} 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({
|
promise = getItemsForPlayback(serverId, mergePlaybackQueries({
|
||||||
ParentId: firstItem.Id,
|
ParentId: firstItem.Id,
|
||||||
Filters: 'IsNotFolder',
|
Filters: 'IsNotFolder',
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
SortBy: options.shuffle ? 'Random' : 'SortName',
|
SortBy: sortByValue,
|
||||||
|
SortOrder: sortOptions.sortOrder,
|
||||||
// Only include Photos because we do not handle mixed queues currently
|
// Only include Photos because we do not handle mixed queues currently
|
||||||
MediaTypes: 'Photo',
|
MediaTypes: 'Photo',
|
||||||
Limit: UNLIMITED_ITEMS
|
Limit: UNLIMITED_ITEMS
|
||||||
|
|
|
@ -11,6 +11,7 @@ import dom from '../scripts/dom';
|
||||||
import recordingHelper from './recordingcreator/recordinghelper';
|
import recordingHelper from './recordingcreator/recordinghelper';
|
||||||
import ServerConnections from './ServerConnections';
|
import ServerConnections from './ServerConnections';
|
||||||
import toast from './toast/toast';
|
import toast from './toast/toast';
|
||||||
|
import * as userSettings from '../scripts/settings/userSettings';
|
||||||
|
|
||||||
function playAllFromHere(card, serverId, queue) {
|
function playAllFromHere(card, serverId, queue) {
|
||||||
const parent = card.parentNode;
|
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) {
|
function executeAction(card, target, action) {
|
||||||
target = target || card;
|
target = target || card;
|
||||||
|
|
||||||
|
@ -175,6 +184,10 @@ function executeAction(card, target, action) {
|
||||||
id = card.getAttribute('data-id');
|
id = card.getAttribute('data-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const itemsContainer = dom.parentWithClass(card, 'itemsContainer');
|
||||||
|
|
||||||
|
const parentId = itemsContainer.getAttribute('data-parentid');
|
||||||
|
|
||||||
const item = getItemInfoFromCard(card);
|
const item = getItemInfoFromCard(card);
|
||||||
|
|
||||||
const serverId = item.ServerId;
|
const serverId = item.ServerId;
|
||||||
|
@ -200,12 +213,13 @@ function executeAction(card, target, action) {
|
||||||
});
|
});
|
||||||
} else if (action === 'play' || action === 'resume') {
|
} else if (action === 'play' || action === 'resume') {
|
||||||
const startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0', 10);
|
const startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0', 10);
|
||||||
|
|
||||||
if (playbackManager.canPlay(item)) {
|
if (playbackManager.canPlay(item)) {
|
||||||
playbackManager.play({
|
playbackManager.play({
|
||||||
ids: [playableItemId],
|
ids: [playableItemId],
|
||||||
startPositionTicks: startPositionTicks,
|
startPositionTicks: startPositionTicks,
|
||||||
serverId: serverId
|
serverId: serverId,
|
||||||
|
sortOptions: getSortValues(parentId)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.warn('Unable to play item', item);
|
console.warn('Unable to play item', item);
|
||||||
|
|
|
@ -722,11 +722,13 @@ class ItemsView {
|
||||||
|
|
||||||
function play() {
|
function play() {
|
||||||
const currentItem = self.currentItem;
|
const currentItem = self.currentItem;
|
||||||
|
const values = self.getSortValues();
|
||||||
|
|
||||||
if (currentItem && !self.hasFilters) {
|
if (currentItem && !self.hasFilters) {
|
||||||
playbackManager.play({
|
playbackManager.play({
|
||||||
items: [currentItem],
|
items: [currentItem],
|
||||||
autoplay: true
|
autoplay: true,
|
||||||
|
sortOptions: values
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
getItems(self, self.params, currentItem, null, 0, 300).then(function (result) {
|
getItems(self, self.params, currentItem, null, 0, 300).then(function (result) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue