Add random sorting
Added random sorting to tv shows and movies lists
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user