diff --git a/src/controllers/favorites.js b/src/controllers/favorites.js index a7dcab7a45..4a51478ac7 100644 --- a/src/controllers/favorites.js +++ b/src/controllers/favorites.js @@ -7,6 +7,7 @@ import ServerConnections from 'components/ServerConnections'; import dom from 'scripts/dom'; import globalize from 'scripts/globalize'; import { getBackdropShape, getPortraitShape, getSquareShape } from 'utils/card'; +import { ItemSortBy } from '@jellyfin/sdk/lib/generated-client/models/item-sort-by'; import 'elements/emby-itemscontainer/emby-itemscontainer'; import 'elements/emby-scroller/emby-scroller'; @@ -133,7 +134,7 @@ function getFetchDataFn(section) { return function () { const apiClient = this.apiClient; const options = { - SortBy: 'SeriesSortName,SortName', + SortBy: [ItemSortBy.SeriesSortName, ItemSortBy.SortName].join(','), SortOrder: 'Ascending', Filters: 'IsFavorite', Recursive: true, diff --git a/src/controllers/list.js b/src/controllers/list.js index 758641cf63..ec394752b0 100644 --- a/src/controllers/list.js +++ b/src/controllers/list.js @@ -13,6 +13,7 @@ import '../elements/emby-scroller/emby-scroller'; import ServerConnections from '../components/ServerConnections'; import LibraryMenu from '../scripts/libraryMenu'; import { CollectionType } from '@jellyfin/sdk/lib/generated-client/models/collection-type'; +import { ItemSortBy } from '@jellyfin/sdk/lib/generated-client/models/item-sort-by'; function getInitialLiveTvQuery(instance, params, startIndex = 0, limit = 300) { const query = { @@ -223,7 +224,7 @@ function updateAlphaPickerState(instance) { if (alphaPicker) { const values = instance.getSortValues(); - if (values.sortBy.indexOf('SortName') !== -1) { + if (values.sortBy.indexOf(ItemSortBy.SortName) !== -1) { alphaPicker.classList.remove('hide'); instance.itemsContainer.parentNode.classList.add('padded-right-withalphapicker'); } else { @@ -981,7 +982,7 @@ class ItemsView { return sortNameOption.value; } - return 'IsFolder,' + sortNameOption.value; + return `${ItemSortBy.IsFolder},${sortNameOption.value}`; } getSortMenuOptions() { @@ -990,7 +991,7 @@ class ItemsView { if (this.params.type === 'Programs') { sortBy.push({ name: globalize.translate('AirDate'), - value: 'StartDate,SortName' + value: [ItemSortBy.StartDate, ItemSortBy.SortName].join(',') }); } @@ -1015,7 +1016,7 @@ class ItemsView { if (this.params.type !== 'Programs') { sortBy.push({ name: globalize.translate('DateAdded'), - value: 'DateCreated,SortName' + value: [ItemSortBy.DateCreated, ItemSortBy.SortName].join(',') }); } @@ -1029,13 +1030,13 @@ class ItemsView { option = this.getNameSortOption(this.params); sortBy.push({ name: globalize.translate('Folders'), - value: 'IsFolder,' + option.value + value: `${ItemSortBy.IsFolder},${option.value}` }); } sortBy.push({ name: globalize.translate('ParentalRating'), - value: 'OfficialRating,SortName' + value: [ItemSortBy.OfficialRating, ItemSortBy.SortName].join(',') }); option = this.getPlayCountSortOption(); @@ -1045,11 +1046,11 @@ class ItemsView { sortBy.push({ name: globalize.translate('ReleaseDate'), - value: 'ProductionYear,PremiereDate,SortName' + value: [ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName].join(',') }); sortBy.push({ name: globalize.translate('Runtime'), - value: 'Runtime,SortName' + value: [ItemSortBy.Runtime, ItemSortBy.SortName].join(',') }); return sortBy; } @@ -1058,13 +1059,13 @@ class ItemsView { if (params.type === 'Episode') { return { name: globalize.translate('Name'), - value: 'SeriesSortName,SortName' + value: [ItemSortBy.SeriesSortName, ItemSortBy.SortName].join(',') }; } return { name: globalize.translate('Name'), - value: 'SortName' + value: ItemSortBy.SortName }; } @@ -1075,7 +1076,7 @@ class ItemsView { return { name: globalize.translate('PlayCount'), - value: 'PlayCount,SortName' + value: [ItemSortBy.PlayCount, ItemSortBy.SortName].join(',') }; } @@ -1086,7 +1087,7 @@ class ItemsView { return { name: globalize.translate('DatePlayed'), - value: 'DatePlayed,SortName' + value: [ItemSortBy.DatePlayed, ItemSortBy.SortName].join(',') }; } @@ -1097,14 +1098,14 @@ class ItemsView { return { name: globalize.translate('CriticRating'), - value: 'CriticRating,SortName' + value: [ItemSortBy.CriticRating, ItemSortBy.SortName].join(',') }; } getCommunityRatingSortOption() { return { name: globalize.translate('CommunityRating'), - value: 'CommunityRating,SortName' + value: [ItemSortBy.CommunityRating, ItemSortBy.SortName].join(',') }; }