Fix eslint issues

This commit is contained in:
Bill Thornton 2023-03-29 00:38:22 -04:00
parent ed21a8dcdd
commit 6f3aa2f1df
85 changed files with 251 additions and 251 deletions

View file

@ -366,20 +366,20 @@ export const appHost = {
}; };
}, },
deviceName: function () { deviceName: function () {
return window.NativeShell?.AppHost?.deviceName return window.NativeShell?.AppHost?.deviceName ?
? window.NativeShell.AppHost.deviceName() : getDeviceName(); window.NativeShell.AppHost.deviceName() : getDeviceName();
}, },
deviceId: function () { deviceId: function () {
return window.NativeShell?.AppHost?.deviceId return window.NativeShell?.AppHost?.deviceId ?
? window.NativeShell.AppHost.deviceId() : getDeviceId(); window.NativeShell.AppHost.deviceId() : getDeviceId();
}, },
appName: function () { appName: function () {
return window.NativeShell?.AppHost?.appName return window.NativeShell?.AppHost?.appName ?
? window.NativeShell.AppHost.appName() : appName; window.NativeShell.AppHost.appName() : appName;
}, },
appVersion: function () { appVersion: function () {
return window.NativeShell?.AppHost?.appVersion return window.NativeShell?.AppHost?.appVersion ?
? window.NativeShell.AppHost.appVersion() : Package.version; window.NativeShell.AppHost.appVersion() : Package.version;
}, },
getPushTokenInfo: function () { getPushTokenInfo: function () {
return {}; return {};

View file

@ -26,8 +26,8 @@ import Events from '../utils/events.ts';
function canPlayNativeHls() { function canPlayNativeHls() {
const media = document.createElement('video'); const media = document.createElement('video');
return !!(media.canPlayType('application/x-mpegURL').replace(/no/, '') || return !!(media.canPlayType('application/x-mpegURL').replace(/no/, '')
media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, '')); || media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, ''));
} }
export function enableHlsJsPlayer(runTimeTicks, mediaType) { export function enableHlsJsPlayer(runTimeTicks, mediaType) {
@ -201,8 +201,8 @@ import Events from '../utils/events.ts';
.catch((e) => { .catch((e) => {
const errorName = (e.name || '').toLowerCase(); const errorName = (e.name || '').toLowerCase();
// safari uses aborterror // safari uses aborterror
if (errorName === 'notallowederror' || if (errorName === 'notallowederror'
errorName === 'aborterror') { || errorName === 'aborterror') {
// swallow this error because the user can still click the play button on the video element // swallow this error because the user can still click the play button on the video element
return Promise.resolve(); return Promise.resolve();
} }

View file

@ -588,12 +588,12 @@ import template from './metadataEditor.template.html';
hideElement('#collapsibleSpecialEpisodeInfo', context); hideElement('#collapsibleSpecialEpisodeInfo', context);
} }
if (item.Type === 'Person' || if (item.Type === 'Person'
item.Type === 'Genre' || || item.Type === 'Genre'
item.Type === 'Studio' || || item.Type === 'Studio'
item.Type === 'MusicGenre' || || item.Type === 'MusicGenre'
item.Type === 'TvChannel' || || item.Type === 'TvChannel'
item.Type === 'Book') { || item.Type === 'Book') {
hideElement('#peopleCollapsible', context); hideElement('#peopleCollapsible', context);
} else { } else {
showElement('#peopleCollapsible', context); showElement('#peopleCollapsible', context);

View file

@ -85,8 +85,8 @@ const SearchFields: FunctionComponent<SearchFieldsProps> = ({ onSearch = () => {
dangerouslySetInnerHTML={createInputElement()} dangerouslySetInnerHTML={createInputElement()}
/> />
</div> </div>
{layoutManager.tv && !browser.tv && {layoutManager.tv && !browser.tv
<AlphaPicker onAlphaPicked={onAlphaPicked} /> && <AlphaPicker onAlphaPicked={onAlphaPicked} />
} }
</div> </div>
); );

View file

@ -94,9 +94,9 @@ function init(instance) {
subtitleSyncSlider.getBubbleHtml = function (value) { subtitleSyncSlider.getBubbleHtml = function (value) {
const newOffset = getOffsetFromPercentage(value); const newOffset = getOffsetFromPercentage(value);
return '<h1 class="sliderBubbleText">' + return '<h1 class="sliderBubbleText">'
(newOffset > 0 ? '+' : '') + parseFloat(newOffset) + 's' + + (newOffset > 0 ? '+' : '') + parseFloat(newOffset) + 's'
'</h1>'; + '</h1>';
}; };
subtitleSyncCloseButton.addEventListener('click', function () { subtitleSyncCloseButton.addEventListener('click', function () {

View file

@ -896,8 +896,8 @@ import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components
const state = playbackManager.getPlayerState(player); const state = playbackManager.getPlayerState(player);
// show subtitle offset feature only if player and media support it // show subtitle offset feature only if player and media support it
const showSubOffset = playbackManager.supportSubtitleOffset(player) && const showSubOffset = playbackManager.supportSubtitleOffset(player)
playbackManager.canHandleOffsetOnCurrentSubtitle(player); && playbackManager.canHandleOffsetOnCurrentSubtitle(player);
playerSettingsMenu.show({ playerSettingsMenu.show({
mediaType: 'Video', mediaType: 'Video',

View file

@ -229,8 +229,8 @@ const Scroller: FC<ScrollerProps> = ({
return ( return (
<> <>
{ {
showControls && scrollState.scrollWidth > scrollState.scrollSize + 20 && showControls && scrollState.scrollWidth > scrollState.scrollSize + 20
<ScrollButtons && <ScrollButtons
scrollRef={scrollRef} scrollRef={scrollRef}
scrollerFactoryRef={scrollerFactoryRef} scrollerFactoryRef={scrollerFactoryRef}
scrollState={scrollState} scrollState={scrollState}

View file

@ -133,9 +133,9 @@ class PlaybackCore {
*/ */
async sendBufferingRequest(isBuffering = true) { async sendBufferingRequest(isBuffering = true) {
const playerWrapper = this.manager.getPlayerWrapper(); const playerWrapper = this.manager.getPlayerWrapper();
const currentPosition = (playerWrapper.currentTimeAsync const currentPosition = (playerWrapper.currentTimeAsync ?
? await playerWrapper.currentTimeAsync() await playerWrapper.currentTimeAsync() :
: playerWrapper.currentTime()); playerWrapper.currentTime());
const currentPositionTicks = Math.round(currentPosition * Helper.TicksPerMillisecond); const currentPositionTicks = Math.round(currentPosition * Helper.TicksPerMillisecond);
const isPlaying = playerWrapper.isPlaying(); const isPlaying = playerWrapper.isPlaying();
@ -172,11 +172,11 @@ class PlaybackCore {
*/ */
async applyCommand(command) { async applyCommand(command) {
// Check if duplicate. // Check if duplicate.
if (this.lastCommand && if (this.lastCommand
this.lastCommand.When.getTime() === command.When.getTime() && && this.lastCommand.When.getTime() === command.When.getTime()
this.lastCommand.PositionTicks === command.PositionTicks && && this.lastCommand.PositionTicks === command.PositionTicks
this.lastCommand.Command === command.Command && && this.lastCommand.Command === command.Command
this.lastCommand.PlaylistItemId === command.PlaylistItemId && this.lastCommand.PlaylistItemId === command.PlaylistItemId
) { ) {
// Duplicate command found, check playback state and correct if needed. // Duplicate command found, check playback state and correct if needed.
console.debug('SyncPlay applyCommand: duplicate command received!', command); console.debug('SyncPlay applyCommand: duplicate command received!', command);
@ -192,9 +192,9 @@ class PlaybackCore {
} else { } else {
// Check if playback state matches requested command. // Check if playback state matches requested command.
const playerWrapper = this.manager.getPlayerWrapper(); const playerWrapper = this.manager.getPlayerWrapper();
const currentPositionTicks = Math.round((playerWrapper.currentTimeAsync const currentPositionTicks = Math.round((playerWrapper.currentTimeAsync ?
? await playerWrapper.currentTimeAsync() await playerWrapper.currentTimeAsync() :
: playerWrapper.currentTime()) * Helper.TicksPerMillisecond); playerWrapper.currentTime()) * Helper.TicksPerMillisecond);
const isPlaying = playerWrapper.isPlaying(); const isPlaying = playerWrapper.isPlaying();
switch (command.Command) { switch (command.Command) {
@ -279,9 +279,9 @@ class PlaybackCore {
const playAtTimeLocal = this.timeSyncCore.remoteDateToLocal(playAtTime); const playAtTimeLocal = this.timeSyncCore.remoteDateToLocal(playAtTime);
const playerWrapper = this.manager.getPlayerWrapper(); const playerWrapper = this.manager.getPlayerWrapper();
const currentPositionTicks = (playerWrapper.currentTimeAsync const currentPositionTicks = (playerWrapper.currentTimeAsync ?
? await playerWrapper.currentTimeAsync() await playerWrapper.currentTimeAsync() :
: playerWrapper.currentTime()) * Helper.TicksPerMillisecond; playerWrapper.currentTime()) * Helper.TicksPerMillisecond;
if (playAtTimeLocal > currentTime) { if (playAtTimeLocal > currentTime) {
const playTimeout = playAtTimeLocal - currentTime; const playTimeout = playAtTimeLocal - currentTime;

View file

@ -174,9 +174,9 @@ class QueueCore {
const currentTime = new Date(); const currentTime = new Date();
const now = this.manager.timeSyncCore.localDateToRemote(currentTime); const now = this.manager.timeSyncCore.localDateToRemote(currentTime);
const currentPosition = (playerWrapper.currentTimeAsync const currentPosition = (playerWrapper.currentTimeAsync ?
? await playerWrapper.currentTimeAsync() await playerWrapper.currentTimeAsync() :
: playerWrapper.currentTime()); playerWrapper.currentTime());
const currentPositionTicks = Math.round(currentPosition * Helper.TicksPerMillisecond); const currentPositionTicks = Math.round(currentPosition * Helper.TicksPerMillisecond);
const isPlaying = playerWrapper.isPlaying(); const isPlaying = playerWrapper.isPlaying();

View file

@ -19,8 +19,8 @@ const Search: FunctionComponent = () => {
className='mainAnimatedPage libraryPage allLibraryPage noSecondaryNavPage' className='mainAnimatedPage libraryPage allLibraryPage noSecondaryNavPage'
> >
<SearchFields onSearch={setQuery} /> <SearchFields onSearch={setQuery} />
{!query && {!query
<SearchSuggestions && <SearchSuggestions
parentId={searchParams.get('parentId')} parentId={searchParams.get('parentId')}
/> />
} }

View file

@ -187,25 +187,25 @@ function supportsCssAnimation(allowPrefix) {
const uaMatch = function (ua) { const uaMatch = function (ua) {
ua = ua.toLowerCase(); ua = ua.toLowerCase();
const match = /(edg)[ /]([\w.]+)/.exec(ua) || const match = /(edg)[ /]([\w.]+)/.exec(ua)
/(edga)[ /]([\w.]+)/.exec(ua) || || /(edga)[ /]([\w.]+)/.exec(ua)
/(edgios)[ /]([\w.]+)/.exec(ua) || || /(edgios)[ /]([\w.]+)/.exec(ua)
/(edge)[ /]([\w.]+)/.exec(ua) || || /(edge)[ /]([\w.]+)/.exec(ua)
/(opera)[ /]([\w.]+)/.exec(ua) || || /(opera)[ /]([\w.]+)/.exec(ua)
/(opr)[ /]([\w.]+)/.exec(ua) || || /(opr)[ /]([\w.]+)/.exec(ua)
/(chrome)[ /]([\w.]+)/.exec(ua) || || /(chrome)[ /]([\w.]+)/.exec(ua)
/(safari)[ /]([\w.]+)/.exec(ua) || || /(safari)[ /]([\w.]+)/.exec(ua)
/(firefox)[ /]([\w.]+)/.exec(ua) || || /(firefox)[ /]([\w.]+)/.exec(ua)
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)
[]; || [];
const versionMatch = /(version)[ /]([\w.]+)/.exec(ua); const versionMatch = /(version)[ /]([\w.]+)/.exec(ua);
let platform_match = /(ipad)/.exec(ua) || let platform_match = /(ipad)/.exec(ua)
/(iphone)/.exec(ua) || || /(iphone)/.exec(ua)
/(windows)/.exec(ua) || || /(windows)/.exec(ua)
/(android)/.exec(ua) || || /(android)/.exec(ua)
[]; || [];
let browser = match[1] || ''; let browser = match[1] || '';

View file

@ -17,11 +17,11 @@ import browser from './browser';
} }
// hevc main level 4.0 // hevc main level 4.0
return !!videoTestElement.canPlayType && return !!videoTestElement.canPlayType
(videoTestElement.canPlayType('video/mp4; codecs="hvc1.1.L120"').replace(/no/, '') || && (videoTestElement.canPlayType('video/mp4; codecs="hvc1.1.L120"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hev1.1.L120"').replace(/no/, '') || || videoTestElement.canPlayType('video/mp4; codecs="hev1.1.L120"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hvc1.1.0.L120"').replace(/no/, '') || || videoTestElement.canPlayType('video/mp4; codecs="hvc1.1.0.L120"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hev1.1.0.L120"').replace(/no/, '')); || videoTestElement.canPlayType('video/mp4; codecs="hev1.1.0.L120"').replace(/no/, ''));
} }
let _supportsTextTracks; let _supportsTextTracks;
@ -53,8 +53,8 @@ import browser from './browser';
} }
const media = document.createElement('video'); const media = document.createElement('video');
return !!(media.canPlayType('application/x-mpegURL').replace(/no/, '') || return !!(media.canPlayType('application/x-mpegURL').replace(/no/, '')
media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, '')); || media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, ''));
} }
function canPlayHlsWithMSE() { function canPlayHlsWithMSE() {
@ -96,8 +96,8 @@ import browser from './browser';
} }
if (videoTestElement.canPlayType) { if (videoTestElement.canPlayType) {
return videoTestElement.canPlayType('application/x-mpegurl; codecs="avc1.42E01E, ac-3"').replace(/no/, '') || return videoTestElement.canPlayType('application/x-mpegurl; codecs="avc1.42E01E, ac-3"').replace(/no/, '')
videoTestElement.canPlayType('application/vnd.apple.mpegURL; codecs="avc1.42E01E, ac-3"').replace(/no/, ''); || videoTestElement.canPlayType('application/vnd.apple.mpegURL; codecs="avc1.42E01E, ac-3"').replace(/no/, '');
} }
return false; return false;
@ -146,8 +146,8 @@ import browser from './browser';
return true; return true;
} }
if (videoTestElement.canPlayType('video/x-matroska').replace(/no/, '') || if (videoTestElement.canPlayType('video/x-matroska').replace(/no/, '')
videoTestElement.canPlayType('video/mkv').replace(/no/, '')) { || videoTestElement.canPlayType('video/mkv').replace(/no/, '')) {
return true; return true;
} }
@ -815,19 +815,19 @@ export function canPlaySecondaryAudio(videoTestElement) {
let maxH264Level = 42; let maxH264Level = 42;
let h264Profiles = 'high|main|baseline|constrained baseline'; let h264Profiles = 'high|main|baseline|constrained baseline';
if (browser.tizen || browser.web0s || if (browser.tizen || browser.web0s
videoTestElement.canPlayType('video/mp4; codecs="avc1.640833"').replace(/no/, '')) { || videoTestElement.canPlayType('video/mp4; codecs="avc1.640833"').replace(/no/, '')) {
maxH264Level = 51; maxH264Level = 51;
} }
// Support H264 Level 52 (Tizen 5.0) - app only // Support H264 Level 52 (Tizen 5.0) - app only
if ((browser.tizenVersion >= 5 && window.NativeShell) || if ((browser.tizenVersion >= 5 && window.NativeShell)
videoTestElement.canPlayType('video/mp4; codecs="avc1.640834"').replace(/no/, '')) { || videoTestElement.canPlayType('video/mp4; codecs="avc1.640834"').replace(/no/, '')) {
maxH264Level = 52; maxH264Level = 52;
} }
if ((browser.tizen || if ((browser.tizen
videoTestElement.canPlayType('video/mp4; codecs="avc1.6e0033"').replace(/no/, '')) || videoTestElement.canPlayType('video/mp4; codecs="avc1.6e0033"').replace(/no/, ''))
// These tests are passing in safari, but playback is failing // These tests are passing in safari, but playback is failing
&& !browser.safari && !browser.iOS && !browser.web0s && !browser.edge && !browser.mobile && !browser.safari && !browser.iOS && !browser.web0s && !browser.edge && !browser.mobile
) { ) {
@ -838,28 +838,28 @@ export function canPlaySecondaryAudio(videoTestElement) {
let hevcProfiles = 'main'; let hevcProfiles = 'main';
// hevc main level 4.1 // hevc main level 4.1
if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.1.4.L123"').replace(/no/, '') || if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.1.4.L123"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hev1.1.4.L123"').replace(/no/, '')) { || videoTestElement.canPlayType('video/mp4; codecs="hev1.1.4.L123"').replace(/no/, '')) {
maxHevcLevel = 123; maxHevcLevel = 123;
} }
// hevc main10 level 4.1 // hevc main10 level 4.1
if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.2.4.L123"').replace(/no/, '') || if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.2.4.L123"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hev1.2.4.L123"').replace(/no/, '')) { || videoTestElement.canPlayType('video/mp4; codecs="hev1.2.4.L123"').replace(/no/, '')) {
maxHevcLevel = 123; maxHevcLevel = 123;
hevcProfiles = 'main|main 10'; hevcProfiles = 'main|main 10';
} }
// hevc main10 level 5.1 // hevc main10 level 5.1
if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.2.4.L153"').replace(/no/, '') || if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.2.4.L153"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hev1.2.4.L153"').replace(/no/, '')) { || videoTestElement.canPlayType('video/mp4; codecs="hev1.2.4.L153"').replace(/no/, '')) {
maxHevcLevel = 153; maxHevcLevel = 153;
hevcProfiles = 'main|main 10'; hevcProfiles = 'main|main 10';
} }
// hevc main10 level 6.1 // hevc main10 level 6.1
if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.2.4.L183"').replace(/no/, '') || if (videoTestElement.canPlayType('video/mp4; codecs="hvc1.2.4.L183"').replace(/no/, '')
videoTestElement.canPlayType('video/mp4; codecs="hev1.2.4.L183"').replace(/no/, '')) { || videoTestElement.canPlayType('video/mp4; codecs="hev1.2.4.L183"').replace(/no/, '')) {
maxHevcLevel = 183; maxHevcLevel = 183;
hevcProfiles = 'main|main 10'; hevcProfiles = 'main|main 10';
} }