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

update playlist management

This commit is contained in:
Luke Pulverenti 2017-01-14 03:03:46 -05:00
parent 893b492cbb
commit 7a6ac9c251
24 changed files with 121 additions and 79 deletions

View file

@ -231,9 +231,6 @@
.channelTimeslotHeader, .timeslotHeader {
background: transparent;
}
.timeslotHeader, .channelTimeslotHeader {
height: 2.2em;
}
@ -259,6 +256,9 @@
/* Needed for Firefox */
text-align: left;
contain: strict;
flex-grow: 1;
margin: 0 !important;
padding: 0 !important;
}
.programAccent {

View file

@ -33,6 +33,22 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
});
}
if (playbackManager.canQueue(item)) {
if (options.queue !== false) {
commands.push({
name: globalize.translate('sharedcomponents#AddToPlayQueue'),
id: 'queue'
});
}
//if (options.queueAllFromHere) {
// commands.push({
// name: globalize.translate('sharedcomponents#QueueAllFromHere'),
// id: 'queueallfromhere'
// });
//}
}
if ((item.Type === 'Timer') && user.Policy.EnableLiveTvManagement && options.cancelTimer !== false) {
commands.push({
name: globalize.translate('sharedcomponents#CancelRecording'),
@ -152,22 +168,6 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
id: 'playallfromhere'
});
}
if (playbackManager.canQueue(item)) {
if (options.queue !== false) {
commands.push({
name: globalize.translate('sharedcomponents#Queue'),
id: 'queue'
});
}
if (options.queueAllFromHere) {
commands.push({
name: globalize.translate('sharedcomponents#QueueAllFromHere'),
id: 'queueallfromhere'
});
}
}
}
if (item.Type === 'Program' && options.record !== false) {

View file

@ -398,8 +398,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
if (!clickEntireItem) {
if (options.queueButton) {
html += '<button is="paper-icon-button-light" class="listItemButton itemAction autoSize" data-action="queue"><i class="md-icon">&#xE03B;</i></button>';
if (options.addToListButton) {
html += '<button is="paper-icon-button-light" class="listItemButton itemAction autoSize" data-action="addtoplaylist"><i class="md-icon">&#xE03B;</i></button>';
}
if (options.moreButton !== false) {

View file

@ -12,8 +12,8 @@ define(['playbackManager'], function (playbackManager) {
self.intercept = function (options) {
// Don't care about video backdrops or any kind of non-fullscreen playback
if (!options.fullscreen && options.mediaType === 'Video') {
// Don't care about video backdrops, or theme music or any kind of non-fullscreen playback
if (!options.fullscreen) {
return Promise.resolve();
}

View file

@ -1,4 +1,4 @@
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'userSettings', 'embyRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, connectionManager, userSettings, embyRouter, globalize) {
define(['shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager', 'connectionManager', 'userSettings', 'embyRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (shell, dialogHelper, loading, layoutManager, playbackManager, connectionManager, userSettings, embyRouter, globalize) {
'use strict';
var currentServerId;
@ -18,8 +18,6 @@
function onSubmit(e) {
loading.show();
var panel = parentWithClass(this, 'dialog');
var playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
@ -38,6 +36,8 @@
function createPlaylist(apiClient, dlg) {
loading.show();
var url = apiClient.getUrl("Playlists", {
Name: dlg.querySelector('#txtNewPlaylistName').value,
@ -72,9 +72,24 @@
function addToPlaylist(apiClient, dlg, id) {
var itemIds = dlg.querySelector('.fldSelectedItemIds').value || '';
if (id === 'queue') {
playbackManager.queue({
serverId: apiClient.serverId(),
ids: itemIds.split(',')
});
dialogHelper.close(dlg);
showToast();
return;
}
loading.show();
var url = apiClient.getUrl("Playlists/" + id + "/Items", {
Ids: dlg.querySelector('.fldSelectedItemIds').value || '',
Ids: itemIds,
userId: apiClient.getCurrentUserId()
});
@ -87,10 +102,13 @@
loading.hide();
dialogHelper.close(dlg);
showToast();
});
}
require(['toast'], function (toast) {
toast(globalize.translate('sharedcomponents#MessageItemsAdded'));
});
function showToast() {
require(['toast'], function (toast) {
toast(globalize.translate('sharedcomponents#MessageItemsAdded'));
});
}
@ -118,6 +136,7 @@
var html = '';
html += '<option value="queue">' + globalize.translate('sharedcomponents#AddToPlayQueue') + '</option>';
html += '<option value="">' + globalize.translate('sharedcomponents#OptionNew') + '</option>';
html += result.Items.map(function (i) {
@ -127,7 +146,7 @@
select.innerHTML = html;
select.value = userSettings.get('playlisteditor-lastplaylistid') || '';
// If the value is empty set it again, in case we tried to set a lastplaylistid that is no longer valid
if (!select.value) {
select.value = '';
@ -161,7 +180,7 @@
html += '</div>';
html += '<div class="formDialogFooter">';
html += '<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">' + globalize.translate('sharedcomponents#ButtonOk') + '</button>';
html += '<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">' + globalize.translate('sharedcomponents#Add') + '</button>';
html += '</div>';
html += '<input type="hidden" class="fldSelectedItemIds" />';

View file

@ -36,7 +36,7 @@
require(['listViewStyle', 'emby-button', 'formDialogStyle'], function () {
var dlg = dialogHelper.createDialog({
size: 'fullscreen-border',
size: layoutManager.tv ? 'fullscreen' : 'fullscreen-border',
removeOnClose: true,
scrollY: false
});
@ -290,7 +290,7 @@
}
var dlg = dialogHelper.createDialog({
size: 'fullscreen-border',
size: layoutManager.tv ? 'fullscreen' : 'fullscreen-border',
removeOnClose: true,
scrollY: false
});
@ -524,7 +524,7 @@
function restorePurchase(unlockableProductInfo) {
var dlg = dialogHelper.createDialog({
size: 'fullscreen-border',
size: layoutManager.tv ? 'fullscreen' : 'fullscreen-border',
removeOnClose: true,
scrollY: false
});

View file

@ -326,6 +326,21 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'embyRouter', 'g
else if (action === 'playtrailer') {
getItem(target).then(playTrailer);
}
else if (action === 'addtoplaylist') {
getItem(target).then(addToPlaylist);
}
}
function addToPlaylist(item) {
require(['playlistEditor'], function (playlistEditor) {
new playlistEditor().show({
items: [item.Id],
serverId: item.ServerId
});
});
}
function playTrailer(item) {