mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
commit
5d38d09982
12 changed files with 27 additions and 82 deletions
|
@ -225,10 +225,6 @@ function onRecordChange(e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendToast(msg) {
|
|
||||||
toast(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onRecordSeriesChange(e) {
|
function onRecordSeriesChange(e) {
|
||||||
this.changed = true;
|
this.changed = true;
|
||||||
|
|
||||||
|
@ -252,7 +248,7 @@ function onRecordSeriesChange(e) {
|
||||||
} else {
|
} else {
|
||||||
if (this.SeriesTimerId) {
|
if (this.SeriesTimerId) {
|
||||||
apiClient.cancelLiveTvSeriesTimer(this.SeriesTimerId).then(function () {
|
apiClient.cancelLiveTvSeriesTimer(this.SeriesTimerId).then(function () {
|
||||||
sendToast(globalize.translate('RecordingCancelled'));
|
toast(globalize.translate('RecordingCancelled'));
|
||||||
fetchData(self);
|
fetchData(self);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ function changeRecordingToSeries(apiClient, timerId, programId, confirmTimerCanc
|
||||||
return apiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (timerDefaults) {
|
return apiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (timerDefaults) {
|
||||||
return apiClient.createLiveTvSeriesTimer(timerDefaults).then(function () {
|
return apiClient.createLiveTvSeriesTimer(timerDefaults).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
sendToast(globalize.translate('SeriesRecordingScheduled'));
|
toast(globalize.translate('SeriesRecordingScheduled'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,7 @@ function cancelTimer(apiClient, timerId, hideLoading) {
|
||||||
return apiClient.cancelLiveTvTimer(timerId).then(function () {
|
return apiClient.cancelLiveTvTimer(timerId).then(function () {
|
||||||
if (hideLoading !== false) {
|
if (hideLoading !== false) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
sendToast(globalize.translate('RecordingCancelled'));
|
toast(globalize.translate('RecordingCancelled'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,15 +90,11 @@ function createRecording(apiClient, programId, isSeries) {
|
||||||
|
|
||||||
return promise.then(function () {
|
return promise.then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
sendToast(globalize.translate('RecordingScheduled'));
|
toast(globalize.translate('RecordingScheduled'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendToast(msg) {
|
|
||||||
toast(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
const items = [];
|
const items = [];
|
||||||
|
|
|
@ -865,7 +865,7 @@ export default function () {
|
||||||
}, currentPlayer);
|
}, currentPlayer);
|
||||||
form.querySelector('input').value = '';
|
form.querySelector('input').value = '';
|
||||||
|
|
||||||
toast('Message sent.');
|
toast(globalize.translate('MessageSent'));
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -882,7 +882,7 @@ export default function () {
|
||||||
}, currentPlayer);
|
}, currentPlayer);
|
||||||
form.querySelector('input').value = '';
|
form.querySelector('input').value = '';
|
||||||
|
|
||||||
toast('Text sent.');
|
toast(globalize.translate('TextSent'));
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -167,10 +167,6 @@ import toast from './toast/toast';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendToast(text) {
|
|
||||||
toast(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
function executeAction(card, target, action) {
|
function executeAction(card, target, action) {
|
||||||
target = target || card;
|
target = target || card;
|
||||||
|
|
||||||
|
@ -222,7 +218,7 @@ import toast from './toast/toast';
|
||||||
ids: [playableItemId],
|
ids: [playableItemId],
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
});
|
});
|
||||||
sendToast(globalize.translate('MediaQueued'));
|
toast(globalize.translate('MediaQueued'));
|
||||||
} else {
|
} else {
|
||||||
playbackManager.queue({
|
playbackManager.queue({
|
||||||
ids: [playableItemId],
|
ids: [playableItemId],
|
||||||
|
|
|
@ -72,19 +72,6 @@ export function stringToGuid(input) {
|
||||||
return input.replace(/([0-z]{8})([0-z]{4})([0-z]{4})([0-z]{4})([0-z]{12})/, '$1-$2-$3-$4-$5');
|
return input.replace(/([0-z]{8})([0-z]{4})([0-z]{4})([0-z]{4})([0-z]{12})/, '$1-$2-$3-$4-$5');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Triggers a show-message event.
|
|
||||||
* @param {Object} syncPlayManager The SyncPlay manager.
|
|
||||||
* @param {string} message The message name.
|
|
||||||
* @param {Array} args Extra data needed for the message, optional.
|
|
||||||
*/
|
|
||||||
export function showMessage(syncPlayManager, message, args = []) {
|
|
||||||
Events.trigger(syncPlayManager, 'show-message', [{
|
|
||||||
message: message,
|
|
||||||
args: args
|
|
||||||
}]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getItemsForPlayback(apiClient, query) {
|
export function getItemsForPlayback(apiClient, query) {
|
||||||
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(',');
|
||||||
|
|
|
@ -9,6 +9,8 @@ import TimeSyncCore from './timeSync/TimeSyncCore';
|
||||||
import PlaybackCore from './PlaybackCore';
|
import PlaybackCore from './PlaybackCore';
|
||||||
import QueueCore from './QueueCore';
|
import QueueCore from './QueueCore';
|
||||||
import Controller from './Controller';
|
import Controller from './Controller';
|
||||||
|
import toast from '../../toast/toast';
|
||||||
|
import globalize from '../../../scripts/globalize';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that manages the SyncPlay feature.
|
* Class that manages the SyncPlay feature.
|
||||||
|
@ -183,17 +185,17 @@ class Manager {
|
||||||
this.queueCore.updatePlayQueue(apiClient, cmd.Data);
|
this.queueCore.updatePlayQueue(apiClient, cmd.Data);
|
||||||
break;
|
break;
|
||||||
case 'UserJoined':
|
case 'UserJoined':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayUserJoined', [cmd.Data]);
|
toast(globalize.translate('MessageSyncPlayUserJoined', cmd.Data));
|
||||||
break;
|
break;
|
||||||
case 'UserLeft':
|
case 'UserLeft':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayUserLeft', [cmd.Data]);
|
toast(globalize.translate('MessageSyncPlayUserLeft', cmd.Data));
|
||||||
break;
|
break;
|
||||||
case 'GroupJoined':
|
case 'GroupJoined':
|
||||||
cmd.Data.LastUpdatedAt = new Date(cmd.Data.LastUpdatedAt);
|
cmd.Data.LastUpdatedAt = new Date(cmd.Data.LastUpdatedAt);
|
||||||
this.enableSyncPlay(apiClient, cmd.Data, true);
|
this.enableSyncPlay(apiClient, cmd.Data, true);
|
||||||
break;
|
break;
|
||||||
case 'SyncPlayIsDisabled':
|
case 'SyncPlayIsDisabled':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayIsDisabled');
|
toast(globalize.translate('MessageSyncPlayIsDisabled'));
|
||||||
break;
|
break;
|
||||||
case 'NotInGroup':
|
case 'NotInGroup':
|
||||||
case 'GroupLeft':
|
case 'GroupLeft':
|
||||||
|
@ -208,16 +210,16 @@ class Manager {
|
||||||
console.debug(`SyncPlay processGroupUpdate: state changed to ${cmd.Data.State} because ${cmd.Data.Reason}.`);
|
console.debug(`SyncPlay processGroupUpdate: state changed to ${cmd.Data.State} because ${cmd.Data.Reason}.`);
|
||||||
break;
|
break;
|
||||||
case 'GroupDoesNotExist':
|
case 'GroupDoesNotExist':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayGroupDoesNotExist');
|
toast(globalize.translate('MessageSyncPlayGroupDoesNotExist'));
|
||||||
break;
|
break;
|
||||||
case 'CreateGroupDenied':
|
case 'CreateGroupDenied':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayCreateGroupDenied');
|
toast(globalize.translate('MessageSyncPlayCreateGroupDenied'));
|
||||||
break;
|
break;
|
||||||
case 'JoinGroupDenied':
|
case 'JoinGroupDenied':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayJoinGroupDenied');
|
toast(globalize.translate('MessageSyncPlayJoinGroupDenied'));
|
||||||
break;
|
break;
|
||||||
case 'LibraryAccessDenied':
|
case 'LibraryAccessDenied':
|
||||||
Helper.showMessage(this, 'MessageSyncPlayLibraryAccessDenied');
|
toast(globalize.translate('MessageSyncPlayLibraryAccessDenied'));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error(`SyncPlay processGroupUpdate: command ${cmd.Type} not recognised.`);
|
console.error(`SyncPlay processGroupUpdate: command ${cmd.Type} not recognised.`);
|
||||||
|
@ -371,7 +373,7 @@ class Manager {
|
||||||
this.timeSyncCore.forceUpdate();
|
this.timeSyncCore.forceUpdate();
|
||||||
|
|
||||||
if (showMessage) {
|
if (showMessage) {
|
||||||
Helper.showMessage(this, 'MessageSyncPlayEnabled');
|
toast(globalize.translate('MessageSyncPlayEnabled'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +392,7 @@ class Manager {
|
||||||
this.playerWrapper.unbindFromPlayer();
|
this.playerWrapper.unbindFromPlayer();
|
||||||
|
|
||||||
if (showMessage) {
|
if (showMessage) {
|
||||||
Helper.showMessage(this, 'MessageSyncPlayDisabled');
|
toast(globalize.translate('MessageSyncPlayDisabled'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
* @module components/syncPlay/core/QueueCore
|
* @module components/syncPlay/core/QueueCore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import globalize from '../../../scripts/globalize';
|
||||||
|
import toast from '../../toast/toast';
|
||||||
import * as Helper from './Helper';
|
import * as Helper from './Helper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,7 +187,7 @@ class QueueCore {
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('Error while waiting for `playbackstart` event!', origin, error);
|
console.error('Error while waiting for `playbackstart` event!', origin, error);
|
||||||
if (!this.manager.isSyncPlayEnabled()) {
|
if (!this.manager.isSyncPlayEnabled()) {
|
||||||
Helper.showMessage(this.manager, 'MessageSyncPlayErrorMedia');
|
toast(globalize.translate('MessageSyncPlayErrorMedia'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.manager.haltGroupPlayback(apiClient);
|
this.manager.haltGroupPlayback(apiClient);
|
||||||
|
@ -234,7 +236,7 @@ class QueueCore {
|
||||||
this.scheduleReadyRequestOnPlaybackStart(apiClient, 'startPlayback');
|
this.scheduleReadyRequestOnPlaybackStart(apiClient, 'startPlayback');
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Helper.showMessage(this.manager, 'MessageSyncPlayErrorMedia');
|
toast(globalize.translate('MessageSyncPlayErrorMedia'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/**
|
|
||||||
* Module that notifies user about SyncPlay messages using toasts.
|
|
||||||
* @module components/syncPlay/syncPlayToasts
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Events } from 'jellyfin-apiclient';
|
|
||||||
import toast from '../../toast/toast';
|
|
||||||
import globalize from '../../../scripts/globalize';
|
|
||||||
import SyncPlay from '../core';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class that notifies user about SyncPlay messages using toasts.
|
|
||||||
*/
|
|
||||||
class SyncPlayToasts {
|
|
||||||
constructor() {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listens for messages to show.
|
|
||||||
*/
|
|
||||||
init() {
|
|
||||||
Events.on(SyncPlay.Manager, 'show-message', (event, data) => {
|
|
||||||
const { message, args = [] } = data;
|
|
||||||
toast({
|
|
||||||
text: globalize.translate(message, ...args)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** SyncPlayToasts singleton. */
|
|
||||||
const syncPlayToasts = new SyncPlayToasts();
|
|
||||||
export default syncPlayToasts;
|
|
|
@ -635,7 +635,7 @@ import toast from '../../../components/toast/toast';
|
||||||
data: JSON.stringify(profile),
|
data: JSON.stringify(profile),
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
toast('Settings saved.');
|
toast(globalize.translate('SettingsSaved'));
|
||||||
}, Dashboard.processErrorResponse);
|
}, Dashboard.processErrorResponse);
|
||||||
} else {
|
} else {
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
|
|
|
@ -122,9 +122,9 @@ export function processErrorResponse(response) {
|
||||||
status = response.statusText;
|
status = response.statusText;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert({
|
baseAlert({
|
||||||
title: status,
|
title: status,
|
||||||
message: response.headers ? response.headers.get('X-Application-Error-Code') : null
|
text: response.headers ? response.headers.get('X-Application-Error-Code') : null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import '../legacy/focusPreventScroll';
|
||||||
import '../legacy/vendorStyles';
|
import '../legacy/vendorStyles';
|
||||||
import SyncPlay from '../components/syncPlay/core';
|
import SyncPlay from '../components/syncPlay/core';
|
||||||
import { playbackManager } from '../components/playback/playbackmanager';
|
import { playbackManager } from '../components/playback/playbackmanager';
|
||||||
import SyncPlayToasts from '../components/syncPlay/ui/syncPlayToasts';
|
|
||||||
import SyncPlayNoActivePlayer from '../components/syncPlay/ui/players/NoActivePlayer';
|
import SyncPlayNoActivePlayer from '../components/syncPlay/ui/players/NoActivePlayer';
|
||||||
import SyncPlayHtmlVideoPlayer from '../components/syncPlay/ui/players/HtmlVideoPlayer';
|
import SyncPlayHtmlVideoPlayer from '../components/syncPlay/ui/players/HtmlVideoPlayer';
|
||||||
import SyncPlayHtmlAudioPlayer from '../components/syncPlay/ui/players/HtmlAudioPlayer';
|
import SyncPlayHtmlAudioPlayer from '../components/syncPlay/ui/players/HtmlAudioPlayer';
|
||||||
|
@ -169,7 +168,6 @@ function initSyncPlay() {
|
||||||
// Start SyncPlay.
|
// Start SyncPlay.
|
||||||
const apiClient = ServerConnections.currentApiClient();
|
const apiClient = ServerConnections.currentApiClient();
|
||||||
if (apiClient) SyncPlay.Manager.init(apiClient);
|
if (apiClient) SyncPlay.Manager.init(apiClient);
|
||||||
SyncPlayToasts.init();
|
|
||||||
|
|
||||||
// FIXME: Multiple apiClients?
|
// FIXME: Multiple apiClients?
|
||||||
Events.on(ServerConnections, 'apiclientcreated', (e, newApiClient) => SyncPlay.Manager.init(newApiClient));
|
Events.on(ServerConnections, 'apiclientcreated', (e, newApiClient) => SyncPlay.Manager.init(newApiClient));
|
||||||
|
|
|
@ -1025,6 +1025,7 @@
|
||||||
"MessagePluginInstalled": "The plugin has been successfully installed. The server will need to be restarted for changes to take effect.",
|
"MessagePluginInstalled": "The plugin has been successfully installed. The server will need to be restarted for changes to take effect.",
|
||||||
"MessagePluginInstallError": "An error occured while installing the plugin.",
|
"MessagePluginInstallError": "An error occured while installing the plugin.",
|
||||||
"MessageReenableUser": "See below to reenable",
|
"MessageReenableUser": "See below to reenable",
|
||||||
|
"MessageSent": "Message sent.",
|
||||||
"MessageSyncPlayCreateGroupDenied": "Permission required to create a group.",
|
"MessageSyncPlayCreateGroupDenied": "Permission required to create a group.",
|
||||||
"MessageSyncPlayDisabled": "SyncPlay disabled.",
|
"MessageSyncPlayDisabled": "SyncPlay disabled.",
|
||||||
"MessageSyncPlayEnabled": "SyncPlay enabled.",
|
"MessageSyncPlayEnabled": "SyncPlay enabled.",
|
||||||
|
@ -1394,6 +1395,7 @@
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
"TagsValue": "Tags: {0}",
|
"TagsValue": "Tags: {0}",
|
||||||
"TellUsAboutYourself": "Tell us about yourself",
|
"TellUsAboutYourself": "Tell us about yourself",
|
||||||
|
"TextSent": "Text sent.",
|
||||||
"ThemeSongs": "Theme songs",
|
"ThemeSongs": "Theme songs",
|
||||||
"ThemeVideos": "Theme videos",
|
"ThemeVideos": "Theme videos",
|
||||||
"TheseSettingsAffectSubtitlesOnThisDevice": "These settings affect subtitles on this device",
|
"TheseSettingsAffectSubtitlesOnThisDevice": "These settings affect subtitles on this device",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue