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

Fix apiclient imports

This commit is contained in:
Bill Thornton 2020-09-08 02:05:02 -04:00 committed by vitorsemeano
parent 7d9208e951
commit a71b0314d4
71 changed files with 424 additions and 425 deletions

View file

@ -2,7 +2,7 @@ import loading from '../../components/loading/loading';
import keyboardnavigation from '../../scripts/keyboardNavigation';
import dialogHelper from '../../components/dialogHelper/dialogHelper';
import dom from '../../scripts/dom';
import { ConnectionManager, events } from 'jellyfin-apiclient';
import { ConnectionManager, Events } from 'jellyfin-apiclient';
import './style.css';
import 'material-design-icons-iconfont';
import '../../elements/emby-button/paper-icon-button-light';
@ -289,7 +289,7 @@ export class BookPlayer {
epubElem.style.display = 'block';
rendition.on('relocated', (locations) => {
this.progress = book.locations.percentageFromCfi(locations.start.cfi);
events.trigger(this, 'timeupdate');
Events.trigger(this, 'timeupdate');
});
loading.hide();

View file

@ -1,4 +1,4 @@
import events from 'events';
import { Events, ConnectionManager } from 'jellyfin-apiclient';
// LinkParser
//
@ -221,8 +221,8 @@ function getCachedValue(key) {
return null;
}
events.on(window.connectionManager, 'localusersignedin', clearCache);
events.on(window.connectionManager, 'localusersignedout', clearCache);
Events.on(ConnectionManager, 'localusersignedin', clearCache);
Events.on(ConnectionManager, 'localusersignedout', clearCache);
export default {
getServerAddress: getServerAddress

View file

@ -2,7 +2,7 @@ import appSettings from '../../scripts/settings/appSettings';
import * as userSettings from '../../scripts/settings/userSettings';
import { playbackManager } from '../../components/playback/playbackmanager';
import globalize from '../../scripts/globalize';
import { ConnectionManager, events } from 'jellyfin-apiclient';
import { ConnectionManager, Events } from 'jellyfin-apiclient';
import castSenderApiLoader from '../../components/castSenderApi';
// Based on https://github.com/googlecast/CastVideos-chrome/blob/master/CastVideos.js
@ -167,7 +167,7 @@ class CastPlayer {
alertText(globalize.translate('MessageChromecastConnectionError'), globalize.translate('HeaderError'));
}, 300);
} else if (message.type) {
events.trigger(this, message.type, [message.data]);
Events.trigger(this, message.type, [message.data]);
}
}
@ -236,7 +236,7 @@ class CastPlayer {
document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
events.trigger(this, 'connect');
Events.trigger(this, 'connect');
this.sendMessage({
options: {},
command: 'Identify'
@ -495,11 +495,11 @@ function getItemsForPlayback(apiClient, query) {
}
function bindEventForRelay(instance, eventName) {
events.on(instance._castPlayer, eventName, function (e, data) {
Events.on(instance._castPlayer, eventName, function (e, data) {
console.debug('cc: ' + eventName);
const state = instance.getPlayerStateInternal(data);
events.trigger(instance, eventName, [state]);
Events.trigger(instance, eventName, [state]);
});
}
@ -514,7 +514,7 @@ function initializeChromecast() {
}
}));
events.on(instance._castPlayer, 'connect', function (e) {
Events.on(instance._castPlayer, 'connect', function (e) {
if (currentResolve) {
sendConnectionResult(true);
} else {
@ -526,20 +526,20 @@ function initializeChromecast() {
instance.lastPlayerData = null;
});
events.on(instance._castPlayer, 'playbackstart', function (e, data) {
Events.on(instance._castPlayer, 'playbackstart', function (e, data) {
console.debug('cc: playbackstart');
instance._castPlayer.initializeCastPlayer();
const state = instance.getPlayerStateInternal(data);
events.trigger(instance, 'playbackstart', [state]);
Events.trigger(instance, 'playbackstart', [state]);
});
events.on(instance._castPlayer, 'playbackstop', function (e, data) {
Events.on(instance._castPlayer, 'playbackstop', function (e, data) {
console.debug('cc: playbackstop');
let state = instance.getPlayerStateInternal(data);
events.trigger(instance, 'playbackstop', [state]);
Events.trigger(instance, 'playbackstop', [state]);
state = instance.lastPlayerData.PlayState || {};
const volume = state.VolumeLevel || 0.5;
@ -552,11 +552,11 @@ function initializeChromecast() {
instance.lastPlayerData.PlayState.IsMuted = mute;
});
events.on(instance._castPlayer, 'playbackprogress', function (e, data) {
Events.on(instance._castPlayer, 'playbackprogress', function (e, data) {
console.debug('cc: positionchange');
const state = instance.getPlayerStateInternal(data);
events.trigger(instance, 'timeupdate', [state]);
Events.trigger(instance, 'timeupdate', [state]);
});
bindEventForRelay(instance, 'timeupdate');
@ -566,11 +566,11 @@ function initializeChromecast() {
bindEventForRelay(instance, 'repeatmodechange');
bindEventForRelay(instance, 'shufflequeuemodechange');
events.on(instance._castPlayer, 'playstatechange', function (e, data) {
Events.on(instance._castPlayer, 'playstatechange', function (e, data) {
console.debug('cc: playstatechange');
const state = instance.getPlayerStateInternal(data);
events.trigger(instance, 'pause', [state]);
Events.trigger(instance, 'pause', [state]);
});
}
@ -664,7 +664,7 @@ class ChromecastPlayer {
console.debug(JSON.stringify(data));
if (triggerStateChange) {
events.trigger(this, 'statechange', [data]);
Events.trigger(this, 'statechange', [data]);
}
return data;

View file

@ -1,4 +1,4 @@
import { events } from 'jellyfin-apiclient';
import { Events } from 'jellyfin-apiclient';
import browser from '../../scripts/browser';
import { appHost } from '../../components/apphost';
import * as htmlMediaHelper from '../../components/htmlMediaHelper';
@ -251,14 +251,14 @@ class HtmlAudioPlayer {
// Don't trigger events after user stop
if (!self._isFadingOut) {
self._currentTime = time;
events.trigger(self, 'timeupdate');
Events.trigger(self, 'timeupdate');
}
}
function onVolumeChange() {
if (!self._isFadingOut) {
htmlMediaHelper.saveVolume(this.volume);
events.trigger(self, 'volumechange');
Events.trigger(self, 'volumechange');
}
}
@ -269,19 +269,19 @@ class HtmlAudioPlayer {
htmlMediaHelper.seekOnPlaybackStart(self, e.target, self._currentPlayOptions.playerStartPositionTicks);
}
events.trigger(self, 'playing');
Events.trigger(self, 'playing');
}
function onPlay(e) {
events.trigger(self, 'unpause');
Events.trigger(self, 'unpause');
}
function onPause() {
events.trigger(self, 'pause');
Events.trigger(self, 'pause');
}
function onWaiting() {
events.trigger(self, 'waiting');
Events.trigger(self, 'waiting');
}
function onError() {

View file

@ -1,5 +1,5 @@
import browser from '../../scripts/browser';
import { ConnectionManager, events } from 'jellyfin-apiclient';
import { ConnectionManager, Events } from 'jellyfin-apiclient';
import { appHost } from '../../components/apphost';
import loading from '../../components/loading/loading';
import dom from '../../scripts/dom';
@ -286,7 +286,7 @@ function tryRemoveElement(elem) {
incrementFetchQueue() {
if (this.#fetchQueue <= 0) {
this.isFetching = true;
events.trigger(this, 'beginFetch');
Events.trigger(this, 'beginFetch');
}
this.#fetchQueue++;
@ -300,7 +300,7 @@ function tryRemoveElement(elem) {
if (this.#fetchQueue <= 0) {
this.isFetching = false;
events.trigger(this, 'endFetch');
Events.trigger(this, 'endFetch');
}
}
@ -754,7 +754,7 @@ function tryRemoveElement(elem) {
this.updateSubtitleText(timeMs);
}
events.trigger(this, 'timeupdate');
Events.trigger(this, 'timeupdate');
};
/**
@ -767,7 +767,7 @@ function tryRemoveElement(elem) {
*/
const elem = e.target;
saveVolume(elem.volume);
events.trigger(this, 'volumechange');
Events.trigger(this, 'volumechange');
};
/**
@ -826,14 +826,14 @@ function tryRemoveElement(elem) {
this.onStartedAndNavigatedToOsd();
}
}
events.trigger(this, 'playing');
Events.trigger(this, 'playing');
};
/**
* @private
*/
onPlay = () => {
events.trigger(this, 'unpause');
Events.trigger(this, 'unpause');
};
/**
@ -859,25 +859,25 @@ function tryRemoveElement(elem) {
* @private
*/
onClick = () => {
events.trigger(this, 'click');
Events.trigger(this, 'click');
};
/**
* @private
*/
onDblClick = () => {
events.trigger(this, 'dblclick');
Events.trigger(this, 'dblclick');
};
/**
* @private
*/
onPause = () => {
events.trigger(this, 'pause');
Events.trigger(this, 'pause');
};
onWaiting() {
events.trigger(this, 'waiting');
Events.trigger(this, 'waiting');
}
/**
@ -1561,7 +1561,7 @@ function tryRemoveElement(elem) {
elem.style['-webkit-filter'] = `brightness(${cssValue})`;
elem.style.filter = `brightness(${cssValue})`;
elem.brightnessValue = val;
events.trigger(this, 'brightnesschange');
Events.trigger(this, 'brightnesschange');
}
}

View file

@ -1,5 +1,5 @@
import { playbackManager } from '../../components/playback/playbackmanager';
import { ConnectionManager, events } from 'jellyfin-apiclient';
import { ConnectionManager, Events } from 'jellyfin-apiclient';
import serverNotifications from '../../scripts/serverNotifications';
function getActivePlayerId() {
@ -104,7 +104,7 @@ function processUpdatedSessions(instance, sessions, apiClient) {
instance.lastPlayerData = session;
for (let i = 0, length = eventNames.length; i < length; i++) {
events.trigger(instance, eventNames[i], [session]);
Events.trigger(instance, eventNames[i], [session]);
}
} else {
instance.lastPlayerData = session;
@ -186,7 +186,7 @@ class SessionPlayer {
this.isLocalPlayer = false;
this.id = 'remoteplayer';
events.on(serverNotifications, 'Sessions', function (e, apiClient, data) {
Events.on(serverNotifications, 'Sessions', function (e, apiClient, data) {
processUpdatedSessions(self, data, apiClient);
});
}

View file

@ -1,4 +1,4 @@
import { events } from 'jellyfin-apiclient';
import { Events } from 'jellyfin-apiclient';
import browser from '../../scripts/browser';
import { appRouter } from '../../components/appRouter';
import loading from '../../components/loading/loading';
@ -80,7 +80,7 @@ function onEndedInternal(instance) {
src: instance._currentSrc
};
events.trigger(instance, 'stopped', [stopInfo]);
Events.trigger(instance, 'stopped', [stopInfo]);
instance._currentSrc = null;
if (instance.currentYoutubePlayer) {
@ -95,7 +95,7 @@ function onPlayerReady(event) {
}
function onTimeUpdate(e) {
events.trigger(this, 'timeupdate');
Events.trigger(this, 'timeupdate');
}
function onPlaying(instance, playOptions, resolve) {
@ -139,7 +139,7 @@ function setCurrentSrc(instance, elem, options) {
} else if (event.data === YT.PlayerState.ENDED) {
onEndedInternal(instance);
} else if (event.data === YT.PlayerState.PAUSED) {
events.trigger(instance, 'pause');
Events.trigger(instance, 'pause');
}
}
},
@ -276,7 +276,7 @@ class YoutubePlayer {
// This needs a delay before the youtube player will report the correct player state
setTimeout(function () {
events.trigger(instance, 'pause');
Events.trigger(instance, 'pause');
}, 200);
}
}
@ -290,7 +290,7 @@ class YoutubePlayer {
// This needs a delay before the youtube player will report the correct player state
setTimeout(function () {
events.trigger(instance, 'unpause');
Events.trigger(instance, 'unpause');
}, 200);
}
}