Add random sorting

Added random sorting to tv shows and movies lists
This commit is contained in:
Danny Michel 2022-05-12 13:15:15 -04:00
parent d57ac967f2
commit 178cef0d91
No known key found for this signature in database
GPG key ID: 1888313348A4DA5A
4 changed files with 26 additions and 0 deletions

View file

@ -42,6 +42,9 @@ import ServerConnections from '../ServerConnections';
return name.toUpperCase();
}
if (sortBy.indexOf('random') === 0) {
return Math.random(item.Random);
}
if (sortBy.indexOf('officialrating') === 0) {
return item.OfficialRating || globalize.translate('Unrated');
}

View file

@ -996,6 +996,12 @@ class ItemsView {
sortBy.push(option);
}
option = this.getRandomSortOption();
if (option) {
sortBy.push(option);
}
option = this.getCommunityRatingSortOption();
if (option) {
@ -1064,6 +1070,17 @@ class ItemsView {
};
}
getPlayCountSortOption() {
if (this.params.type === 'Programs') {
return null;
}
return {
name: globalize.translate('Random'),
value: 'Random,SortName'
};
}
getPlayCountSortOption() {
if (this.params.type === 'Programs') {
return null;

View file

@ -197,6 +197,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
items: [{
name: globalize.translate('Name'),
id: 'SortName,ProductionYear'
}, {
name: globalize.translate('Random'),
id: 'Random'
}, {
name: globalize.translate('OptionImdbRating'),
id: 'CommunityRating,SortName,ProductionYear'

View file

@ -252,6 +252,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
items: [{
name: globalize.translate('Name'),
id: 'SortName'
}, {
name: globalize.translate('Random'),
id: 'Random'
}, {
name: globalize.translate('OptionImdbRating'),
id: 'CommunityRating,SortName'