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

Merge branch 'jellyfin:master' into audio-normalization

This commit is contained in:
TelepathicWalrus 2023-03-27 18:05:56 +01:00 committed by GitHub
commit 8110c324d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 1402 additions and 1210 deletions

View file

@ -18,6 +18,7 @@ import browser from '../../scripts/browser';
import { playbackManager } from '../playback/playbackmanager';
import itemShortcuts from '../shortcuts';
import imageHelper from '../../scripts/imagehelper';
import { randomInt } from '../../utils/number.ts';
import './card.scss';
import '../../elements/emby-button/paper-icon-button-light';
import '../guide/programs.scss';
@ -640,16 +641,6 @@ import { appRouter } from '../appRouter';
};
}
/**
* Generates a random integer in a given range.
* @param {number} min - Minimum of the range.
* @param {number} max - Maximum of the range.
* @returns {number} Randomly generated number.
*/
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
/**
* Generates an index used to select the default color of a card based on a string.
* @param {?string} [str] - String to use for generating the index.
@ -669,7 +660,7 @@ import { appRouter } from '../appRouter';
return (index % numRandomColors) + 1;
} else {
return getRandomInt(1, numRandomColors);
return randomInt(1, numRandomColors);
}
}

View file

@ -15,7 +15,6 @@ import toast from './toast/toast';
const user = options.user;
const canPlay = playbackManager.canPlay(item);
const restrictOptions = (browser.operaTv || browser.web0s) && !user.Policy.IsAdministrator;
const commands = [];
@ -99,8 +98,8 @@ import toast from './toast/toast';
});
}
if (!restrictOptions) {
if (itemHelper.supportsAddingToCollection(item)) {
if (!browser.tv) {
if (itemHelper.supportsAddingToCollection(item) && options.EnableCollectionManagement) {
commands.push({
name: globalize.translate('AddToCollection'),
id: 'addtocollection',
@ -272,7 +271,7 @@ import toast from './toast/toast';
});
}
if (!restrictOptions && options.share === true && itemHelper.canShare(item, user)) {
if (!browser.tv && options.share === true && itemHelper.canShare(item, user)) {
commands.push({
name: globalize.translate('Share'),
id: 'share',

View file

@ -1,3 +1,5 @@
import { randomInt } from '../../utils/number.ts';
let currentId = 0;
function addUniquePlaylistItemId(item) {
if (!item.PlaylistItemId) {
@ -56,7 +58,7 @@ class PlayQueueManager {
const currentPlaylistItem = this._playlist.splice(this.getCurrentPlaylistIndex(), 1)[0];
for (let i = this._playlist.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * i);
const j = randomInt(0, i - 1);
const temp = this._playlist[i];
this._playlist[i] = this._playlist[j];
this._playlist[j] = temp;