mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix sonarjs no-collapsible-if
This commit is contained in:
parent
ccdbf0bfc3
commit
1f4e65822b
33 changed files with 330 additions and 473 deletions
|
@ -87,12 +87,10 @@ class AppRouter {
|
|||
|
||||
path = path.replace(this.baseUrl(), '');
|
||||
|
||||
if (this.currentRouteInfo && this.currentRouteInfo.path === path) {
|
||||
// can't use this with home right now due to the back menu
|
||||
if (this.currentRouteInfo.route.type !== 'home') {
|
||||
loading.hide();
|
||||
return Promise.resolve();
|
||||
}
|
||||
// can't use this with home right now due to the back menu
|
||||
if (this.currentRouteInfo?.path === path && this.currentRouteInfo.route.type !== 'home') {
|
||||
loading.hide();
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
this.promiseShow = new Promise((resolve) => {
|
||||
|
@ -351,15 +349,13 @@ class AppRouter {
|
|||
onRequestFail(_e, data) {
|
||||
const apiClient = this;
|
||||
|
||||
if (data.status === 403) {
|
||||
if (data.errorCode === 'ParentalControl') {
|
||||
const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true;
|
||||
if (data.status === 403 && data.errorCode === 'ParentalControl') {
|
||||
const isCurrentAllowed = appRouter.currentRouteInfo ? (appRouter.currentRouteInfo.route.anonymous || appRouter.currentRouteInfo.route.startup) : true;
|
||||
|
||||
// Bounce to the login screen, but not if a password entry fails, obviously
|
||||
if (!isCurrentAllowed) {
|
||||
appRouter.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater'));
|
||||
appRouter.showLocalLogin(apiClient.serverId());
|
||||
}
|
||||
// Bounce to the login screen, but not if a password entry fails, obviously
|
||||
if (!isCurrentAllowed) {
|
||||
appRouter.showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater'));
|
||||
appRouter.showLocalLogin(apiClient.serverId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -790,10 +790,8 @@ import { appRouter } from '../appRouter';
|
|||
|
||||
const showOtherText = isOuterFooter ? !overlayText : overlayText;
|
||||
|
||||
if (isOuterFooter && options.cardLayout && layoutManager.mobile) {
|
||||
if (options.cardFooterAside !== 'none') {
|
||||
html += `<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu" title="${globalize.translate('ButtonMore')}"><span class="material-icons more_vert" aria-hidden="true"></span></button>`;
|
||||
}
|
||||
if (isOuterFooter && options.cardLayout && layoutManager.mobile && options.cardFooterAside !== 'none') {
|
||||
html += `<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu" title="${globalize.translate('ButtonMore')}"><span class="material-icons more_vert" aria-hidden="true"></span></button>`;
|
||||
}
|
||||
|
||||
const cssClass = options.centerText ? 'cardText cardTextCentered' : 'cardText';
|
||||
|
@ -803,33 +801,31 @@ import { appRouter } from '../appRouter';
|
|||
const parentTitleUnderneath = item.Type === 'MusicAlbum' || item.Type === 'Audio' || item.Type === 'MusicVideo';
|
||||
let titleAdded;
|
||||
|
||||
if (showOtherText) {
|
||||
if ((options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
|
||||
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
|
||||
if (item.SeriesId) {
|
||||
lines.push(getTextActionButton({
|
||||
Id: item.SeriesId,
|
||||
ServerId: serverId,
|
||||
Name: item.SeriesName,
|
||||
Type: 'Series',
|
||||
IsFolder: true
|
||||
}));
|
||||
} else {
|
||||
lines.push(escapeHtml(item.SeriesName));
|
||||
if (showOtherText && (options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
|
||||
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
|
||||
if (item.SeriesId) {
|
||||
lines.push(getTextActionButton({
|
||||
Id: item.SeriesId,
|
||||
ServerId: serverId,
|
||||
Name: item.SeriesName,
|
||||
Type: 'Series',
|
||||
IsFolder: true
|
||||
}));
|
||||
} else {
|
||||
lines.push(escapeHtml(item.SeriesName));
|
||||
}
|
||||
} else {
|
||||
if (isUsingLiveTvNaming(item)) {
|
||||
lines.push(escapeHtml(item.Name));
|
||||
|
||||
if (!item.EpisodeTitle && !item.IndexNumber) {
|
||||
titleAdded = true;
|
||||
}
|
||||
} else {
|
||||
if (isUsingLiveTvNaming(item)) {
|
||||
lines.push(escapeHtml(item.Name));
|
||||
const parentTitle = item.SeriesName || item.Series || item.Album || item.AlbumArtist || '';
|
||||
|
||||
if (!item.EpisodeTitle && !item.IndexNumber) {
|
||||
titleAdded = true;
|
||||
}
|
||||
} else {
|
||||
const parentTitle = item.SeriesName || item.Series || item.Album || item.AlbumArtist || '';
|
||||
|
||||
if (parentTitle || showTitle) {
|
||||
lines.push(escapeHtml(parentTitle));
|
||||
}
|
||||
if (parentTitle || showTitle) {
|
||||
lines.push(escapeHtml(parentTitle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -986,10 +982,8 @@ import { appRouter } from '../appRouter';
|
|||
}
|
||||
}
|
||||
|
||||
if (options.showPersonRoleOrType) {
|
||||
if (item.Role) {
|
||||
lines.push(globalize.translate('PersonRole', escapeHtml(item.Role)));
|
||||
}
|
||||
if (options.showPersonRoleOrType && item.Role) {
|
||||
lines.push(globalize.translate('PersonRole', escapeHtml(item.Role)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1009,13 +1003,11 @@ import { appRouter } from '../appRouter';
|
|||
html += progressHtml;
|
||||
}
|
||||
|
||||
if (html) {
|
||||
if (!isOuterFooter || logoUrl || options.cardLayout) {
|
||||
html = '<div class="' + footerClass + '">' + html;
|
||||
if (html && (!isOuterFooter || logoUrl || options.cardLayout)) {
|
||||
html = '<div class="' + footerClass + '">' + html;
|
||||
|
||||
//cardFooter
|
||||
html += '</div>';
|
||||
}
|
||||
//cardFooter
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
return html;
|
||||
|
|
|
@ -34,10 +34,8 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
let shape = (options.backdropShape || 'backdrop');
|
||||
|
||||
if (videoStream.Width && videoStream.Height) {
|
||||
if ((videoStream.Width / videoStream.Height) <= 1.2) {
|
||||
shape = (options.squareShape || 'square');
|
||||
}
|
||||
if (videoStream.Width && videoStream.Height && (videoStream.Width / videoStream.Height) <= 1.2) {
|
||||
shape = (options.squareShape || 'square');
|
||||
}
|
||||
|
||||
className += ` ${shape}Card`;
|
||||
|
|
|
@ -384,10 +384,11 @@ import scrollManager from './scrollManager';
|
|||
// See if there's a focusable container, and if so, send the focus command to that
|
||||
if (activeElement) {
|
||||
const nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
|
||||
if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement) {
|
||||
if (focusableContainer !== nearestElementFocusableParent) {
|
||||
nearestElement = nearestElementFocusableParent;
|
||||
}
|
||||
if (nearestElementFocusableParent
|
||||
&& nearestElementFocusableParent !== nearestElement
|
||||
&& focusableContainer !== nearestElementFocusableParent
|
||||
) {
|
||||
nearestElement = nearestElementFocusableParent;
|
||||
}
|
||||
}
|
||||
focus(nearestElement);
|
||||
|
|
|
@ -72,26 +72,25 @@ import toast from './toast/toast';
|
|||
}
|
||||
}
|
||||
|
||||
if (item.IsFolder || item.Type === 'MusicArtist' || item.Type === 'MusicGenre') {
|
||||
if (item.CollectionType !== 'livetv') {
|
||||
if (options.shuffle !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('Shuffle'),
|
||||
id: 'shuffle',
|
||||
icon: 'shuffle'
|
||||
});
|
||||
}
|
||||
}
|
||||
if ((item.IsFolder || item.Type === 'MusicArtist' || item.Type === 'MusicGenre')
|
||||
&& item.CollectionType !== 'livetv'
|
||||
&& options.shuffle !== false
|
||||
) {
|
||||
commands.push({
|
||||
name: globalize.translate('Shuffle'),
|
||||
id: 'shuffle',
|
||||
icon: 'shuffle'
|
||||
});
|
||||
}
|
||||
|
||||
if (item.MediaType === 'Audio' || item.Type === 'MusicAlbum' || item.Type === 'MusicArtist' || item.Type === 'MusicGenre') {
|
||||
if (options.instantMix !== false && !itemHelper.isLocalItem(item)) {
|
||||
commands.push({
|
||||
name: globalize.translate('InstantMix'),
|
||||
id: 'instantmix',
|
||||
icon: 'explore'
|
||||
});
|
||||
}
|
||||
if ((item.MediaType === 'Audio' || item.Type === 'MusicAlbum' || item.Type === 'MusicArtist' || item.Type === 'MusicGenre')
|
||||
&& options.instantMix !== false && !itemHelper.isLocalItem(item)
|
||||
) {
|
||||
commands.push({
|
||||
name: globalize.translate('InstantMix'),
|
||||
id: 'instantmix',
|
||||
icon: 'explore'
|
||||
});
|
||||
}
|
||||
|
||||
if (commands.length) {
|
||||
|
@ -180,57 +179,49 @@ import toast from './toast/toast';
|
|||
}
|
||||
|
||||
const canEdit = itemHelper.canEdit(user, item);
|
||||
if (canEdit) {
|
||||
if (options.edit !== false && item.Type !== 'SeriesTimer') {
|
||||
const text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata');
|
||||
commands.push({
|
||||
name: text,
|
||||
id: 'edit',
|
||||
icon: 'edit'
|
||||
});
|
||||
}
|
||||
if (canEdit && options.edit !== false && item.Type !== 'SeriesTimer') {
|
||||
const text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata');
|
||||
commands.push({
|
||||
name: text,
|
||||
id: 'edit',
|
||||
icon: 'edit'
|
||||
});
|
||||
}
|
||||
|
||||
if (itemHelper.canEditImages(user, item)) {
|
||||
if (options.editImages !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('EditImages'),
|
||||
id: 'editimages',
|
||||
icon: 'image'
|
||||
});
|
||||
}
|
||||
if (itemHelper.canEditImages(user, item) && options.editImages !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('EditImages'),
|
||||
id: 'editimages',
|
||||
icon: 'image'
|
||||
});
|
||||
}
|
||||
|
||||
if (canEdit) {
|
||||
if (item.MediaType === 'Video' && item.Type !== 'TvChannel' && item.Type !== 'Program' && item.LocationType !== 'Virtual' && !(item.Type === 'Recording' && item.Status !== 'Completed')) {
|
||||
if (options.editSubtitles !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('EditSubtitles'),
|
||||
id: 'editsubtitles',
|
||||
icon: 'closed_caption'
|
||||
});
|
||||
}
|
||||
}
|
||||
if (canEdit && item.MediaType === 'Video' && item.Type !== 'TvChannel' && item.Type !== 'Program'
|
||||
&& item.LocationType !== 'Virtual'
|
||||
&& !(item.Type === 'Recording' && item.Status !== 'Completed')
|
||||
&& options.editSubtitles !== false
|
||||
) {
|
||||
commands.push({
|
||||
name: globalize.translate('EditSubtitles'),
|
||||
id: 'editsubtitles',
|
||||
icon: 'closed_caption'
|
||||
});
|
||||
}
|
||||
|
||||
if (options.identify !== false) {
|
||||
if (itemHelper.canIdentify(user, item)) {
|
||||
commands.push({
|
||||
name: globalize.translate('Identify'),
|
||||
id: 'identify',
|
||||
icon: 'edit'
|
||||
});
|
||||
}
|
||||
if (options.identify !== false && itemHelper.canIdentify(user, item)) {
|
||||
commands.push({
|
||||
name: globalize.translate('Identify'),
|
||||
id: 'identify',
|
||||
icon: 'edit'
|
||||
});
|
||||
}
|
||||
|
||||
if (item.MediaSources) {
|
||||
if (options.moremediainfo !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('MoreMediaInfo'),
|
||||
id: 'moremediainfo',
|
||||
icon: 'info'
|
||||
});
|
||||
}
|
||||
if (item.MediaSources && options.moremediainfo !== false) {
|
||||
commands.push({
|
||||
name: globalize.translate('MoreMediaInfo'),
|
||||
id: 'moremediainfo',
|
||||
icon: 'info'
|
||||
});
|
||||
}
|
||||
|
||||
if (item.Type === 'Program' && options.record !== false) {
|
||||
|
@ -240,11 +231,7 @@ import toast from './toast/toast';
|
|||
id: 'record',
|
||||
icon: 'fiber_manual_record'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (item.Type === 'Program' && options.record !== false) {
|
||||
if (!item.TimerId) {
|
||||
} else {
|
||||
commands.push({
|
||||
name: globalize.translate('Record'),
|
||||
id: 'record',
|
||||
|
@ -277,26 +264,20 @@ import toast from './toast/toast';
|
|||
});
|
||||
}
|
||||
|
||||
if (!restrictOptions) {
|
||||
if (options.share === true) {
|
||||
if (itemHelper.canShare(item, user)) {
|
||||
commands.push({
|
||||
name: globalize.translate('Share'),
|
||||
id: 'share',
|
||||
icon: 'share'
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!restrictOptions && options.share === true && itemHelper.canShare(item, user)) {
|
||||
commands.push({
|
||||
name: globalize.translate('Share'),
|
||||
id: 'share',
|
||||
icon: 'share'
|
||||
});
|
||||
}
|
||||
|
||||
if (options.sync !== false) {
|
||||
if (itemHelper.canSync(user, item)) {
|
||||
commands.push({
|
||||
name: globalize.translate('Sync'),
|
||||
id: 'sync',
|
||||
icon: 'sync'
|
||||
});
|
||||
}
|
||||
if (options.sync !== false && itemHelper.canSync(user, item)) {
|
||||
commands.push({
|
||||
name: globalize.translate('Sync'),
|
||||
id: 'sync',
|
||||
icon: 'sync'
|
||||
});
|
||||
}
|
||||
|
||||
if (options.openAlbum !== false && item.AlbumId && item.MediaType !== 'Photo') {
|
||||
|
|
|
@ -48,10 +48,8 @@ export function getDisplayName(item, options = {}) {
|
|||
export function supportsAddingToCollection(item) {
|
||||
const invalidTypes = ['Genre', 'MusicGenre', 'Studio', 'UserView', 'CollectionFolder', 'Audio', 'Program', 'Timer', 'SeriesTimer'];
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording' && item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !item.CollectionType && invalidTypes.indexOf(item.Type) === -1 && item.MediaType !== 'Photo' && !isLocalItem(item);
|
||||
|
@ -74,10 +72,8 @@ export function supportsAddingToPlaylist(item) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording' && item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isLocalItem(item)) {
|
||||
|
@ -109,10 +105,8 @@ export function canEdit(user, item) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording' && item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isLocalItem(item)) {
|
||||
|
@ -133,23 +127,17 @@ export function isLocalItem(item) {
|
|||
export function canIdentify (user, item) {
|
||||
const itemType = item.Type;
|
||||
|
||||
if (itemType === 'Movie' ||
|
||||
itemType === 'Trailer' ||
|
||||
itemType === 'Series' ||
|
||||
itemType === 'BoxSet' ||
|
||||
itemType === 'Person' ||
|
||||
itemType === 'Book' ||
|
||||
itemType === 'MusicAlbum' ||
|
||||
itemType === 'MusicArtist' ||
|
||||
itemType === 'MusicVideo') {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
if (!isLocalItem(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return (itemType === 'Movie'
|
||||
|| itemType === 'Trailer'
|
||||
|| itemType === 'Series'
|
||||
|| itemType === 'BoxSet'
|
||||
|| itemType === 'Person'
|
||||
|| itemType === 'Book'
|
||||
|| itemType === 'MusicAlbum'
|
||||
|| itemType === 'MusicArtist'
|
||||
|| itemType === 'MusicVideo')
|
||||
&& user.Policy.IsAdministrator
|
||||
&& !isLocalItem(item);
|
||||
}
|
||||
|
||||
export function canEditImages (user, item) {
|
||||
|
@ -167,10 +155,8 @@ export function canEditImages (user, item) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording' && item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return itemType !== 'Timer' && itemType !== 'SeriesTimer' && canEdit(user, item) && !isLocalItem(item);
|
||||
|
@ -201,10 +187,8 @@ export function canShare (item, user) {
|
|||
if (item.Type === 'SeriesTimer') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording') {
|
||||
if (item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
if (item.Type === 'Recording' && item.Status !== 'Completed') {
|
||||
return false;
|
||||
}
|
||||
if (isLocalItem(item)) {
|
||||
return false;
|
||||
|
@ -301,11 +285,10 @@ export function canRefreshMetadata (item, user) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program' && item.Type !== 'TvChannel' && !(item.Type === 'Recording' && item.Status !== 'Completed')) {
|
||||
if (!isLocalItem(item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program'
|
||||
&& item.Type !== 'TvChannel'
|
||||
&& !(item.Type === 'Recording' && item.Status !== 'Completed')
|
||||
&& !isLocalItem(item);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -94,16 +94,14 @@ function onPlaybackStopped(e, stopInfo) {
|
|||
const state = stopInfo.state;
|
||||
|
||||
const eventsToMonitor = getEventsToMonitor(instance);
|
||||
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
||||
if (state.NowPlayingItem?.MediaType === 'Video') {
|
||||
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
||||
instance.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') {
|
||||
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
|
||||
instance.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
} else if (state.NowPlayingItem?.MediaType === 'Audio' && eventsToMonitor.indexOf('audioplayback') !== -1) {
|
||||
instance.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -328,10 +328,8 @@ import ServerConnections from '../ServerConnections';
|
|||
textlines.push(datetime.getDisplayTime(datetime.parseISO8601Date(item.StartDate)));
|
||||
}
|
||||
|
||||
if (options.showChannel) {
|
||||
if (item.ChannelName) {
|
||||
textlines.push(item.ChannelName);
|
||||
}
|
||||
if (options.showChannel && item.ChannelName) {
|
||||
textlines.push(item.ChannelName);
|
||||
}
|
||||
|
||||
let parentTitle = null;
|
||||
|
@ -370,10 +368,8 @@ import ServerConnections from '../ServerConnections';
|
|||
}
|
||||
|
||||
if (item.IsFolder) {
|
||||
if (options.artist !== false) {
|
||||
if (item.AlbumArtist && item.Type === 'MusicAlbum') {
|
||||
if (options.artist !== false && item.AlbumArtist && item.Type === 'MusicAlbum') {
|
||||
textlines.push(item.AlbumArtist);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (options.artist) {
|
||||
|
@ -386,10 +382,8 @@ import ServerConnections from '../ServerConnections';
|
|||
}
|
||||
}
|
||||
|
||||
if (item.Type === 'TvChannel') {
|
||||
if (item.CurrentProgram) {
|
||||
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
|
||||
}
|
||||
if (item.Type === 'TvChannel' && item.CurrentProgram) {
|
||||
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
|
||||
}
|
||||
|
||||
cssClass = 'listItemBody';
|
||||
|
@ -405,19 +399,17 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
html += getTextLinesHtml(textlines, isLargeStyle);
|
||||
|
||||
if (options.mediaInfo !== false) {
|
||||
if (!enableSideMediaInfo) {
|
||||
const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
||||
if (options.mediaInfo !== false && !enableSideMediaInfo) {
|
||||
const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
||||
|
||||
html += `<div class="${mediaInfoClass}">`;
|
||||
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
episodeTitle: false,
|
||||
originalAirDate: false,
|
||||
subtitles: false
|
||||
html += `<div class="${mediaInfoClass}">`;
|
||||
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
episodeTitle: false,
|
||||
originalAirDate: false,
|
||||
subtitles: false
|
||||
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
if (enableOverview && item.Overview) {
|
||||
|
@ -428,20 +420,18 @@ import ServerConnections from '../ServerConnections';
|
|||
|
||||
html += '</div>';
|
||||
|
||||
if (options.mediaInfo !== false) {
|
||||
if (enableSideMediaInfo) {
|
||||
html += '<div class="secondary listItemMediaInfo">';
|
||||
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
if (options.mediaInfo !== false && enableSideMediaInfo) {
|
||||
html += '<div class="secondary listItemMediaInfo">';
|
||||
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
|
||||
year: false,
|
||||
container: false,
|
||||
episodeTitle: false,
|
||||
criticRating: false,
|
||||
endsAt: false
|
||||
year: false,
|
||||
container: false,
|
||||
episodeTitle: false,
|
||||
criticRating: false,
|
||||
endsAt: false
|
||||
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
if (!options.recordButton && (item.Type === 'Timer' || item.Type === 'Program')) {
|
||||
|
|
|
@ -129,17 +129,18 @@ import '../../elements/emby-button/emby-button';
|
|||
}
|
||||
}
|
||||
|
||||
if ((item.Type === 'Episode' || item.MediaType === 'Photo') && options.originalAirDate !== false) {
|
||||
if (item.PremiereDate) {
|
||||
try {
|
||||
//don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog
|
||||
date = datetime.parseISO8601Date(item.PremiereDate, item.Type !== 'Episode');
|
||||
if ((item.Type === 'Episode' || item.MediaType === 'Photo')
|
||||
&& options.originalAirDate !== false
|
||||
&& item.PremiereDate
|
||||
) {
|
||||
try {
|
||||
//don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog
|
||||
date = datetime.parseISO8601Date(item.PremiereDate, item.Type !== 'Episode');
|
||||
|
||||
text = datetime.toLocaleDateString(date);
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
text = datetime.toLocaleDateString(date);
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,17 +240,17 @@ import '../../elements/emby-button/emby-button';
|
|||
}
|
||||
}
|
||||
|
||||
if (options.year !== false) {
|
||||
if (item.Type !== 'Series' && item.Type !== 'Episode' && item.Type !== 'Person' && item.MediaType !== 'Photo' && item.Type !== 'Program' && item.Type !== 'Season') {
|
||||
if (item.ProductionYear) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
} else if (item.PremiereDate) {
|
||||
try {
|
||||
text = datetime.parseISO8601Date(item.PremiereDate).getFullYear();
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
if (options.year !== false && item.Type !== 'Series' && item.Type !== 'Episode' && item.Type !== 'Person'
|
||||
&& item.MediaType !== 'Photo' && item.Type !== 'Program' && item.Type !== 'Season'
|
||||
) {
|
||||
if (item.ProductionYear) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
} else if (item.PremiereDate) {
|
||||
try {
|
||||
text = datetime.parseISO8601Date(item.PremiereDate).getFullYear();
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -314,14 +315,12 @@ import '../../elements/emby-button/emby-button';
|
|||
}
|
||||
|
||||
export function getEndsAt(item) {
|
||||
if (item.MediaType === 'Video' && item.RunTimeTicks) {
|
||||
if (!item.StartDate) {
|
||||
let endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
|
||||
endDate = new Date(endDate);
|
||||
if (item.MediaType === 'Video' && item.RunTimeTicks && !item.StartDate) {
|
||||
let endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
||||
const displayTime = datetime.getDisplayTime(endDate);
|
||||
return globalize.translate('EndsAtValue', displayTime);
|
||||
}
|
||||
const displayTime = datetime.getDisplayTime(endDate);
|
||||
return globalize.translate('EndsAtValue', displayTime);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -444,12 +444,10 @@ import { appRouter } from '../appRouter';
|
|||
options = options || {};
|
||||
options.type = options.type || 'Primary';
|
||||
|
||||
if (options.type === 'Primary') {
|
||||
if (item.SeriesPrimaryImageTag) {
|
||||
options.tag = item.SeriesPrimaryImageTag;
|
||||
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
||||
options.tag = item.SeriesPrimaryImageTag;
|
||||
|
||||
return ServerConnections.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||
}
|
||||
return ServerConnections.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||
}
|
||||
|
||||
if (options.type === 'Thumb') {
|
||||
|
|
|
@ -44,10 +44,8 @@ function triggerPlayerChange(playbackManagerInstance, newPlayer, newTarget, prev
|
|||
return;
|
||||
}
|
||||
|
||||
if (newTarget && previousTargetInfo) {
|
||||
if (newTarget.id === previousTargetInfo.id) {
|
||||
return;
|
||||
}
|
||||
if (newTarget && previousTargetInfo && newTarget.id === previousTargetInfo.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
Events.trigger(playbackManagerInstance, 'playerchange', [newPlayer, newTarget, previousPlayer]);
|
||||
|
@ -501,10 +499,10 @@ function getPlaybackInfo(player,
|
|||
}
|
||||
|
||||
// lastly, enforce player overrides for special situations
|
||||
if (query.EnableDirectStream !== false) {
|
||||
if (player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)) {
|
||||
query.EnableDirectStream = false;
|
||||
}
|
||||
if (query.EnableDirectStream !== false
|
||||
&& player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)
|
||||
) {
|
||||
query.EnableDirectStream = false;
|
||||
}
|
||||
|
||||
if (player.getDirectPlayProtocols) {
|
||||
|
@ -569,10 +567,10 @@ function getLiveStream(player, apiClient, item, playSessionId, deviceProfile, ma
|
|||
}
|
||||
|
||||
// lastly, enforce player overrides for special situations
|
||||
if (query.EnableDirectStream !== false) {
|
||||
if (player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)) {
|
||||
query.EnableDirectStream = false;
|
||||
}
|
||||
if (query.EnableDirectStream !== false
|
||||
&& player.supportsPlayMethod && !player.supportsPlayMethod('DirectStream', item)
|
||||
) {
|
||||
query.EnableDirectStream = false;
|
||||
}
|
||||
|
||||
return apiClient.ajax({
|
||||
|
@ -963,10 +961,8 @@ class PlaybackManager {
|
|||
self.isPlaying = function (player) {
|
||||
player = player || self._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
if (player.isPlaying) {
|
||||
return player.isPlaying();
|
||||
}
|
||||
if (player?.isPlaying) {
|
||||
return player.isPlaying();
|
||||
}
|
||||
|
||||
return player != null && player.currentSrc() != null;
|
||||
|
@ -975,10 +971,8 @@ class PlaybackManager {
|
|||
self.isPlayingMediaType = function (mediaType, player) {
|
||||
player = player || self._currentPlayer;
|
||||
|
||||
if (player) {
|
||||
if (player.isPlaying) {
|
||||
return player.isPlaying(mediaType);
|
||||
}
|
||||
if (player?.isPlaying) {
|
||||
return player.isPlaying(mediaType);
|
||||
}
|
||||
|
||||
if (self.isPlaying(player)) {
|
||||
|
@ -1027,10 +1021,8 @@ class PlaybackManager {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (item.LocationType === 'Virtual') {
|
||||
if (itemType !== 'Program') {
|
||||
return false;
|
||||
}
|
||||
if (item.LocationType === 'Virtual' && itemType !== 'Program') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemType === 'Program') {
|
||||
|
@ -3300,10 +3292,10 @@ class PlaybackManager {
|
|||
reportPlayback(self, state, player, reportPlaylist, serverId, 'reportPlaybackProgress', progressEventName);
|
||||
}
|
||||
|
||||
if (streamInfo && streamInfo.liveStreamId) {
|
||||
if (new Date().getTime() - (streamInfo.lastMediaInfoQuery || 0) >= 600000) {
|
||||
getLiveStreamMediaInfo(player, streamInfo, self.currentMediaSource(player), streamInfo.liveStreamId, serverId);
|
||||
}
|
||||
if (streamInfo?.liveStreamId
|
||||
&& (new Date().getTime() - (streamInfo.lastMediaInfoQuery || 0) >= 600000)
|
||||
) {
|
||||
getLiveStreamMediaInfo(player, streamInfo, self.currentMediaSource(player), streamInfo.liveStreamId, serverId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3568,10 +3560,8 @@ class PlaybackManager {
|
|||
}
|
||||
|
||||
getBufferedRanges(player = this._currentPlayer) {
|
||||
if (player) {
|
||||
if (player.getBufferedRanges) {
|
||||
return player.getBufferedRanges();
|
||||
}
|
||||
if (player?.getBufferedRanges) {
|
||||
return player.getBufferedRanges();
|
||||
}
|
||||
|
||||
return [];
|
||||
|
@ -3842,19 +3832,15 @@ class PlaybackManager {
|
|||
|
||||
removeActivePlayer(name) {
|
||||
const playerInfo = this.getPlayerInfo();
|
||||
if (playerInfo) {
|
||||
if (playerInfo.name === name) {
|
||||
this.setDefaultPlayerActive();
|
||||
}
|
||||
if (playerInfo?.name === name) {
|
||||
this.setDefaultPlayerActive();
|
||||
}
|
||||
}
|
||||
|
||||
removeActiveTarget(id) {
|
||||
const playerInfo = this.getPlayerInfo();
|
||||
if (playerInfo) {
|
||||
if (playerInfo.id === id) {
|
||||
this.setDefaultPlayerActive();
|
||||
}
|
||||
if (playerInfo?.id === id) {
|
||||
this.setDefaultPlayerActive();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,8 @@ function mirrorIfEnabled(info) {
|
|||
if (info && playbackManager.enableDisplayMirroring()) {
|
||||
const getPlayerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
if (getPlayerInfo) {
|
||||
if (!getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
|
||||
mirrorItem(info, playbackManager.getCurrentPlayer());
|
||||
}
|
||||
if (getPlayerInfo && !getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
|
||||
mirrorItem(info, playbackManager.getCurrentPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,11 +83,9 @@ function getIcon(target) {
|
|||
export function show(button) {
|
||||
const currentPlayerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
if (currentPlayerInfo) {
|
||||
if (!currentPlayerInfo.isLocalPlayer) {
|
||||
showActivePlayerMenu(currentPlayerInfo);
|
||||
return;
|
||||
}
|
||||
if (currentPlayerInfo && !currentPlayerInfo.isLocalPlayer) {
|
||||
showActivePlayerMenu(currentPlayerInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
const currentPlayerId = currentPlayerInfo ? currentPlayerInfo.id : null;
|
||||
|
|
|
@ -106,10 +106,8 @@ function getIndicatorIcon(item) {
|
|||
return 'fiber_manual_record';
|
||||
}
|
||||
|
||||
if (item.SeriesTimerId) {
|
||||
if (status !== 'Cancelled') {
|
||||
return 'fiber_smart_record';
|
||||
}
|
||||
if (item.SeriesTimerId && status !== 'Cancelled') {
|
||||
return 'fiber_smart_record';
|
||||
}
|
||||
|
||||
return 'fiber_manual_record';
|
||||
|
|
|
@ -63,15 +63,10 @@ function onTimerChangedExternally(e, apiClient, data) {
|
|||
const options = this.options;
|
||||
let refresh = false;
|
||||
|
||||
if (data.Id) {
|
||||
if (this.TimerId === data.Id) {
|
||||
refresh = true;
|
||||
}
|
||||
}
|
||||
if (data.ProgramId && options) {
|
||||
if (options.programId === data.ProgramId) {
|
||||
refresh = true;
|
||||
}
|
||||
if (data.Id && this.TimerId === data.Id) {
|
||||
refresh = true;
|
||||
} else if (data.ProgramId && options && options.programId === data.ProgramId) {
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
|
@ -83,15 +78,11 @@ function onSeriesTimerChangedExternally(e, apiClient, data) {
|
|||
const options = this.options;
|
||||
let refresh = false;
|
||||
|
||||
if (data.Id) {
|
||||
if (this.SeriesTimerId === data.Id) {
|
||||
refresh = true;
|
||||
}
|
||||
if (data.Id && this.SeriesTimerId === data.Id) {
|
||||
refresh = true;
|
||||
}
|
||||
if (data.ProgramId && options) {
|
||||
if (options.programId === data.ProgramId) {
|
||||
refresh = true;
|
||||
}
|
||||
if (data.ProgramId && options && options.programId === data.ProgramId) {
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
|
|
|
@ -46,11 +46,9 @@ function getImageUrl(item, options, apiClient) {
|
|||
return apiClient.getScaledImageUrl(item.Id, options);
|
||||
}
|
||||
|
||||
if (options.type === 'Primary') {
|
||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
options.tag = item.AlbumPrimaryImageTag;
|
||||
return apiClient.getScaledImageUrl(item.AlbumId, options);
|
||||
}
|
||||
if (options.type === 'Primary' && item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
options.tag = item.AlbumPrimaryImageTag;
|
||||
return apiClient.getScaledImageUrl(item.AlbumId, options);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -114,10 +114,8 @@ function fillSubtitleList(context, item) {
|
|||
itemHtml += '</a>';
|
||||
itemHtml += '</div>';
|
||||
|
||||
if (!layoutManager.tv) {
|
||||
if (s.Path) {
|
||||
itemHtml += '<button is="paper-icon-button-light" data-index="' + s.Index + '" title="' + globalize.translate('Delete') + '" class="btnDelete listItemButton"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
||||
}
|
||||
if (!layoutManager.tv && s.Path) {
|
||||
itemHtml += '<button is="paper-icon-button-light" data-index="' + s.Index + '" title="' + globalize.translate('Delete') + '" class="btnDelete listItemButton"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
||||
}
|
||||
|
||||
itemHtml += '</' + tagName + '>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue