mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
Use connectionManager global
This commit is contained in:
parent
4d540bf9ca
commit
c97d7a6f59
@ -4,7 +4,6 @@ import dom from 'dom';
|
|||||||
import * as datefns from 'date-fns';
|
import * as datefns from 'date-fns';
|
||||||
import dfnshelper from 'dfnshelper';
|
import dfnshelper from 'dfnshelper';
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import 'emby-button';
|
import 'emby-button';
|
||||||
import 'listViewStyle';
|
import 'listViewStyle';
|
||||||
|
|
||||||
@ -141,7 +140,7 @@ class ActivityLog {
|
|||||||
const element = options.element;
|
const element = options.element;
|
||||||
element.classList.add('activityLogListWidget');
|
element.classList.add('activityLogListWidget');
|
||||||
element.addEventListener('click', onListClick.bind(this));
|
element.addEventListener('click', onListClick.bind(this));
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
reloadData(this, element, apiClient);
|
reloadData(this, element, apiClient);
|
||||||
const onUpdate = onActivityLogUpdate.bind(this);
|
const onUpdate = onActivityLogUpdate.bind(this);
|
||||||
this.updateFn = onUpdate;
|
this.updateFn = onUpdate;
|
||||||
@ -153,7 +152,7 @@ class ActivityLog {
|
|||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove('activityLogListWidget');
|
options.element.classList.remove('activityLogListWidget');
|
||||||
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
window.connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
||||||
}
|
}
|
||||||
|
|
||||||
const onUpdate = this.updateFn;
|
const onUpdate = this.updateFn;
|
||||||
|
@ -2,7 +2,6 @@ import appHost from 'apphost';
|
|||||||
import appSettings from 'appSettings';
|
import appSettings from 'appSettings';
|
||||||
import backdrop from 'backdrop';
|
import backdrop from 'backdrop';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import itemHelper from 'itemHelper';
|
import itemHelper from 'itemHelper';
|
||||||
@ -95,7 +94,7 @@ class AppRouter {
|
|||||||
beginConnectionWizard() {
|
beginConnectionWizard() {
|
||||||
backdrop.clearBackdrop();
|
backdrop.clearBackdrop();
|
||||||
loading.show();
|
loading.show();
|
||||||
connectionManager.connect({
|
window.connectionManager.connect({
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
this.handleConnectionResult(result);
|
this.handleConnectionResult(result);
|
||||||
@ -154,7 +153,7 @@ class AppRouter {
|
|||||||
events.on(appHost, 'beforeexit', this.onBeforeExit);
|
events.on(appHost, 'beforeexit', this.onBeforeExit);
|
||||||
events.on(appHost, 'resume', this.onAppResume);
|
events.on(appHost, 'resume', this.onAppResume);
|
||||||
|
|
||||||
connectionManager.connect({
|
window.connectionManager.connect({
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
this.firstConnectionResult = result;
|
this.firstConnectionResult = result;
|
||||||
@ -210,7 +209,7 @@ class AppRouter {
|
|||||||
showItem(item, serverId, options) {
|
showItem(item, serverId, options) {
|
||||||
// TODO: Refactor this so it only gets items, not strings.
|
// TODO: Refactor this so it only gets items, not strings.
|
||||||
if (typeof (item) === 'string') {
|
if (typeof (item) === 'string') {
|
||||||
const apiClient = serverId ? connectionManager.getApiClient(serverId) : connectionManager.currentApiClient();
|
const apiClient = serverId ? window.connectionManager.getApiClient(serverId) : window.connectionManager.currentApiClient();
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), item).then((itemObject) => {
|
apiClient.getItem(apiClient.getCurrentUserId(), item).then((itemObject) => {
|
||||||
this.showItem(itemObject, options);
|
this.showItem(itemObject, options);
|
||||||
});
|
});
|
||||||
@ -492,15 +491,15 @@ class AppRouter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initApiClients() {
|
initApiClients() {
|
||||||
connectionManager.getApiClients().forEach((apiClient) => {
|
window.connectionManager.getApiClients().forEach((apiClient) => {
|
||||||
this.initApiClient(apiClient, this);
|
this.initApiClient(apiClient, this);
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on(connectionManager, 'apiclientcreated', this.onApiClientCreated);
|
events.on(window.connectionManager, 'apiclientcreated', this.onApiClientCreated);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppResume() {
|
onAppResume() {
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
|
|
||||||
if (apiClient) {
|
if (apiClient) {
|
||||||
apiClient.ensureWebSocket();
|
apiClient.ensureWebSocket();
|
||||||
@ -518,7 +517,7 @@ class AppRouter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
const pathname = ctx.pathname.toLowerCase();
|
const pathname = ctx.pathname.toLowerCase();
|
||||||
|
|
||||||
console.debug('appRouter - processing path request ' + pathname);
|
console.debug('appRouter - processing path request ' + pathname);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
@ -177,7 +176,7 @@ import 'css!./backdrop';
|
|||||||
function getItemImageUrls(item, imageOptions) {
|
function getItemImageUrls(item, imageOptions) {
|
||||||
imageOptions = imageOptions || {};
|
imageOptions = imageOptions || {};
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
|
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
|
||||||
return item.BackdropImageTags.map((imgTag, index) => {
|
return item.BackdropImageTags.map((imgTag, index) => {
|
||||||
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
|
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import itemHelper from 'itemHelper';
|
import itemHelper from 'itemHelper';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import indicators from 'indicators';
|
import indicators from 'indicators';
|
||||||
@ -371,7 +370,7 @@ import 'programStyles';
|
|||||||
|
|
||||||
if (serverId !== lastServerId) {
|
if (serverId !== lastServerId) {
|
||||||
lastServerId = serverId;
|
lastServerId = serverId;
|
||||||
apiClient = connectionManager.getApiClient(lastServerId);
|
apiClient = window.connectionManager.getApiClient(lastServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.indexBy) {
|
if (options.indexBy) {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ import browser from 'browser';
|
|||||||
let html = '';
|
let html = '';
|
||||||
let itemsInRow = 0;
|
let itemsInRow = 0;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
for (let i = 0, length = chapters.length; i < length; i++) {
|
for (let i = 0, length = chapters.length; i < length; i++) {
|
||||||
if (options.rows && itemsInRow === 0) {
|
if (options.rows && itemsInRow === 0) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import actionsheet from 'actionsheet';
|
import actionsheet from 'actionsheet';
|
||||||
import 'emby-input';
|
import 'emby-input';
|
||||||
@ -16,7 +15,7 @@ export default class channelMapper {
|
|||||||
function mapChannel(button, channelId, providerChannelId) {
|
function mapChannel(button, channelId, providerChannelId) {
|
||||||
loading.show();
|
loading.show();
|
||||||
const providerId = options.providerId;
|
const providerId = options.providerId;
|
||||||
connectionManager.getApiClient(options.serverId).ajax({
|
window.connectionManager.getApiClient(options.serverId).ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
@ -58,7 +57,7 @@ export default class channelMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getChannelMappingOptions(serverId, providerId) {
|
function getChannelMappingOptions(serverId, providerId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
|
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
|
||||||
providerId: providerId
|
providerId: providerId
|
||||||
}));
|
}));
|
||||||
|
@ -2,7 +2,6 @@ import dom from 'dom';
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
@ -25,7 +24,7 @@ import 'flexStyles';
|
|||||||
|
|
||||||
const collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
const collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
if (collectionId) {
|
if (collectionId) {
|
||||||
addToCollection(apiClient, panel, collectionId);
|
addToCollection(apiClient, panel, collectionId);
|
||||||
@ -106,7 +105,7 @@ import 'flexStyles';
|
|||||||
EnableTotalRecordCount: false
|
EnableTotalRecordCount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import focusManager from 'focusManager';
|
|||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import skinManager from 'skinManager';
|
import skinManager from 'skinManager';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import 'emby-select';
|
import 'emby-select';
|
||||||
@ -182,7 +181,7 @@ import 'emby-button';
|
|||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
@ -221,7 +220,7 @@ import 'emby-button';
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
return apiClient.getUser(userId).then(user => {
|
return apiClient.getUser(userId).then(user => {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
import 'emby-collapse';
|
import 'emby-collapse';
|
||||||
@ -420,7 +419,7 @@ import 'css!./style.css';
|
|||||||
this.bindEvents(dlg);
|
this.bindEvents(dlg);
|
||||||
if (enableDynamicFilters(this.options.mode)) {
|
if (enableDynamicFilters(this.options.mode)) {
|
||||||
dlg.classList.add('dynamicFilterDialog');
|
dlg.classList.add('dynamicFilterDialog');
|
||||||
const apiClient = connectionManager.getApiClient(this.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(this.options.serverId);
|
||||||
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query);
|
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,6 @@ import focusManager from 'focusManager';
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
@ -194,7 +193,7 @@ function initEditor(context, settings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function loadDynamicFilters(context, options) {
|
function loadDynamicFilters(context, options) {
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
var apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
var filterMenuOptions = Object.assign(options.filterMenuOptions, {
|
var filterMenuOptions = Object.assign(options.filterMenuOptions, {
|
||||||
|
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
function onGroupedCardClick(e, card) {
|
function onGroupedCardClick(e, card) {
|
||||||
var itemId = card.getAttribute('data-id');
|
var itemId = card.getAttribute('data-id');
|
||||||
var serverId = card.getAttribute('data-serverid');
|
var serverId = card.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
var apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
var userId = apiClient.getCurrentUserId();
|
var userId = apiClient.getCurrentUserId();
|
||||||
var playedIndicator = card.querySelector('.playedIndicator');
|
var playedIndicator = card.querySelector('.playedIndicator');
|
||||||
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
@ -213,7 +212,7 @@ function Guide(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reloadGuide(context, newStartDate, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) {
|
function reloadGuide(context, newStartDate, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) {
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
const channelQuery = {
|
const channelQuery = {
|
||||||
|
|
||||||
@ -873,7 +872,7 @@ function Guide(options) {
|
|||||||
function reloadPage(page) {
|
function reloadPage(page) {
|
||||||
showLoading();
|
showLoading();
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
apiClient.getLiveTvGuideInfo().then(function (guideInfo) {
|
apiClient.getLiveTvGuideInfo().then(function (guideInfo) {
|
||||||
setDateRange(page, guideInfo);
|
setDateRange(page, guideInfo);
|
||||||
|
@ -2,7 +2,6 @@ import layoutManager from 'layoutManager';
|
|||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import homeSections from 'homeSections';
|
import homeSections from 'homeSections';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
@ -380,7 +379,7 @@ import 'emby-checkbox';
|
|||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
@ -452,7 +451,7 @@ import 'emby-checkbox';
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
apiClient.getUser(userId).then(user => {
|
apiClient.getUser(userId).then(user => {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -212,7 +211,7 @@ import 'css!./homesections';
|
|||||||
|
|
||||||
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
let limit = 16;
|
let limit = 16;
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
@ -368,7 +367,7 @@ import 'css!./homesections';
|
|||||||
|
|
||||||
function getContinueWatchingFetchFn(serverId) {
|
function getContinueWatchingFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
const screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
|
|
||||||
let limit;
|
let limit;
|
||||||
@ -441,7 +440,7 @@ import 'css!./homesections';
|
|||||||
|
|
||||||
function getContinueListeningFetchFn(serverId) {
|
function getContinueListeningFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
const screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
|
|
||||||
let limit;
|
let limit;
|
||||||
@ -514,7 +513,7 @@ import 'css!./homesections';
|
|||||||
|
|
||||||
function getOnNowFetchFn(serverId) {
|
function getOnNowFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getLiveTvRecommendedPrograms({
|
return apiClient.getLiveTvRecommendedPrograms({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
@ -657,7 +656,7 @@ import 'css!./homesections';
|
|||||||
|
|
||||||
function getNextUpFetchFn(serverId) {
|
function getNextUpFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getNextUpEpisodes({
|
return apiClient.getNextUpEpisodes({
|
||||||
Limit: enableScrollX() ? 24 : 15,
|
Limit: enableScrollX() ? 24 : 15,
|
||||||
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
||||||
@ -728,7 +727,7 @@ import 'css!./homesections';
|
|||||||
|
|
||||||
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
||||||
return function () {
|
return function () {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getLiveTvRecordings({
|
return apiClient.getLiveTvRecordings({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
Limit: enableScrollX() ? 12 : 5,
|
Limit: enableScrollX() ? 12 : 5,
|
||||||
|
@ -2,7 +2,6 @@ import dom from 'dom';
|
|||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -317,7 +316,7 @@ import 'cardStyle';
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
import('text!./imageDownloader.template.html').then(({default: template}) => {
|
import('text!./imageDownloader.template.html').then(({default: template}) => {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
currentItemId = itemId;
|
currentItemId = itemId;
|
||||||
currentItemType = itemType;
|
currentItemType = itemType;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
@ -108,7 +107,7 @@ import 'css!./style';
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(() => {
|
window.connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(() => {
|
||||||
dlg.querySelector('#uploadImage').value = '';
|
dlg.querySelector('#uploadImage').value = '';
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -36,10 +35,10 @@ import 'css!./imageeditor';
|
|||||||
let apiClient;
|
let apiClient;
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
apiClient = connectionManager.getApiClient(item.ServerId);
|
apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
reloadItem(page, item, apiClient, focusContext);
|
reloadItem(page, item, apiClient, focusContext);
|
||||||
} else {
|
} else {
|
||||||
apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (item) {
|
||||||
reloadItem(page, item, apiClient, focusContext);
|
reloadItem(page, item, apiClient, focusContext);
|
||||||
});
|
});
|
||||||
@ -293,7 +292,7 @@ import 'css!./imageeditor';
|
|||||||
function showActionSheet(context, imageCard) {
|
function showActionSheet(context, imageCard) {
|
||||||
const itemId = imageCard.getAttribute('data-id');
|
const itemId = imageCard.getAttribute('data-id');
|
||||||
const serverId = imageCard.getAttribute('data-serverid');
|
const serverId = imageCard.getAttribute('data-serverid');
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
const type = imageCard.getAttribute('data-imagetype');
|
const type = imageCard.getAttribute('data-imagetype');
|
||||||
const index = parseInt(imageCard.getAttribute('data-index'));
|
const index = parseInt(imageCard.getAttribute('data-index'));
|
||||||
@ -404,7 +403,7 @@ import 'css!./imageeditor';
|
|||||||
const type = this.getAttribute('data-imagetype');
|
const type = this.getAttribute('data-imagetype');
|
||||||
let index = this.getAttribute('data-index');
|
let index = this.getAttribute('data-index');
|
||||||
index = index === 'null' ? null : parseInt(index);
|
index = index === 'null' ? null : parseInt(index);
|
||||||
const apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
deleteImage(context, currentItem.Id, type, index, apiClient, true);
|
deleteImage(context, currentItem.Id, type, index, apiClient, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -412,7 +411,7 @@ import 'css!./imageeditor';
|
|||||||
const type = this.getAttribute('data-imagetype');
|
const type = this.getAttribute('data-imagetype');
|
||||||
const index = this.getAttribute('data-index');
|
const index = this.getAttribute('data-index');
|
||||||
const newIndex = this.getAttribute('data-newindex');
|
const newIndex = this.getAttribute('data-newindex');
|
||||||
const apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
moveImage(context, apiClient, currentItem.Id, type, index, newIndex, dom.parentWithClass(this, 'itemsContainer'));
|
moveImage(context, apiClient, currentItem.Id, type, index, newIndex, dom.parentWithClass(this, 'itemsContainer'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -424,7 +423,7 @@ import 'css!./imageeditor';
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
import('text!./imageeditor.template.html').then(({default: template}) => {
|
import('text!./imageeditor.template.html').then(({default: template}) => {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||||
const dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true
|
removeOnClose: true
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import itemHelper from 'itemHelper';
|
import itemHelper from 'itemHelper';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
@ -330,7 +329,7 @@ import actionsheet from 'actionsheet';
|
|||||||
function executeCommand(item, id, options) {
|
function executeCommand(item, id, options) {
|
||||||
const itemId = item.Id;
|
const itemId = item.Id;
|
||||||
const serverId = item.ServerId;
|
const serverId = item.ServerId;
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import 'emby-select';
|
import 'emby-select';
|
||||||
import 'listViewStyle';
|
import 'listViewStyle';
|
||||||
@ -137,7 +136,7 @@ import 'flexStyles';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadMediaInfo(itemId, serverId, template) {
|
function loadMediaInfo(itemId, serverId, template) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
|
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
|
||||||
const dialogOptions = {
|
const dialogOptions = {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -31,7 +30,7 @@ import 'cardStyle';
|
|||||||
let currentSearchResult;
|
let currentSearchResult;
|
||||||
|
|
||||||
function getApiClient() {
|
function getApiClient() {
|
||||||
return connectionManager.getApiClient(currentServerId);
|
return window.connectionManager.getApiClient(currentServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchForIdentificationResults(page) {
|
function searchForIdentificationResults(page) {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
import itemHelper from 'itemHelper';
|
import itemHelper from 'itemHelper';
|
||||||
import mediaInfo from 'mediaInfo';
|
import mediaInfo from 'mediaInfo';
|
||||||
import indicators from 'indicators';
|
import indicators from 'indicators';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
@ -77,7 +76,7 @@ import 'emby-playstatebutton';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getImageUrl(item, width) {
|
function getImageUrl(item, width) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
let itemId;
|
let itemId;
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
@ -106,7 +105,7 @@ import 'emby-playstatebutton';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getChannelImageUrl(item, width) {
|
function getChannelImageUrl(item, width) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
const options = {
|
const options = {
|
||||||
maxWidth: width,
|
maxWidth: width,
|
||||||
type: 'Primary'
|
type: 'Primary'
|
||||||
|
@ -4,7 +4,6 @@ import dialogHelper from 'dialogHelper';
|
|||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import shell from 'shell';
|
import shell from 'shell';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
@ -290,7 +289,7 @@ import 'flexStyles';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getApiClient() {
|
function getApiClient() {
|
||||||
return connectionManager.getApiClient(currentItem.ServerId);
|
return window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindAll(elems, eventName, fn) {
|
function bindAll(elems, eventName, fn) {
|
||||||
@ -370,7 +369,7 @@ import 'flexStyles';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getItem(itemId, serverId) {
|
function getItem(itemId, serverId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (itemId) {
|
if (itemId) {
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
|
return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
|
||||||
@ -380,7 +379,7 @@ import 'flexStyles';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEditorConfig(itemId, serverId) {
|
function getEditorConfig(itemId, serverId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (itemId) {
|
if (itemId) {
|
||||||
return apiClient.getJSON(apiClient.getUrl('Items/' + itemId + '/MetadataEditor'));
|
return apiClient.getJSON(apiClient.getUrl('Items/' + itemId + '/MetadataEditor'));
|
||||||
@ -1068,7 +1067,7 @@ import 'flexStyles';
|
|||||||
|
|
||||||
currentContext = dlg;
|
currentContext = dlg;
|
||||||
|
|
||||||
init(dlg, connectionManager.getApiClient(serverId));
|
init(dlg, window.connectionManager.getApiClient(serverId));
|
||||||
|
|
||||||
reload(dlg, itemId, serverId);
|
reload(dlg, itemId, serverId);
|
||||||
});
|
});
|
||||||
@ -1095,7 +1094,7 @@ import 'flexStyles';
|
|||||||
|
|
||||||
currentContext = elem;
|
currentContext = elem;
|
||||||
|
|
||||||
init(elem, connectionManager.getApiClient(serverId));
|
init(elem, window.connectionManager.getApiClient(serverId));
|
||||||
reload(elem, itemId, serverId);
|
reload(elem, itemId, serverId);
|
||||||
|
|
||||||
focusManager.autoFocus(elem);
|
focusManager.autoFocus(elem);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import 'css!./multiSelect';
|
import 'css!./multiSelect';
|
||||||
@ -170,7 +169,7 @@ import 'css!./multiSelect';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showMenuForSelectedItems(e) {
|
function showMenuForSelectedItems(e) {
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
|
|
||||||
apiClient.getCurrentUser().then(user => {
|
apiClient.getCurrentUser().then(user => {
|
||||||
const menuItems = [];
|
const menuItems = [];
|
||||||
|
@ -7,7 +7,6 @@ import playbackManager from 'playbackManager';
|
|||||||
import nowPlayingHelper from 'nowPlayingHelper';
|
import nowPlayingHelper from 'nowPlayingHelper';
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import itemContextMenu from 'itemContextMenu';
|
import itemContextMenu from 'itemContextMenu';
|
||||||
import 'paper-icon-button-light';
|
import 'paper-icon-button-light';
|
||||||
import 'emby-ratingbutton';
|
import 'emby-ratingbutton';
|
||||||
@ -452,7 +451,7 @@ import 'emby-ratingbutton';
|
|||||||
if (item.SeriesPrimaryImageTag) {
|
if (item.SeriesPrimaryImageTag) {
|
||||||
options.tag = item.SeriesPrimaryImageTag;
|
options.tag = item.SeriesPrimaryImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,12 +459,12 @@ import 'emby-ratingbutton';
|
|||||||
if (item.SeriesThumbImageTag) {
|
if (item.SeriesThumbImageTag) {
|
||||||
options.tag = item.SeriesThumbImageTag;
|
options.tag = item.SeriesThumbImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
if (item.ParentThumbImageTag) {
|
if (item.ParentThumbImageTag) {
|
||||||
options.tag = item.ParentThumbImageTag;
|
options.tag = item.ParentThumbImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,12 +481,12 @@ import 'emby-ratingbutton';
|
|||||||
|
|
||||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
options.tag = item.ImageTags[options.type];
|
options.tag = item.ImageTags[options.type];
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
options.tag = item.AlbumPrimaryImageTag;
|
options.tag = item.AlbumPrimaryImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -548,7 +547,7 @@ import 'emby-ratingbutton';
|
|||||||
|
|
||||||
if (nowPlayingItem.Id) {
|
if (nowPlayingItem.Id) {
|
||||||
if (isRefreshing) {
|
if (isRefreshing) {
|
||||||
const apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
|
const apiClient = window.connectionManager.getApiClient(nowPlayingItem.ServerId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
|
||||||
const userData = item.UserData || {};
|
const userData = item.UserData || {};
|
||||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import nowPlayingHelper from 'nowPlayingHelper';
|
import nowPlayingHelper from 'nowPlayingHelper';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
// Reports media playback to the device for lock screen control
|
// Reports media playback to the device for lock screen control
|
||||||
@ -16,16 +15,16 @@ import connectionManager from 'connectionManager';
|
|||||||
} else if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
} else if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
||||||
options.tag = item.SeriesPrimaryImageTag;
|
options.tag = item.SeriesPrimaryImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
} else if (options.type === 'Thumb') {
|
} else if (options.type === 'Thumb') {
|
||||||
if (item.SeriesThumbImageTag) {
|
if (item.SeriesThumbImageTag) {
|
||||||
options.tag = item.SeriesThumbImageTag;
|
options.tag = item.SeriesThumbImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
} else if (item.ParentThumbImageTag) {
|
} else if (item.ParentThumbImageTag) {
|
||||||
options.tag = item.ParentThumbImageTag;
|
options.tag = item.ParentThumbImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,11 +37,11 @@ import connectionManager from 'connectionManager';
|
|||||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
options.tag = item.ImageTags[options.type];
|
options.tag = item.ImageTags[options.type];
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.Id, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.Id, options);
|
||||||
} else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
} else if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
options.tag = item.AlbumPrimaryImageTag;
|
options.tag = item.AlbumPrimaryImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -6,7 +6,6 @@ import pluginManager from 'pluginManager';
|
|||||||
import PlayQueueManager from 'playQueueManager';
|
import PlayQueueManager from 'playQueueManager';
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import screenfull from 'screenfull';
|
import screenfull from 'screenfull';
|
||||||
@ -69,7 +68,7 @@ function reportPlayback(playbackManagerInstance, state, player, reportPlaylist,
|
|||||||
addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId);
|
addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
const reportPlaybackPromise = apiClient[method](info);
|
const reportPlaybackPromise = apiClient[method](info);
|
||||||
// Notify that report has been sent
|
// Notify that report has been sent
|
||||||
reportPlaybackPromise.then(() => {
|
reportPlaybackPromise.then(() => {
|
||||||
@ -106,7 +105,7 @@ function normalizeName(t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getItemsForPlayback(serverId, query) {
|
function getItemsForPlayback(serverId, query) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (query.Ids && query.Ids.split(',').length === 1) {
|
if (query.Ids && query.Ids.split(',').length === 1) {
|
||||||
const itemId = query.Ids.split(',');
|
const itemId = query.Ids.split(',');
|
||||||
@ -874,7 +873,7 @@ class PlaybackManager {
|
|||||||
const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets);
|
const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets);
|
||||||
|
|
||||||
return Promise.all(promises).then(function (responses) {
|
return Promise.all(promises).then(function (responses) {
|
||||||
return connectionManager.currentApiClient().getCurrentUser().then(function (user) {
|
return window.connectionManager.currentApiClient().getCurrentUser().then(function (user) {
|
||||||
const targets = [];
|
const targets = [];
|
||||||
|
|
||||||
targets.push({
|
targets.push({
|
||||||
@ -1372,7 +1371,7 @@ class PlaybackManager {
|
|||||||
function getSavedMaxStreamingBitrate(apiClient, mediaType) {
|
function getSavedMaxStreamingBitrate(apiClient, mediaType) {
|
||||||
if (!apiClient) {
|
if (!apiClient) {
|
||||||
// This should hopefully never happen
|
// This should hopefully never happen
|
||||||
apiClient = connectionManager.currentApiClient();
|
apiClient = window.connectionManager.currentApiClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
const endpointInfo = apiClient.getSavedEndpointInfo() || {};
|
const endpointInfo = apiClient.getSavedEndpointInfo() || {};
|
||||||
@ -1395,7 +1394,7 @@ class PlaybackManager {
|
|||||||
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
|
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
|
||||||
const currentItem = self.currentItem(player);
|
const currentItem = self.currentItem(player);
|
||||||
|
|
||||||
const apiClient = currentItem ? connectionManager.getApiClient(currentItem.ServerId) : connectionManager.currentApiClient();
|
const apiClient = currentItem ? window.connectionManager.getApiClient(currentItem.ServerId) : window.connectionManager.currentApiClient();
|
||||||
return getSavedMaxStreamingBitrate(apiClient, mediaType);
|
return getSavedMaxStreamingBitrate(apiClient, mediaType);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1409,7 +1408,7 @@ class PlaybackManager {
|
|||||||
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
|
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
|
||||||
const currentItem = self.currentItem(player);
|
const currentItem = self.currentItem(player);
|
||||||
|
|
||||||
const apiClient = currentItem ? connectionManager.getApiClient(currentItem.ServerId) : connectionManager.currentApiClient();
|
const apiClient = currentItem ? window.connectionManager.getApiClient(currentItem.ServerId) : window.connectionManager.currentApiClient();
|
||||||
const endpointInfo = apiClient.getSavedEndpointInfo() || {};
|
const endpointInfo = apiClient.getSavedEndpointInfo() || {};
|
||||||
|
|
||||||
return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType);
|
return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType);
|
||||||
@ -1421,7 +1420,7 @@ class PlaybackManager {
|
|||||||
return player.setMaxStreamingBitrate(options);
|
return player.setMaxStreamingBitrate(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(self.currentItem(player).ServerId);
|
const apiClient = window.connectionManager.getApiClient(self.currentItem(player).ServerId);
|
||||||
|
|
||||||
apiClient.getEndpointInfo().then(function (endpointInfo) {
|
apiClient.getEndpointInfo().then(function (endpointInfo) {
|
||||||
const playerData = getPlayerData(player);
|
const playerData = getPlayerData(player);
|
||||||
@ -1691,7 +1690,7 @@ class PlaybackManager {
|
|||||||
const subtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).subtitleStreamIndex : params.SubtitleStreamIndex;
|
const subtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).subtitleStreamIndex : params.SubtitleStreamIndex;
|
||||||
|
|
||||||
let currentMediaSource = self.currentMediaSource(player);
|
let currentMediaSource = self.currentMediaSource(player);
|
||||||
const apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
|
|
||||||
if (ticks) {
|
if (ticks) {
|
||||||
ticks = parseInt(ticks);
|
ticks = parseInt(ticks);
|
||||||
@ -1847,7 +1846,7 @@ class PlaybackManager {
|
|||||||
}, queryOptions));
|
}, queryOptions));
|
||||||
} else if (firstItem.Type === 'Episode' && items.length === 1 && getPlayer(firstItem, options).supportsProgress !== false) {
|
} else if (firstItem.Type === 'Episode' && items.length === 1 && getPlayer(firstItem, options).supportsProgress !== false) {
|
||||||
promise = new Promise(function (resolve, reject) {
|
promise = new Promise(function (resolve, reject) {
|
||||||
const apiClient = connectionManager.getApiClient(firstItem.ServerId);
|
const apiClient = window.connectionManager.getApiClient(firstItem.ServerId);
|
||||||
|
|
||||||
apiClient.getCurrentUser().then(function (user) {
|
apiClient.getCurrentUser().then(function (user) {
|
||||||
if (!user.Configuration.EnableNextEpisodeAutoPlay || !firstItem.SeriesId) {
|
if (!user.Configuration.EnableNextEpisodeAutoPlay || !firstItem.SeriesId) {
|
||||||
@ -2078,7 +2077,7 @@ class PlaybackManager {
|
|||||||
return playOther(items, options, user);
|
return playOther(items, options, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(firstItem.ServerId);
|
const apiClient = window.connectionManager.getApiClient(firstItem.ServerId);
|
||||||
|
|
||||||
return getIntros(firstItem, apiClient, options).then(function (introsResult) {
|
return getIntros(firstItem, apiClient, options).then(function (introsResult) {
|
||||||
const introItems = introsResult.Items;
|
const introItems = introsResult.Items;
|
||||||
@ -2141,14 +2140,14 @@ class PlaybackManager {
|
|||||||
const mediaType = item.MediaType;
|
const mediaType = item.MediaType;
|
||||||
|
|
||||||
const onBitrateDetectionFailure = function () {
|
const onBitrateDetectionFailure = function () {
|
||||||
return playAfterBitrateDetect(getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId), mediaType), item, playOptions, onPlaybackStartedFn);
|
return playAfterBitrateDetect(getSavedMaxStreamingBitrate(window.connectionManager.getApiClient(item.ServerId), mediaType), item, playOptions, onPlaybackStartedFn);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isServerItem(item) || itemHelper.isLocalItem(item)) {
|
if (!isServerItem(item) || itemHelper.isLocalItem(item)) {
|
||||||
return onBitrateDetectionFailure();
|
return onBitrateDetectionFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
apiClient.getEndpointInfo().then(function (endpointInfo) {
|
apiClient.getEndpointInfo().then(function (endpointInfo) {
|
||||||
if ((mediaType === 'Video' || mediaType === 'Audio') && appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType)) {
|
if ((mediaType === 'Video' || mediaType === 'Audio') && appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType)) {
|
||||||
return apiClient.detectBitrate().then(function (bitrate) {
|
return apiClient.detectBitrate().then(function (bitrate) {
|
||||||
@ -2267,7 +2266,7 @@ class PlaybackManager {
|
|||||||
return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) {
|
return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) {
|
||||||
const deviceProfile = responses[1];
|
const deviceProfile = responses[1];
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
const mediaSourceId = playOptions.mediaSourceId;
|
const mediaSourceId = playOptions.mediaSourceId;
|
||||||
const audioStreamIndex = playOptions.audioStreamIndex;
|
const audioStreamIndex = playOptions.audioStreamIndex;
|
||||||
@ -2312,11 +2311,11 @@ class PlaybackManager {
|
|||||||
const startPosition = options.startPositionTicks || 0;
|
const startPosition = options.startPositionTicks || 0;
|
||||||
const mediaType = options.mediaType || item.MediaType;
|
const mediaType = options.mediaType || item.MediaType;
|
||||||
const player = getPlayer(item, options);
|
const player = getPlayer(item, options);
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
// Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate
|
// Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate
|
||||||
return apiClient.getEndpointInfo().then(function () {
|
return apiClient.getEndpointInfo().then(function () {
|
||||||
const maxBitrate = getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId), mediaType);
|
const maxBitrate = getSavedMaxStreamingBitrate(window.connectionManager.getApiClient(item.ServerId), mediaType);
|
||||||
|
|
||||||
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
||||||
return getPlaybackMediaSource(player, apiClient, deviceProfile, maxBitrate, item, startPosition, options.mediaSourceId, options.audioStreamIndex, options.subtitleStreamIndex).then(function (mediaSource) {
|
return getPlaybackMediaSource(player, apiClient, deviceProfile, maxBitrate, item, startPosition, options.mediaSourceId, options.audioStreamIndex, options.subtitleStreamIndex).then(function (mediaSource) {
|
||||||
@ -2332,11 +2331,11 @@ class PlaybackManager {
|
|||||||
const mediaType = options.mediaType || item.MediaType;
|
const mediaType = options.mediaType || item.MediaType;
|
||||||
// TODO: Remove the true forceLocalPlayer hack
|
// TODO: Remove the true forceLocalPlayer hack
|
||||||
const player = getPlayer(item, options, true);
|
const player = getPlayer(item, options, true);
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
// Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate
|
// Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate
|
||||||
return apiClient.getEndpointInfo().then(function () {
|
return apiClient.getEndpointInfo().then(function () {
|
||||||
const maxBitrate = getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId), mediaType);
|
const maxBitrate = getSavedMaxStreamingBitrate(window.connectionManager.getApiClient(item.ServerId), mediaType);
|
||||||
|
|
||||||
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
return player.getDeviceProfile(item).then(function (deviceProfile) {
|
||||||
return getPlaybackInfo(player, apiClient, item, deviceProfile, maxBitrate, startPosition, false, null, null, null, null).then(function (playbackInfoResult) {
|
return getPlaybackInfo(player, apiClient, item, deviceProfile, maxBitrate, startPosition, false, null, null, null, null).then(function (playbackInfoResult) {
|
||||||
@ -2720,7 +2719,7 @@ class PlaybackManager {
|
|||||||
const queueDirectToPlayer = player && !enableLocalPlaylistManagement(player);
|
const queueDirectToPlayer = player && !enableLocalPlaylistManagement(player);
|
||||||
|
|
||||||
if (queueDirectToPlayer) {
|
if (queueDirectToPlayer) {
|
||||||
const apiClient = connectionManager.getApiClient(items[0].ServerId);
|
const apiClient = window.connectionManager.getApiClient(items[0].ServerId);
|
||||||
|
|
||||||
player.getDeviceProfile(items[0]).then(function (profile) {
|
player.getDeviceProfile(items[0]).then(function (profile) {
|
||||||
setStreamUrls(items, profile, self.getMaxStreamingBitrate(player), apiClient, 0).then(function () {
|
setStreamUrls(items, profile, self.getMaxStreamingBitrate(player), apiClient, 0).then(function () {
|
||||||
@ -3170,13 +3169,13 @@ class PlaybackManager {
|
|||||||
|
|
||||||
streamInfo.lastMediaInfoQuery = new Date().getTime();
|
streamInfo.lastMediaInfoQuery = new Date().getTime();
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (!apiClient.isMinServerVersion('3.2.70.7')) {
|
if (!apiClient.isMinServerVersion('3.2.70.7')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function (info) {
|
window.connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function (info) {
|
||||||
mediaSource.MediaStreams = info.MediaStreams;
|
mediaSource.MediaStreams = info.MediaStreams;
|
||||||
events.trigger(player, 'mediastreamschange');
|
events.trigger(player, 'mediastreamschange');
|
||||||
}, function () {
|
}, function () {
|
||||||
@ -3233,7 +3232,7 @@ class PlaybackManager {
|
|||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(nextItem.item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(nextItem.item.ServerId);
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), nextItem.item.Id);
|
return apiClient.getItem(apiClient.getCurrentUserId(), nextItem.item.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3374,7 +3373,7 @@ class PlaybackManager {
|
|||||||
return player.playTrailers(item);
|
return player.playTrailers(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
const instance = this;
|
const instance = this;
|
||||||
|
|
||||||
@ -3406,7 +3405,7 @@ class PlaybackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSubtitleUrl(textStream, serverId) {
|
getSubtitleUrl(textStream, serverId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return !textStream.IsExternalUrl ? apiClient.getUrl(textStream.DeliveryUrl) : textStream.DeliveryUrl;
|
return !textStream.IsExternalUrl ? apiClient.getUrl(textStream.DeliveryUrl) : textStream.DeliveryUrl;
|
||||||
}
|
}
|
||||||
@ -3486,7 +3485,7 @@ class PlaybackManager {
|
|||||||
return player.instantMix(item);
|
return player.instantMix(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
const options = {};
|
const options = {};
|
||||||
options.UserId = apiClient.getCurrentUserId();
|
options.UserId = apiClient.getCurrentUserId();
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import actionsheet from 'actionsheet';
|
import actionsheet from 'actionsheet';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
@ -251,7 +250,7 @@ export function show(options) {
|
|||||||
return showWithUser(options, player, null);
|
return showWithUser(options, player, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
var apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
return apiClient.getCurrentUser().then(function (user) {
|
return apiClient.getCurrentUser().then(function (user) {
|
||||||
return showWithUser(options, player, user);
|
return showWithUser(options, player, user);
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,6 @@ import focusManager from 'focusManager';
|
|||||||
import qualityoptions from 'qualityoptions';
|
import qualityoptions from 'qualityoptions';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import 'emby-select';
|
import 'emby-select';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
@ -258,7 +257,7 @@ import 'emby-checkbox';
|
|||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
@ -305,7 +304,7 @@ import 'emby-checkbox';
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
apiClient.getUser(userId).then(user => {
|
apiClient.getUser(userId).then(user => {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import events from 'events';
|
import events from 'events';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import syncPlayManager from 'syncPlayManager';
|
import syncPlayManager from 'syncPlayManager';
|
||||||
import playMethodHelper from 'playMethodHelper';
|
import playMethodHelper from 'playMethodHelper';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -95,7 +94,7 @@ import 'css!./playerstats';
|
|||||||
return Promise.resolve(instance.lastSession);
|
return Promise.resolve(instance.lastSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
|
const apiClient = window.connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
|
||||||
|
|
||||||
return apiClient.getSessions({
|
return apiClient.getSessions({
|
||||||
deviceId: apiClient.deviceId()
|
deviceId: apiClient.deviceId()
|
||||||
@ -386,7 +385,7 @@ import 'css!./playerstats';
|
|||||||
name: 'Original Media Info'
|
name: 'Original Media Info'
|
||||||
});
|
});
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
|
var apiClient = window.connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
|
||||||
if (syncPlayManager.isSyncPlayEnabled() && apiClient.isMinServerVersion('10.6.0')) {
|
if (syncPlayManager.isSyncPlayEnabled() && apiClient.isMinServerVersion('10.6.0')) {
|
||||||
categories.push({
|
categories.push({
|
||||||
stats: getSyncPlayStats(),
|
stats: getSyncPlayStats(),
|
||||||
|
@ -3,7 +3,6 @@ import dialogHelper from 'dialogHelper';
|
|||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
@ -22,7 +21,7 @@ import 'emby-button';
|
|||||||
const panel = dom.parentWithClass(this, 'dialog');
|
const panel = dom.parentWithClass(this, 'dialog');
|
||||||
|
|
||||||
const playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
|
const playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
if (playlistId) {
|
if (playlistId) {
|
||||||
userSettings.set('playlisteditor-lastplaylistid', playlistId);
|
userSettings.set('playlisteditor-lastplaylistid', playlistId);
|
||||||
@ -113,7 +112,7 @@ import 'emby-button';
|
|||||||
EnableTotalRecordCount: false
|
EnableTotalRecordCount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import recordingHelper from 'recordingHelper';
|
import recordingHelper from 'recordingHelper';
|
||||||
import 'paper-icon-button-light';
|
import 'paper-icon-button-light';
|
||||||
@ -53,7 +52,7 @@ class RecordingButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refresh(serverId, itemId) {
|
refresh(serverId, itemId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
const self = this;
|
const self = this;
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||||
self.refreshItem(item);
|
self.refreshItem(item);
|
||||||
|
@ -2,7 +2,6 @@ import dialogHelper from 'dialogHelper';
|
|||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import mediaInfo from 'mediaInfo';
|
import mediaInfo from 'mediaInfo';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import require from 'require';
|
import require from 'require';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
@ -103,7 +102,7 @@ function renderRecording(context, defaultTimer, program, apiClient, refreshRecor
|
|||||||
function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
const promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
const promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
||||||
const promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
|
const promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
|
||||||
@ -119,7 +118,7 @@ function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
|||||||
function executeCloseAction(action, programId, serverId) {
|
function executeCloseAction(action, programId, serverId) {
|
||||||
if (action === 'play') {
|
if (action === 'play') {
|
||||||
import('playbackManager').then(({ default: playbackManager }) => {
|
import('playbackManager').then(({ default: playbackManager }) => {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
|
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
|
||||||
playbackManager.play({
|
playbackManager.play({
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
import 'scrollStyles';
|
import 'scrollStyles';
|
||||||
@ -41,7 +40,7 @@ function closeDialog(isDeleted) {
|
|||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
const form = this;
|
const form = this;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
apiClient.getLiveTvTimer(currentItemId).then(function (item) {
|
apiClient.getLiveTvTimer(currentItemId).then(function (item) {
|
||||||
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
|
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
|
||||||
@ -61,7 +60,7 @@ function init(context) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
deleteTimer(apiClient, currentItemId).then(function () {
|
deleteTimer(apiClient, currentItemId).then(function () {
|
||||||
closeDialog(true);
|
closeDialog(true);
|
||||||
@ -75,7 +74,7 @@ function reload(context, id) {
|
|||||||
loading.show();
|
loading.show();
|
||||||
currentItemId = id;
|
currentItemId = id;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
apiClient.getLiveTvTimer(id).then(function (result) {
|
apiClient.getLiveTvTimer(id).then(function (result) {
|
||||||
renderTimer(context, result, apiClient);
|
renderTimer(context, result, apiClient);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
@ -46,7 +45,7 @@ function loadData(parent, program, apiClient) {
|
|||||||
|
|
||||||
function fetchData(instance) {
|
function fetchData(instance) {
|
||||||
const options = instance.options;
|
const options = instance.options;
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
options.parent.querySelector('.recordingFields').classList.remove('hide');
|
options.parent.querySelector('.recordingFields').classList.remove('hide');
|
||||||
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
|
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
|
||||||
@ -197,7 +196,7 @@ function onRecordChange(e) {
|
|||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
const button = dom.parentWithTag(e.target, 'BUTTON');
|
const button = dom.parentWithTag(e.target, 'BUTTON');
|
||||||
const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active');
|
const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active');
|
||||||
@ -236,7 +235,7 @@ function onRecordSeriesChange(e) {
|
|||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
const options = this.options;
|
const options = this.options;
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
const button = dom.parentWithTag(e.target, 'BUTTON');
|
const button = dom.parentWithTag(e.target, 'BUTTON');
|
||||||
const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active');
|
const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active');
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
/*eslint prefer-const: "error"*/
|
/*eslint prefer-const: "error"*/
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ function cancelTimerWithConfirmation(timerId, serverId) {
|
|||||||
}).then(function () {
|
}).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
cancelTimer(apiClient, timerId, true).then(resolve, reject);
|
cancelTimer(apiClient, timerId, true).then(resolve, reject);
|
||||||
}, reject);
|
}, reject);
|
||||||
});
|
});
|
||||||
@ -60,7 +59,7 @@ function cancelSeriesTimerWithConfirmation(timerId, serverId) {
|
|||||||
}).then(function () {
|
}).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
|
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
|
||||||
import('toast').then(({default: toast}) => {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SeriesCancelled'));
|
toast(globalize.translate('SeriesCancelled'));
|
||||||
@ -141,7 +140,7 @@ function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus,
|
|||||||
buttons: items
|
buttons: items
|
||||||
|
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (result === 'canceltimer') {
|
if (result === 'canceltimer') {
|
||||||
loading.show();
|
loading.show();
|
||||||
@ -167,7 +166,7 @@ function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus,
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
const hasTimer = timerId && timerStatus !== 'Cancelled';
|
const hasTimer = timerId && timerStatus !== 'Cancelled';
|
||||||
if (seriesTimerId && hasTimer) {
|
if (seriesTimerId && hasTimer) {
|
||||||
// cancel
|
// cancel
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
@ -64,7 +63,7 @@ function closeDialog(isDeleted) {
|
|||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
const form = this;
|
const form = this;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
apiClient.getLiveTvSeriesTimer(currentItemId).then(function (item) {
|
apiClient.getLiveTvSeriesTimer(currentItemId).then(function (item) {
|
||||||
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
|
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
|
||||||
@ -92,7 +91,7 @@ function init(context) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
deleteTimer(apiClient, currentItemId).then(function () {
|
deleteTimer(apiClient, currentItemId).then(function () {
|
||||||
closeDialog(true);
|
closeDialog(true);
|
||||||
});
|
});
|
||||||
@ -102,7 +101,7 @@ function init(context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reload(context, id) {
|
function reload(context, id) {
|
||||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
if (typeof id === 'string') {
|
if (typeof id === 'string') {
|
||||||
|
@ -2,7 +2,6 @@ import dom from 'dom';
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import 'emby-input';
|
import 'emby-input';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
@ -66,7 +65,7 @@ function onSubmit(e) {
|
|||||||
const dlg = dom.parentWithClass(e.target, 'dialog');
|
const dlg = dom.parentWithClass(e.target, 'dialog');
|
||||||
const options = instance.options;
|
const options = instance.options;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
const replaceAllMetadata = dlg.querySelector('#selectMetadataRefreshMode').value === 'all';
|
const replaceAllMetadata = dlg.querySelector('#selectMetadataRefreshMode').value === 'all';
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import imageLoader from 'imageLoader';
|
|||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import nowPlayingHelper from 'nowPlayingHelper';
|
import nowPlayingHelper from 'nowPlayingHelper';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -96,18 +95,18 @@ function seriesImageUrl(item, options) {
|
|||||||
options.type = options.type || 'Primary';
|
options.type = options.type || 'Primary';
|
||||||
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
||||||
options.tag = item.SeriesPrimaryImageTag;
|
options.tag = item.SeriesPrimaryImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.type === 'Thumb') {
|
if (options.type === 'Thumb') {
|
||||||
if (item.SeriesThumbImageTag) {
|
if (item.SeriesThumbImageTag) {
|
||||||
options.tag = item.SeriesThumbImageTag;
|
options.tag = item.SeriesThumbImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.ParentThumbImageTag) {
|
if (item.ParentThumbImageTag) {
|
||||||
options.tag = item.ParentThumbImageTag;
|
options.tag = item.ParentThumbImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,12 +119,12 @@ function imageUrl(item, options) {
|
|||||||
|
|
||||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
options.tag = item.ImageTags[options.type];
|
options.tag = item.ImageTags[options.type];
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
options.tag = item.AlbumPrimaryImageTag;
|
options.tag = item.AlbumPrimaryImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -216,7 +215,7 @@ function updateNowPlayingInfo(context, state, serverId) {
|
|||||||
openAlbum: false,
|
openAlbum: false,
|
||||||
positionTo: contextButton
|
positionTo: contextButton
|
||||||
};
|
};
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
|
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
|
||||||
apiClient.getCurrentUser().then(function (user) {
|
apiClient.getCurrentUser().then(function (user) {
|
||||||
contextButton.addEventListener('click', function () {
|
contextButton.addEventListener('click', function () {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import 'emby-scroller';
|
import 'emby-scroller';
|
||||||
@ -606,7 +605,7 @@ class SearchResults {
|
|||||||
embed(options.element, this, options);
|
embed(options.element, this, options);
|
||||||
}
|
}
|
||||||
search(value) {
|
search(value) {
|
||||||
const apiClient = connectionManager.getApiClient(this.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(this.options.serverId);
|
||||||
|
|
||||||
search(this, apiClient, this.options.element, value);
|
search(this, apiClient, this.options.element, value);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
@ -81,7 +80,7 @@ import recordingHelper from 'recordingHelper';
|
|||||||
const id = button.getAttribute('data-id');
|
const id = button.getAttribute('data-id');
|
||||||
const type = button.getAttribute('data-type');
|
const type = button.getAttribute('data-type');
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (type === 'Timer') {
|
if (type === 'Timer') {
|
||||||
return apiClient.getLiveTvTimer(id);
|
return apiClient.getLiveTvTimer(id);
|
||||||
@ -111,7 +110,7 @@ import recordingHelper from 'recordingHelper';
|
|||||||
}
|
}
|
||||||
|
|
||||||
import('itemContextMenu').then(({default: itemContextMenu}) => {
|
import('itemContextMenu').then(({default: itemContextMenu}) => {
|
||||||
connectionManager.getApiClient(item.ServerId).getCurrentUser().then(user => {
|
window.connectionManager.getApiClient(item.ServerId).getCurrentUser().then(user => {
|
||||||
itemContextMenu.show(Object.assign({
|
itemContextMenu.show(Object.assign({
|
||||||
item: item,
|
item: item,
|
||||||
play: true,
|
play: true,
|
||||||
@ -280,7 +279,7 @@ import recordingHelper from 'recordingHelper';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function playTrailer(item) {
|
function playTrailer(item) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(trailers => {
|
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(trailers => {
|
||||||
playbackManager.play({ items: trailers });
|
playbackManager.play({ items: trailers });
|
||||||
@ -288,7 +287,7 @@ import recordingHelper from 'recordingHelper';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function editItem(item, serverId) {
|
function editItem(item, serverId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const serverId = apiClient.serverInfo().Id;
|
const serverId = apiClient.serverInfo().Id;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
@ -85,7 +84,7 @@ function getBackdropImageUrl(item, options, apiClient) {
|
|||||||
* @returns {string} URL of the item's image.
|
* @returns {string} URL of the item's image.
|
||||||
*/
|
*/
|
||||||
function getImgUrl(item, user) {
|
function getImgUrl(item, user) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
const imageOptions = {};
|
const imageOptions = {};
|
||||||
|
|
||||||
if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||||
|
@ -2,7 +2,6 @@ import dialogHelper from 'dialogHelper';
|
|||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
@ -21,7 +20,7 @@ let hasChanges;
|
|||||||
function downloadRemoteSubtitles(context, id) {
|
function downloadRemoteSubtitles(context, id) {
|
||||||
let url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
|
let url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
|
||||||
|
|
||||||
let apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
let apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
|
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -55,7 +54,7 @@ function deleteLocalSubtitle(context, index) {
|
|||||||
let itemId = currentItem.Id;
|
let itemId = currentItem.Id;
|
||||||
let url = 'Videos/' + itemId + '/Subtitles/' + index;
|
let url = 'Videos/' + itemId + '/Subtitles/' + index;
|
||||||
|
|
||||||
let apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
let apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
|
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
|
|
||||||
@ -243,7 +242,7 @@ function searchForSubtitles(context, language) {
|
|||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
let apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
let apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
|
||||||
let url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
let url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
||||||
|
|
||||||
apiClient.getJSON(url).then(function (results) {
|
apiClient.getJSON(url).then(function (results) {
|
||||||
@ -356,7 +355,7 @@ function centerFocus(elem, horiz, on) {
|
|||||||
function showEditorInternal(itemId, serverId, template) {
|
function showEditorInternal(itemId, serverId, template) {
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
|
|
||||||
let apiClient = connectionManager.getApiClient(serverId);
|
let apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||||
let dialogOptions = {
|
let dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
|
@ -4,7 +4,6 @@ import appSettings from 'appSettings';
|
|||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import subtitleAppearanceHelper from 'subtitleAppearanceHelper';
|
import subtitleAppearanceHelper from 'subtitleAppearanceHelper';
|
||||||
import settingsHelper from 'settingsHelper';
|
import settingsHelper from 'settingsHelper';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
@ -232,7 +231,7 @@ export class SubtitleSettings {
|
|||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
apiClient.getUser(userId).then(function (user) {
|
||||||
@ -256,7 +255,7 @@ export class SubtitleSettings {
|
|||||||
|
|
||||||
onSubmit(e) {
|
onSubmit(e) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
const userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
const userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import events from 'events';
|
import events from 'events';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import syncPlayManager from 'syncPlayManager';
|
import syncPlayManager from 'syncPlayManager';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
@ -172,8 +171,8 @@ export function show (button) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
connectionManager.user(apiClient).then((user) => {
|
window.connectionManager.user(apiClient).then((user) => {
|
||||||
if (syncPlayEnabled) {
|
if (syncPlayEnabled) {
|
||||||
showLeaveGroupSelection(button, user, apiClient);
|
showLeaveGroupSelection(button, user, apiClient);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import timeSyncManager from 'timeSyncManager';
|
import timeSyncManager from 'timeSyncManager';
|
||||||
import toast from 'toast';
|
import toast from 'toast';
|
||||||
@ -128,7 +127,7 @@ class SyncPlayManager {
|
|||||||
|
|
||||||
// Report ping
|
// Report ping
|
||||||
if (this.syncEnabled) {
|
if (this.syncEnabled) {
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
const sessionId = getActivePlayerId();
|
const sessionId = getActivePlayerId();
|
||||||
|
|
||||||
if (!sessionId) {
|
if (!sessionId) {
|
||||||
@ -660,7 +659,7 @@ class SyncPlayManager {
|
|||||||
* Overrides PlaybackManager's unpause method.
|
* Overrides PlaybackManager's unpause method.
|
||||||
*/
|
*/
|
||||||
playRequest (player) {
|
playRequest (player) {
|
||||||
var apiClient = connectionManager.currentApiClient();
|
var apiClient = window.connectionManager.currentApiClient();
|
||||||
apiClient.requestSyncPlayStart();
|
apiClient.requestSyncPlayStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,7 +667,7 @@ class SyncPlayManager {
|
|||||||
* Overrides PlaybackManager's pause method.
|
* Overrides PlaybackManager's pause method.
|
||||||
*/
|
*/
|
||||||
pauseRequest (player) {
|
pauseRequest (player) {
|
||||||
var apiClient = connectionManager.currentApiClient();
|
var apiClient = window.connectionManager.currentApiClient();
|
||||||
apiClient.requestSyncPlayPause();
|
apiClient.requestSyncPlayPause();
|
||||||
// Pause locally as well, to give the user some little control
|
// Pause locally as well, to give the user some little control
|
||||||
playbackManager._localUnpause(player);
|
playbackManager._localUnpause(player);
|
||||||
@ -678,7 +677,7 @@ class SyncPlayManager {
|
|||||||
* Overrides PlaybackManager's seek method.
|
* Overrides PlaybackManager's seek method.
|
||||||
*/
|
*/
|
||||||
seekRequest (PositionTicks, player) {
|
seekRequest (PositionTicks, player) {
|
||||||
var apiClient = connectionManager.currentApiClient();
|
var apiClient = window.connectionManager.currentApiClient();
|
||||||
apiClient.requestSyncPlaySeek({
|
apiClient.requestSyncPlaySeek({
|
||||||
PositionTicks: PositionTicks
|
PositionTicks: PositionTicks
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time estimation
|
* Time estimation
|
||||||
@ -114,7 +113,7 @@ class TimeSyncManager {
|
|||||||
if (!this.poller) {
|
if (!this.poller) {
|
||||||
this.poller = setTimeout(() => {
|
this.poller = setTimeout(() => {
|
||||||
this.poller = null;
|
this.poller = null;
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
const requestSent = new Date();
|
const requestSent = new Date();
|
||||||
apiClient.getServerTime().then((response) => {
|
apiClient.getServerTime().then((response) => {
|
||||||
const responseReceived = new Date();
|
const responseReceived = new Date();
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
let currentOwnerId;
|
let currentOwnerId;
|
||||||
let currentThemeIds = [];
|
let currentThemeIds = [];
|
||||||
@ -62,7 +61,7 @@ function loadThemeMedia(item) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
apiClient.getThemeMedia(apiClient.getCurrentUserId(), item.Id, true).then(function (themeMediaResult) {
|
apiClient.getThemeMedia(apiClient.getCurrentUserId(), item.Id, true).then(function (themeMediaResult) {
|
||||||
const ownerId = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.OwnerId : themeMediaResult.ThemeSongsResult.OwnerId;
|
const ownerId = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.OwnerId : themeMediaResult.ThemeSongsResult.OwnerId;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
@ -163,7 +162,7 @@ function tunerPicker() {
|
|||||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
discoverDevices(dlg, apiClient);
|
discoverDevices(dlg, apiClient);
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import mediaInfo from 'mediaInfo';
|
import mediaInfo from 'mediaInfo';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -27,7 +26,7 @@ import 'flexStyles';
|
|||||||
if (item.SeriesPrimaryImageTag) {
|
if (item.SeriesPrimaryImageTag) {
|
||||||
options.tag = item.SeriesPrimaryImageTag;
|
options.tag = item.SeriesPrimaryImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,12 +34,12 @@ import 'flexStyles';
|
|||||||
if (item.SeriesThumbImageTag) {
|
if (item.SeriesThumbImageTag) {
|
||||||
options.tag = item.SeriesThumbImageTag;
|
options.tag = item.SeriesThumbImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
if (item.ParentThumbImageTag) {
|
if (item.ParentThumbImageTag) {
|
||||||
options.tag = item.ParentThumbImageTag;
|
options.tag = item.ParentThumbImageTag;
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,13 +52,13 @@ import 'flexStyles';
|
|||||||
|
|
||||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
options.tag = item.ImageTags[options.type];
|
options.tag = item.ImageTags[options.type];
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.type === 'Primary') {
|
if (options.type === 'Primary') {
|
||||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
options.tag = item.AlbumPrimaryImageTag;
|
options.tag = item.AlbumPrimaryImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import itemHelper from 'itemHelper';
|
import itemHelper from 'itemHelper';
|
||||||
@ -188,12 +187,12 @@ function markPlayed(link) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function likes(id, serverId, isLiked) {
|
function likes(id, serverId, isLiked) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.updateUserItemRating(apiClient.getCurrentUserId(), id, isLiked);
|
return apiClient.updateUserItemRating(apiClient.getCurrentUserId(), id, isLiked);
|
||||||
}
|
}
|
||||||
|
|
||||||
function played(id, serverId, isPlayed) {
|
function played(id, serverId, isPlayed) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
const method = isPlayed ? 'markPlayed' : 'markUnplayed';
|
const method = isPlayed ? 'markPlayed' : 'markUnplayed';
|
||||||
|
|
||||||
@ -201,13 +200,13 @@ function played(id, serverId, isPlayed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function favorite(id, serverId, isFavorite) {
|
function favorite(id, serverId, isFavorite) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return apiClient.updateFavoriteStatus(apiClient.getCurrentUserId(), id, isFavorite);
|
return apiClient.updateFavoriteStatus(apiClient.getCurrentUserId(), id, isFavorite);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearLike(id, serverId) {
|
function clearLike(id, serverId) {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return apiClient.clearUserItemRating(apiClient.getCurrentUserId(), id);
|
return apiClient.clearUserItemRating(apiClient.getCurrentUserId(), id);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import globalize from 'globalize';
|
|||||||
import * as datefns from 'date-fns';
|
import * as datefns from 'date-fns';
|
||||||
import dfnshelper from 'dfnshelper';
|
import dfnshelper from 'dfnshelper';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import playMethodHelper from 'playMethodHelper';
|
import playMethodHelper from 'playMethodHelper';
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
@ -60,7 +59,7 @@ import 'emby-itemscontainer';
|
|||||||
confirmText: globalize.translate('ButtonSend')
|
confirmText: globalize.translate('ButtonSend')
|
||||||
}).then(function (text) {
|
}).then(function (text) {
|
||||||
if (text) {
|
if (text) {
|
||||||
connectionManager.getApiClient(session.ServerId).sendMessageCommand(session.Id, {
|
window.connectionManager.getApiClient(session.ServerId).sendMessageCommand(session.Id, {
|
||||||
Text: text,
|
Text: text,
|
||||||
TimeoutMs: 5e3
|
TimeoutMs: 5e3
|
||||||
});
|
});
|
||||||
@ -73,7 +72,7 @@ import 'emby-itemscontainer';
|
|||||||
import('actionsheet').then(({default: actionsheet}) => {
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
const menuItems = [];
|
const menuItems = [];
|
||||||
|
|
||||||
if (session.ServerId && session.DeviceId !== connectionManager.deviceId()) {
|
if (session.ServerId && session.DeviceId !== window.connectionManager.deviceId()) {
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
name: globalize.translate('SendMessage'),
|
name: globalize.translate('SendMessage'),
|
||||||
id: 'sendmessage'
|
id: 'sendmessage'
|
||||||
@ -123,9 +122,9 @@ import 'emby-itemscontainer';
|
|||||||
} else if (btn.classList.contains('btnSessionSendMessage')) {
|
} else if (btn.classList.contains('btnSessionSendMessage')) {
|
||||||
showSendMessageForm(btn, session);
|
showSendMessageForm(btn, session);
|
||||||
} else if (btn.classList.contains('btnSessionStop')) {
|
} else if (btn.classList.contains('btnSessionStop')) {
|
||||||
connectionManager.getApiClient(session.ServerId).sendPlayStateCommand(session.Id, 'Stop');
|
window.connectionManager.getApiClient(session.ServerId).sendPlayStateCommand(session.Id, 'Stop');
|
||||||
} else if (btn.classList.contains('btnSessionPlayPause') && session.PlayState) {
|
} else if (btn.classList.contains('btnSessionPlayPause') && session.PlayState) {
|
||||||
connectionManager.getApiClient(session.ServerId).sendPlayStateCommand(session.Id, 'PlayPause');
|
window.connectionManager.getApiClient(session.ServerId).sendPlayStateCommand(session.Id, 'PlayPause');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +312,7 @@ import 'emby-itemscontainer';
|
|||||||
btnCssClass = session.TranscodingInfo && session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length ? '' : ' hide';
|
btnCssClass = session.TranscodingInfo && session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length ? '' : ' hide';
|
||||||
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionInfo paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('ViewPlaybackInfo') + '"><span class="material-icons info"></span></button>';
|
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionInfo paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('ViewPlaybackInfo') + '"><span class="material-icons info"></span></button>';
|
||||||
|
|
||||||
btnCssClass = session.ServerId && session.SupportedCommands.indexOf('DisplayMessage') !== -1 && session.DeviceId !== connectionManager.deviceId() ? '' : ' hide';
|
btnCssClass = session.ServerId && session.SupportedCommands.indexOf('DisplayMessage') !== -1 && session.DeviceId !== window.connectionManager.deviceId() ? '' : ' hide';
|
||||||
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionSendMessage paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('SendMessage') + '"><span class="material-icons message"></span></button>';
|
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionSendMessage paper-icon-button-light ' + btnCssClass + '" title="' + globalize.translate('SendMessage') + '"><span class="material-icons message"></span></button>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
@ -551,7 +550,7 @@ import 'emby-itemscontainer';
|
|||||||
row.classList.remove('playingSession');
|
row.classList.remove('playingSession');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.ServerId && session.SupportedCommands.indexOf('DisplayMessage') !== -1 && session.DeviceId !== connectionManager.deviceId()) {
|
if (session.ServerId && session.SupportedCommands.indexOf('DisplayMessage') !== -1 && session.DeviceId !== window.connectionManager.deviceId()) {
|
||||||
row.querySelector('.btnSessionSendMessage').classList.remove('hide');
|
row.querySelector('.btnSessionSendMessage').classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
row.querySelector('.btnSessionSendMessage').classList.add('hide');
|
row.querySelector('.btnSessionSendMessage').classList.add('hide');
|
||||||
@ -565,7 +564,7 @@ import 'emby-itemscontainer';
|
|||||||
|
|
||||||
const btnSessionPlayPause = row.querySelector('.btnSessionPlayPause');
|
const btnSessionPlayPause = row.querySelector('.btnSessionPlayPause');
|
||||||
|
|
||||||
if (session.ServerId && nowPlayingItem && session.SupportsRemoteControl && session.DeviceId !== connectionManager.deviceId()) {
|
if (session.ServerId && nowPlayingItem && session.SupportsRemoteControl && session.DeviceId !== window.connectionManager.deviceId()) {
|
||||||
btnSessionPlayPause.classList.remove('hide');
|
btnSessionPlayPause.classList.remove('hide');
|
||||||
row.querySelector('.btnSessionStop').classList.remove('hide');
|
row.querySelector('.btnSessionStop').classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,7 +2,6 @@ import appRouter from 'appRouter';
|
|||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
@ -270,7 +269,7 @@ class FavoritesTab {
|
|||||||
constructor(view, params) {
|
constructor(view, params) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.apiClient = connectionManager.currentApiClient();
|
this.apiClient = window.connectionManager.currentApiClient();
|
||||||
this.sectionsContainer = view.querySelector('.sections');
|
this.sectionsContainer = view.querySelector('.sections');
|
||||||
createSections(this, this.sectionsContainer, this.apiClient);
|
createSections(this, this.sectionsContainer, this.apiClient);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import homeSections from 'homeSections';
|
import homeSections from 'homeSections';
|
||||||
import 'emby-itemscontainer';
|
import 'emby-itemscontainer';
|
||||||
@ -9,7 +8,7 @@ class HomeTab {
|
|||||||
constructor(view, params) {
|
constructor(view, params) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.apiClient = connectionManager.currentApiClient();
|
this.apiClient = window.connectionManager.currentApiClient();
|
||||||
this.sectionsContainer = view.querySelector('.sections');
|
this.sectionsContainer = view.querySelector('.sections');
|
||||||
view.querySelector('.sections').addEventListener('settingschange', onHomeScreenSettingsChanged.bind(this));
|
view.querySelector('.sections').addEventListener('settingschange', onHomeScreenSettingsChanged.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ import loading from 'loading';
|
|||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import itemShortcuts from 'itemShortcuts';
|
import itemShortcuts from 'itemShortcuts';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
@ -564,7 +563,7 @@ function renderDetailPageBackdrop(page, item, apiClient) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reloadFromItem(instance, page, params, item, user) {
|
function reloadFromItem(instance, page, params, item, user) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
Emby.Page.setTitle('');
|
Emby.Page.setTitle('');
|
||||||
|
|
||||||
@ -797,7 +796,7 @@ function renderNextUp(page, item, user) {
|
|||||||
return void section.classList.add('hide');
|
return void section.classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionManager.getApiClient(item.ServerId).getNextUpEpisodes({
|
window.connectionManager.getApiClient(item.ServerId).getNextUpEpisodes({
|
||||||
SeriesId: item.Id,
|
SeriesId: item.Id,
|
||||||
UserId: user.Id
|
UserId: user.Id
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
@ -1196,7 +1195,7 @@ function renderSimilarItems(page, item, context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
similarCollapsible.classList.remove('hide');
|
similarCollapsible.classList.remove('hide');
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
const options = {
|
const options = {
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
limit: 12,
|
limit: 12,
|
||||||
@ -1310,7 +1309,7 @@ function renderChildren(page, item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let promise;
|
let promise;
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
const userId = apiClient.getCurrentUserId();
|
const userId = apiClient.getCurrentUserId();
|
||||||
|
|
||||||
if (item.Type == 'Series') {
|
if (item.Type == 'Series') {
|
||||||
@ -1549,7 +1548,7 @@ function renderChannelGuide(page, apiClient, item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSeriesSchedule(page, item) {
|
function renderSeriesSchedule(page, item) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
apiClient.getLiveTvPrograms({
|
apiClient.getLiveTvPrograms({
|
||||||
UserId: apiClient.getCurrentUserId(),
|
UserId: apiClient.getCurrentUserId(),
|
||||||
HasAired: false,
|
HasAired: false,
|
||||||
@ -1709,7 +1708,7 @@ function renderCollectionItemType(page, parentItem, type, items) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderMusicVideos(page, item, user) {
|
function renderMusicVideos(page, item, user) {
|
||||||
connectionManager.getApiClient(item.ServerId).getItems(user.Id, {
|
window.connectionManager.getApiClient(item.ServerId).getItems(user.Id, {
|
||||||
SortBy: 'SortName',
|
SortBy: 'SortName',
|
||||||
SortOrder: 'Ascending',
|
SortOrder: 'Ascending',
|
||||||
IncludeItemTypes: 'MusicVideo',
|
IncludeItemTypes: 'MusicVideo',
|
||||||
@ -1729,7 +1728,7 @@ function renderMusicVideos(page, item, user) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderAdditionalParts(page, item, user) {
|
function renderAdditionalParts(page, item, user) {
|
||||||
connectionManager.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
window.connectionManager.getApiClient(item.ServerId).getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
page.querySelector('#additionalPartsCollapsible').classList.remove('hide');
|
||||||
const additionalPartsContent = page.querySelector('#additionalPartsContent');
|
const additionalPartsContent = page.querySelector('#additionalPartsContent');
|
||||||
@ -1774,7 +1773,7 @@ function getVideosHtml(items) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSpecials(page, item, user) {
|
function renderSpecials(page, item, user) {
|
||||||
connectionManager.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
|
window.connectionManager.getApiClient(item.ServerId).getSpecialFeatures(user.Id, item.Id).then(function (specials) {
|
||||||
const specialsContent = page.querySelector('#specialsContent');
|
const specialsContent = page.querySelector('#specialsContent');
|
||||||
specialsContent.innerHTML = getVideosHtml(specials);
|
specialsContent.innerHTML = getVideosHtml(specials);
|
||||||
imageLoader.lazyChildren(specialsContent);
|
imageLoader.lazyChildren(specialsContent);
|
||||||
@ -1830,7 +1829,7 @@ export default function (view, params) {
|
|||||||
function reload(instance, page, params) {
|
function reload(instance, page, params) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
const apiClient = params.serverId ? connectionManager.getApiClient(params.serverId) : ApiClient;
|
const apiClient = params.serverId ? window.connectionManager.getApiClient(params.serverId) : ApiClient;
|
||||||
|
|
||||||
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => {
|
Promise.all([getPromise(apiClient, params), apiClient.getCurrentUser()]).then(([item, user]) => {
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
@ -1879,7 +1878,7 @@ export default function (view, params) {
|
|||||||
const item = currentItem;
|
const item = currentItem;
|
||||||
|
|
||||||
if (item.Type === 'Program') {
|
if (item.Type === 'Program') {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
|
return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
|
||||||
playbackManager.play({
|
playbackManager.play({
|
||||||
items: [channel]
|
items: [channel]
|
||||||
@ -1916,7 +1915,7 @@ export default function (view, params) {
|
|||||||
|
|
||||||
function onCancelTimerClick() {
|
function onCancelTimerClick() {
|
||||||
import('recordingHelper').then(({ default: recordingHelper }) => {
|
import('recordingHelper').then(({ default: recordingHelper }) => {
|
||||||
recordingHelper.cancelTimer(connectionManager.getApiClient(currentItem.ServerId), currentItem.TimerId).then(function () {
|
recordingHelper.cancelTimer(window.connectionManager.getApiClient(currentItem.ServerId), currentItem.TimerId).then(function () {
|
||||||
reload(self, view, params);
|
reload(self, view, params);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1980,7 +1979,7 @@ export default function (view, params) {
|
|||||||
|
|
||||||
let currentItem;
|
let currentItem;
|
||||||
const self = this;
|
const self = this;
|
||||||
const apiClient = params.serverId ? connectionManager.getApiClient(params.serverId) : ApiClient;
|
const apiClient = params.serverId ? window.connectionManager.getApiClient(params.serverId) : ApiClient;
|
||||||
view.querySelectorAll('.btnPlay');
|
view.querySelectorAll('.btnPlay');
|
||||||
bindAll(view, '.btnPlay', 'click', onPlayClick);
|
bindAll(view, '.btnPlay', 'click', onPlayClick);
|
||||||
bindAll(view, '.btnResume', 'click', onPlayClick);
|
bindAll(view, '.btnResume', 'click', onPlayClick);
|
||||||
|
@ -5,7 +5,6 @@ import * as userSettings from 'userSettings';
|
|||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import AlphaNumericShortcuts from 'alphaNumericShortcuts';
|
import AlphaNumericShortcuts from 'alphaNumericShortcuts';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import AlphaPicker from 'alphaPicker';
|
import AlphaPicker from 'alphaPicker';
|
||||||
@ -16,7 +15,7 @@ import 'emby-scroller';
|
|||||||
|
|
||||||
function getInitialLiveTvQuery(instance, params) {
|
function getInitialLiveTvQuery(instance, params) {
|
||||||
const query = {
|
const query = {
|
||||||
UserId: connectionManager.getApiClient(params.serverId).getCurrentUserId(),
|
UserId: window.connectionManager.getApiClient(params.serverId).getCurrentUserId(),
|
||||||
StartIndex: 0,
|
StartIndex: 0,
|
||||||
Fields: 'ChannelInfo,PrimaryImageAspectRatio',
|
Fields: 'ChannelInfo,PrimaryImageAspectRatio',
|
||||||
Limit: 300
|
Limit: 300
|
||||||
@ -232,7 +231,7 @@ import 'emby-scroller';
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getItems(instance, params, item, sortBy, startIndex, limit) {
|
function getItems(instance, params, item, sortBy, startIndex, limit) {
|
||||||
const apiClient = connectionManager.getApiClient(params.serverId);
|
const apiClient = window.connectionManager.getApiClient(params.serverId);
|
||||||
|
|
||||||
instance.queryRecursive = false;
|
instance.queryRecursive = false;
|
||||||
if (params.type === 'Recordings') {
|
if (params.type === 'Recordings') {
|
||||||
@ -333,7 +332,7 @@ import 'emby-scroller';
|
|||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(params.serverId);
|
const apiClient = window.connectionManager.getApiClient(params.serverId);
|
||||||
const itemId = params.genreId || params.musicGenreId || params.studioId || params.personId || params.parentId;
|
const itemId = params.genreId || params.musicGenreId || params.studioId || params.personId || params.parentId;
|
||||||
|
|
||||||
if (itemId) {
|
if (itemId) {
|
||||||
|
@ -7,7 +7,6 @@ import itemHelper from 'itemHelper';
|
|||||||
import mediaInfo from 'mediaInfo';
|
import mediaInfo from 'mediaInfo';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
@ -30,18 +29,18 @@ import 'css!assets/css/videoosd';
|
|||||||
options.type = options.type || 'Primary';
|
options.type = options.type || 'Primary';
|
||||||
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
|
||||||
options.tag = item.SeriesPrimaryImageTag;
|
options.tag = item.SeriesPrimaryImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.type === 'Thumb') {
|
if (options.type === 'Thumb') {
|
||||||
if (item.SeriesThumbImageTag) {
|
if (item.SeriesThumbImageTag) {
|
||||||
options.tag = item.SeriesThumbImageTag;
|
options.tag = item.SeriesThumbImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.ParentThumbImageTag) {
|
if (item.ParentThumbImageTag) {
|
||||||
options.tag = item.ParentThumbImageTag;
|
options.tag = item.ParentThumbImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,12 +53,12 @@ import 'css!assets/css/videoosd';
|
|||||||
|
|
||||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
options.tag = item.ImageTags[options.type];
|
options.tag = item.ImageTags[options.type];
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.type === 'Primary' && item.AlbumId && item.AlbumPrimaryImageTag) {
|
if (options.type === 'Primary' && item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
options.tag = item.AlbumPrimaryImageTag;
|
options.tag = item.AlbumPrimaryImageTag;
|
||||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -118,7 +117,7 @@ import 'css!assets/css/videoosd';
|
|||||||
|
|
||||||
function getDisplayItem(item) {
|
function getDisplayItem(item) {
|
||||||
if (item.Type === 'TvChannel') {
|
if (item.Type === 'TvChannel') {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (refreshedItem) {
|
return apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (refreshedItem) {
|
||||||
return {
|
return {
|
||||||
originalItem: refreshedItem,
|
originalItem: refreshedItem,
|
||||||
@ -142,7 +141,7 @@ import 'css!assets/css/videoosd';
|
|||||||
return void view.querySelector('.btnRecord').classList.add('hide');
|
return void view.querySelector('.btnRecord').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionManager.getApiClient(item.ServerId).getCurrentUser().then(function (user) {
|
window.connectionManager.getApiClient(item.ServerId).getCurrentUser().then(function (user) {
|
||||||
if (user.Policy.EnableLiveTvManagement) {
|
if (user.Policy.EnableLiveTvManagement) {
|
||||||
import('recordingButton').then(({default: RecordingButton}) => {
|
import('recordingButton').then(({default: RecordingButton}) => {
|
||||||
if (recordingButtonManager) {
|
if (recordingButtonManager) {
|
||||||
@ -1623,7 +1622,7 @@ import 'css!assets/css/videoosd';
|
|||||||
const item = currentItem;
|
const item = currentItem;
|
||||||
|
|
||||||
if (item && item.Chapters && item.Chapters.length && item.Chapters[0].ImageTag) {
|
if (item && item.Chapters && item.Chapters.length && item.Chapters[0].ImageTag) {
|
||||||
const html = getChapterBubbleHtml(connectionManager.getApiClient(item.ServerId), item, item.Chapters, ticks);
|
const html = getChapterBubbleHtml(window.connectionManager.getApiClient(item.ServerId), item, item.Chapters, ticks);
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
return html;
|
return html;
|
||||||
|
@ -36,7 +36,7 @@ import 'emby-button';
|
|||||||
function submitServer(page) {
|
function submitServer(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
const host = page.querySelector('#txtServerHost').value;
|
const host = page.querySelector('#txtServerHost').value;
|
||||||
ConnectionManager.connectToAddress(host, {
|
window.connectionManager.connectToAddress(host, {
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
handleConnectionResult(page, result);
|
handleConnectionResult(page, result);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import appHost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import appSettings from 'appSettings';
|
import appSettings from 'appSettings';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import libraryMenu from 'libraryMenu';
|
import libraryMenu from 'libraryMenu';
|
||||||
@ -139,7 +138,7 @@ import 'emby-checkbox';
|
|||||||
const serverId = params.serverid;
|
const serverId = params.serverid;
|
||||||
|
|
||||||
if (serverId) {
|
if (serverId) {
|
||||||
return connectionManager.getOrCreateApiClient(serverId);
|
return window.connectionManager.getOrCreateApiClient(serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiClient;
|
return ApiClient;
|
||||||
|
@ -4,7 +4,6 @@ import layoutManager from 'layoutManager';
|
|||||||
import libraryMenu from 'libraryMenu';
|
import libraryMenu from 'libraryMenu';
|
||||||
import appSettings from 'appSettings';
|
import appSettings from 'appSettings';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import actionSheet from 'actionsheet';
|
import actionSheet from 'actionsheet';
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
@ -113,7 +112,7 @@ import 'emby-button';
|
|||||||
export default function (view, params) {
|
export default function (view, params) {
|
||||||
function connectToServer(server) {
|
function connectToServer(server) {
|
||||||
loading.show();
|
loading.show();
|
||||||
connectionManager.connectToServer(server, {
|
window.connectionManager.connectToServer(server, {
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
@ -145,7 +144,7 @@ import 'emby-button';
|
|||||||
|
|
||||||
function deleteServer(server) {
|
function deleteServer(server) {
|
||||||
loading.show();
|
loading.show();
|
||||||
connectionManager.deleteServer(server.Id).then(function () {
|
window.connectionManager.deleteServer(server.Id).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
loadServers();
|
loadServers();
|
||||||
});
|
});
|
||||||
@ -187,7 +186,7 @@ import 'emby-button';
|
|||||||
|
|
||||||
function loadServers() {
|
function loadServers() {
|
||||||
loading.show();
|
loading.show();
|
||||||
connectionManager.getAvailableServers().then(onServersRetrieved);
|
window.connectionManager.getAvailableServers().then(onServersRetrieved);
|
||||||
}
|
}
|
||||||
|
|
||||||
let servers;
|
let servers;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import itemShortcuts from 'itemShortcuts';
|
import itemShortcuts from 'itemShortcuts';
|
||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
@ -103,7 +102,7 @@ import 'webcomponents';
|
|||||||
}
|
}
|
||||||
|
|
||||||
const serverId = el.getAttribute('data-serverid');
|
const serverId = el.getAttribute('data-serverid');
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
@ -24,7 +23,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
const button = this;
|
const button = this;
|
||||||
const id = button.getAttribute('data-id');
|
const id = button.getAttribute('data-id');
|
||||||
const serverId = button.getAttribute('data-serverid');
|
const serverId = button.getAttribute('data-serverid');
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (!button.classList.contains('playstatebutton-played')) {
|
if (!button.classList.contains('playstatebutton-played')) {
|
||||||
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
|
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
@ -28,7 +27,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||||||
const button = this;
|
const button = this;
|
||||||
const id = button.getAttribute('data-id');
|
const id = button.getAttribute('data-id');
|
||||||
const serverId = button.getAttribute('data-serverid');
|
const serverId = button.getAttribute('data-serverid');
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
let likes = this.getAttribute('data-likes');
|
let likes = this.getAttribute('data-likes');
|
||||||
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
||||||
|
@ -2,7 +2,6 @@ import events from 'events';
|
|||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import pluginManager from 'pluginManager';
|
import pluginManager from 'pluginManager';
|
||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
|
|
||||||
function getMinIdleTime() {
|
function getMinIdleTime() {
|
||||||
@ -85,7 +84,7 @@ function ScreenSaverManager() {
|
|||||||
|
|
||||||
this.show = function () {
|
this.show = function () {
|
||||||
let isLoggedIn;
|
let isLoggedIn;
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
|
|
||||||
if (apiClient && apiClient.isLoggedIn()) {
|
if (apiClient && apiClient.isLoggedIn()) {
|
||||||
isLoggedIn = true;
|
isLoggedIn = true;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
class BackdropScreensaver {
|
class BackdropScreensaver {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -21,7 +20,7 @@ class BackdropScreensaver {
|
|||||||
Limit: 200
|
Limit: 200
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiClient = connectionManager.currentApiClient();
|
const apiClient = window.connectionManager.currentApiClient();
|
||||||
apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => {
|
apiClient.getItems(apiClient.getCurrentUserId(), query).then((result) => {
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
import('slideshow').then(({default: Slideshow}) => {
|
import('slideshow').then(({default: Slideshow}) => {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import keyboardnavigation from 'keyboardnavigation';
|
import keyboardnavigation from 'keyboardnavigation';
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
@ -243,7 +242,7 @@ export class BookPlayer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const serverId = item.ServerId;
|
const serverId = item.ServerId;
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
import('epubjs').then(({default: epubjs}) => {
|
import('epubjs').then(({default: epubjs}) => {
|
||||||
|
@ -221,8 +221,8 @@ function getCachedValue(key) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
events.on(ConnectionManager, 'localusersignedin', clearCache);
|
events.on(window.connectionManager, 'localusersignedin', clearCache);
|
||||||
events.on(ConnectionManager, 'localusersignedout', clearCache);
|
events.on(window.connectionManager, 'localusersignedout', clearCache);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getServerAddress: getServerAddress
|
getServerAddress: getServerAddress
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import appSettings from 'appSettings';
|
import appSettings from 'appSettings';
|
||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import castSenderApiLoader from 'castSenderApiLoader';
|
import castSenderApiLoader from 'castSenderApiLoader';
|
||||||
@ -325,11 +324,11 @@ class CastPlayer {
|
|||||||
|
|
||||||
let apiClient;
|
let apiClient;
|
||||||
if (message.options && message.options.ServerId) {
|
if (message.options && message.options.ServerId) {
|
||||||
apiClient = connectionManager.getApiClient(message.options.ServerId);
|
apiClient = window.connectionManager.getApiClient(message.options.ServerId);
|
||||||
} else if (message.options && message.options.items && message.options.items.length) {
|
} else if (message.options && message.options.items && message.options.items.length) {
|
||||||
apiClient = connectionManager.getApiClient(message.options.items[0].ServerId);
|
apiClient = window.connectionManager.getApiClient(message.options.items[0].ServerId);
|
||||||
} else {
|
} else {
|
||||||
apiClient = connectionManager.currentApiClient();
|
apiClient = window.connectionManager.currentApiClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
message = Object.assign(message, {
|
message = Object.assign(message, {
|
||||||
@ -673,7 +672,7 @@ class ChromecastPlayer {
|
|||||||
|
|
||||||
playWithCommand(options, command) {
|
playWithCommand(options, command) {
|
||||||
if (!options.items) {
|
if (!options.items) {
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
const instance = this;
|
const instance = this;
|
||||||
|
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), options.ids[0]).then(function (item) {
|
return apiClient.getItem(apiClient.getCurrentUserId(), options.ids[0]).then(function (item) {
|
||||||
@ -985,7 +984,7 @@ class ChromecastPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shuffle(item) {
|
shuffle(item) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
const userId = apiClient.getCurrentUserId();
|
const userId = apiClient.getCurrentUserId();
|
||||||
|
|
||||||
const instance = this;
|
const instance = this;
|
||||||
@ -998,7 +997,7 @@ class ChromecastPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
instantMix(item) {
|
instantMix(item) {
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
const userId = apiClient.getCurrentUserId();
|
const userId = apiClient.getCurrentUserId();
|
||||||
|
|
||||||
const instance = this;
|
const instance = this;
|
||||||
@ -1036,7 +1035,7 @@ class ChromecastPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const instance = this;
|
const instance = this;
|
||||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
return getItemsForPlayback(apiClient, {
|
return getItemsForPlayback(apiClient, {
|
||||||
Ids: options.ids.join(',')
|
Ids: options.ids.join(',')
|
||||||
|
@ -5,7 +5,6 @@ import loading from 'loading';
|
|||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import {
|
import {
|
||||||
bindEventsToHlsPlayer,
|
bindEventsToHlsPlayer,
|
||||||
destroyHlsPlayer,
|
destroyHlsPlayer,
|
||||||
@ -325,7 +324,7 @@ function tryRemoveElement(elem) {
|
|||||||
|
|
||||||
console.debug(`prefetching hls playlist: ${hlsPlaylistUrl}`);
|
console.debug(`prefetching hls playlist: ${hlsPlaylistUrl}`);
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).ajax({
|
return window.connectionManager.getApiClient(item.ServerId).ajax({
|
||||||
|
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: hlsPlaylistUrl
|
url: hlsPlaylistUrl
|
||||||
@ -1036,7 +1035,7 @@ function tryRemoveElement(elem) {
|
|||||||
*/
|
*/
|
||||||
renderSsaAss(videoElement, track, item) {
|
renderSsaAss(videoElement, track, item) {
|
||||||
const attachments = this._currentPlayOptions.mediaSource.MediaAttachments || [];
|
const attachments = this._currentPlayOptions.mediaSource.MediaAttachments || [];
|
||||||
const apiClient = connectionManager.getApiClient(item);
|
const apiClient = window.connectionManager.getApiClient(item);
|
||||||
const htmlVideoPlayer = this;
|
const htmlVideoPlayer = this;
|
||||||
const options = {
|
const options = {
|
||||||
video: videoElement,
|
video: videoElement,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
export default class PhotoPlayer {
|
export default class PhotoPlayer {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -13,7 +12,7 @@ export default class PhotoPlayer {
|
|||||||
import('slideshow').then(({default: slideshow}) => {
|
import('slideshow').then(({default: slideshow}) => {
|
||||||
var index = options.startIndex || 0;
|
var index = options.startIndex || 0;
|
||||||
|
|
||||||
var apiClient = connectionManager.currentApiClient();
|
var apiClient = window.connectionManager.currentApiClient();
|
||||||
apiClient.getCurrentUser().then(function(result) {
|
apiClient.getCurrentUser().then(function(result) {
|
||||||
var newSlideShow = new slideshow({
|
var newSlideShow = new slideshow({
|
||||||
showTitle: false,
|
showTitle: false,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
|
|
||||||
function showErrorMessage() {
|
function showErrorMessage() {
|
||||||
@ -25,7 +24,7 @@ class PlayAccessValidation {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return connectionManager.getApiClient(serverId).getCurrentUser().then(function (user) {
|
return window.connectionManager.getApiClient(serverId).getCurrentUser().then(function (user) {
|
||||||
if (user.Policy.EnableMediaPlayback) {
|
if (user.Policy.EnableMediaPlayback) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
|
|
||||||
function getActivePlayerId() {
|
function getActivePlayerId() {
|
||||||
const info = playbackManager.getPlayerInfo();
|
const info = playbackManager.getPlayerInfo();
|
||||||
@ -54,10 +53,10 @@ function getCurrentApiClient(instance) {
|
|||||||
const currentServerId = instance.currentServerId;
|
const currentServerId = instance.currentServerId;
|
||||||
|
|
||||||
if (currentServerId) {
|
if (currentServerId) {
|
||||||
return connectionManager.getApiClient(currentServerId);
|
return window.connectionManager.getApiClient(currentServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return connectionManager.currentApiClient();
|
return window.connectionManager.currentApiClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendCommandByName(instance, name, options) {
|
function sendCommandByName(instance, name, options) {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import * as userSettings from 'userSettings';
|
import * as userSettings from 'userSettings';
|
||||||
import skinManager from 'skinManager';
|
import skinManager from 'skinManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
|
|
||||||
// Set the default theme when loading
|
// Set the default theme when loading
|
||||||
skinManager.setTheme(userSettings.theme());
|
skinManager.setTheme(userSettings.theme());
|
||||||
|
|
||||||
// Set the user's prefered theme when signing in
|
// Set the user's prefered theme when signing in
|
||||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
|
||||||
skinManager.setTheme(userSettings.theme());
|
skinManager.setTheme(userSettings.theme());
|
||||||
});
|
});
|
||||||
|
@ -48,7 +48,7 @@ export function onServerChanged(userId, accessToken, apiClient) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function logout() {
|
export function logout() {
|
||||||
ConnectionManager.logout().then(function () {
|
window.connectionManager.logout().then(function () {
|
||||||
let loginPage;
|
let loginPage;
|
||||||
|
|
||||||
if (AppInfo.isNativeApp) {
|
if (AppInfo.isNativeApp) {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import confirm from 'confirm';
|
import confirm from 'confirm';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
@ -15,7 +14,7 @@ export function deleteItem(options) {
|
|||||||
const item = options.item;
|
const item = options.item;
|
||||||
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
return confirm({
|
return confirm({
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import listView from 'listView';
|
import listView from 'listView';
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
@ -358,7 +357,7 @@ function getItemsFunction(options, item) {
|
|||||||
query.Fields += ',' + fields;
|
query.Fields += ',' + fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
if (query.IncludeItemTypes === 'MusicArtist') {
|
if (query.IncludeItemTypes === 'MusicArtist') {
|
||||||
query.IncludeItemTypes = null;
|
query.IncludeItemTypes = null;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import inputManager from 'inputManager';
|
import inputManager from 'inputManager';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import viewManager from 'viewManager';
|
import viewManager from 'viewManager';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
@ -57,10 +56,10 @@ import 'flexStyles';
|
|||||||
|
|
||||||
function getCurrentApiClient() {
|
function getCurrentApiClient() {
|
||||||
if (currentUser && currentUser.localUser) {
|
if (currentUser && currentUser.localUser) {
|
||||||
return connectionManager.getApiClient(currentUser.localUser.ServerId);
|
return window.connectionManager.getApiClient(currentUser.localUser.ServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return connectionManager.currentApiClient();
|
return window.connectionManager.currentApiClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
function lazyLoadViewMenuBarImages() {
|
function lazyLoadViewMenuBarImages() {
|
||||||
@ -749,7 +748,7 @@ import 'flexStyles';
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requiresUserRefresh) {
|
if (requiresUserRefresh) {
|
||||||
connectionManager.user(getCurrentApiClient()).then(updateUserInHeader);
|
window.connectionManager.user(getCurrentApiClient()).then(updateUserInHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,7 +790,7 @@ import 'flexStyles';
|
|||||||
if (user) {
|
if (user) {
|
||||||
Promise.resolve(user);
|
Promise.resolve(user);
|
||||||
} else {
|
} else {
|
||||||
connectionManager.user(getCurrentApiClient()).then(function (user) {
|
window.connectionManager.user(getCurrentApiClient()).then(function (user) {
|
||||||
refreshLibraryInfoInDrawer(user);
|
refreshLibraryInfoInDrawer(user);
|
||||||
updateLibraryMenu(user.localUser);
|
updateLibraryMenu(user.localUser);
|
||||||
});
|
});
|
||||||
@ -957,8 +956,8 @@ import 'flexStyles';
|
|||||||
|
|
||||||
renderHeader();
|
renderHeader();
|
||||||
|
|
||||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
|
||||||
const currentApiClient = connectionManager.getApiClient(user.ServerId);
|
const currentApiClient = window.connectionManager.getApiClient(user.ServerId);
|
||||||
|
|
||||||
currentDrawerType = null;
|
currentDrawerType = null;
|
||||||
currentUser = {
|
currentUser = {
|
||||||
@ -967,13 +966,13 @@ import 'flexStyles';
|
|||||||
|
|
||||||
loadNavDrawer();
|
loadNavDrawer();
|
||||||
|
|
||||||
connectionManager.user(currentApiClient).then(function (user) {
|
window.connectionManager.user(currentApiClient).then(function (user) {
|
||||||
currentUser = user;
|
currentUser = user;
|
||||||
updateUserInHeader(user);
|
updateUserInHeader(user);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on(connectionManager, 'localusersignedout', function () {
|
events.on(window.connectionManager, 'localusersignedout', function () {
|
||||||
currentUser = {};
|
currentUser = {};
|
||||||
updateUserInHeader();
|
updateUserInHeader();
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import connectionManager from 'connectionManager';
|
|
||||||
import playbackManager from 'playbackManager';
|
import playbackManager from 'playbackManager';
|
||||||
import syncPlayManager from 'syncPlayManager';
|
import syncPlayManager from 'syncPlayManager';
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
@ -208,8 +207,8 @@ function bindEvents(apiClient) {
|
|||||||
events.on(apiClient, 'message', onMessageReceived);
|
events.on(apiClient, 'message', onMessageReceived);
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionManager.getApiClients().forEach(bindEvents);
|
window.connectionManager.getApiClients().forEach(bindEvents);
|
||||||
events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
|
events.on(window.connectionManager, 'apiclientcreated', function (e, newApiClient) {
|
||||||
bindEvents(newApiClient);
|
bindEvents(newApiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,30 +56,23 @@ window.pageIdOn = function(eventName, id, fn) {
|
|||||||
var AppInfo = {};
|
var AppInfo = {};
|
||||||
|
|
||||||
function initClient() {
|
function initClient() {
|
||||||
function defineConnectionManager(connectionManager) {
|
|
||||||
window.ConnectionManager = connectionManager;
|
|
||||||
define('connectionManager', [], function () {
|
|
||||||
return connectionManager;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function bindConnectionManagerEvents(connectionManager, events, userSettings) {
|
function bindConnectionManagerEvents(connectionManager, events, userSettings) {
|
||||||
window.Events = events;
|
window.Events = events;
|
||||||
|
|
||||||
connectionManager.currentApiClient = function () {
|
window.connectionManager.currentApiClient = function () {
|
||||||
if (!localApiClient) {
|
if (!localApiClient) {
|
||||||
var server = connectionManager.getLastUsedServer();
|
var server = window.connectionManager.getLastUsedServer();
|
||||||
|
|
||||||
if (server) {
|
if (server) {
|
||||||
localApiClient = connectionManager.getApiClient(server.Id);
|
localApiClient = window.connectionManager.getApiClient(server.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return localApiClient;
|
return localApiClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
connectionManager.onLocalUserSignedIn = function (user) {
|
window.connectionManager.onLocalUserSignedIn = function (user) {
|
||||||
localApiClient = connectionManager.getApiClient(user.ServerId);
|
localApiClient = window.connectionManager.getApiClient(user.ServerId);
|
||||||
window.ApiClient = localApiClient;
|
window.ApiClient = localApiClient;
|
||||||
return userSettings.setUserInfo(user.Id, localApiClient);
|
return userSettings.setUserInfo(user.Id, localApiClient);
|
||||||
};
|
};
|
||||||
@ -99,10 +92,9 @@ function initClient() {
|
|||||||
return Promise.all(promises).then(function (responses) {
|
return Promise.all(promises).then(function (responses) {
|
||||||
var capabilities = Dashboard.capabilities(appHost);
|
var capabilities = Dashboard.capabilities(appHost);
|
||||||
|
|
||||||
var connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
window.connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
||||||
|
|
||||||
defineConnectionManager(connectionManager);
|
bindConnectionManagerEvents(window.connectionManager, events, userSettings);
|
||||||
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
|
||||||
|
|
||||||
if (!AppInfo.isNativeApp) {
|
if (!AppInfo.isNativeApp) {
|
||||||
console.debug('loading ApiClient singleton');
|
console.debug('loading ApiClient singleton');
|
||||||
@ -115,7 +107,7 @@ function initClient() {
|
|||||||
apiClient.enableAutomaticNetworking = false;
|
apiClient.enableAutomaticNetworking = false;
|
||||||
apiClient.manualAddressOnly = true;
|
apiClient.manualAddressOnly = true;
|
||||||
|
|
||||||
connectionManager.addApiClient(apiClient);
|
window.connectionManager.addApiClient(apiClient);
|
||||||
|
|
||||||
window.ApiClient = apiClient;
|
window.ApiClient = apiClient;
|
||||||
localApiClient = apiClient;
|
localApiClient = apiClient;
|
||||||
@ -225,8 +217,8 @@ function initClient() {
|
|||||||
require(['autoFocuser'], function(autoFocuser) {
|
require(['autoFocuser'], function(autoFocuser) {
|
||||||
autoFocuser.enable();
|
autoFocuser.enable();
|
||||||
});
|
});
|
||||||
require(['globalize', 'connectionManager', 'events'], function (globalize, connectionManager, events) {
|
require(['globalize', 'events'], function (globalize, events) {
|
||||||
events.on(connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
events.on(window.connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -374,7 +366,7 @@ function initClient() {
|
|||||||
|
|
||||||
require(['playerSelectionMenu']);
|
require(['playerSelectionMenu']);
|
||||||
|
|
||||||
var apiClient = window.ConnectionManager && window.ConnectionManager.currentApiClient();
|
var apiClient = window.connectionManager && window.connectionManager.currentApiClient();
|
||||||
if (apiClient) {
|
if (apiClient) {
|
||||||
fetch(apiClient.getUrl('Branding/Css'))
|
fetch(apiClient.getUrl('Branding/Css'))
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
@ -675,9 +667,6 @@ function initClient() {
|
|||||||
define('mouseManager', [scriptsPath + '/mouseManager'], returnFirstDependency);
|
define('mouseManager', [scriptsPath + '/mouseManager'], returnFirstDependency);
|
||||||
define('scrollManager', [componentsPath + '/scrollManager'], returnFirstDependency);
|
define('scrollManager', [componentsPath + '/scrollManager'], returnFirstDependency);
|
||||||
define('autoFocuser', [componentsPath + '/autoFocuser'], returnFirstDependency);
|
define('autoFocuser', [componentsPath + '/autoFocuser'], returnFirstDependency);
|
||||||
define('connectionManager', [], function () {
|
|
||||||
return ConnectionManager;
|
|
||||||
});
|
|
||||||
define('apiClientResolver', [], function () {
|
define('apiClientResolver', [], function () {
|
||||||
return function () {
|
return function () {
|
||||||
return window.ApiClient;
|
return window.ApiClient;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import serverNotifications from 'serverNotifications';
|
import serverNotifications from 'serverNotifications';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import 'emby-button';
|
import 'emby-button';
|
||||||
|
|
||||||
export default function (options) {
|
export default function (options) {
|
||||||
function pollTasks() {
|
function pollTasks() {
|
||||||
connectionManager.getApiClient(serverId).getScheduledTasks({
|
window.connectionManager.getApiClient(serverId).getScheduledTasks({
|
||||||
IsEnabled: true
|
IsEnabled: true
|
||||||
}).then(updateTasks);
|
}).then(updateTasks);
|
||||||
}
|
}
|
||||||
@ -64,7 +63,7 @@ export default function (options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onScheduledTaskMessageConfirmed(id) {
|
function onScheduledTaskMessageConfirmed(id) {
|
||||||
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
|
window.connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onButtonClick() {
|
function onButtonClick() {
|
||||||
@ -82,13 +81,13 @@ export default function (options) {
|
|||||||
const serverId = ApiClient.serverId();
|
const serverId = ApiClient.serverId();
|
||||||
|
|
||||||
function onPollIntervalFired() {
|
function onPollIntervalFired() {
|
||||||
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
if (!window.connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||||
pollTasks();
|
pollTasks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startInterval() {
|
function startInterval() {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (pollInterval) {
|
if (pollInterval) {
|
||||||
clearInterval(pollInterval);
|
clearInterval(pollInterval);
|
||||||
@ -98,7 +97,7 @@ export default function (options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stopInterval() {
|
function stopInterval() {
|
||||||
connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
|
window.connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
|
||||||
|
|
||||||
if (pollInterval) {
|
if (pollInterval) {
|
||||||
clearInterval(pollInterval);
|
clearInterval(pollInterval);
|
||||||
|
Loading…
Reference in New Issue
Block a user