1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/controllers/dashboard/dlna/profile.js

837 lines
40 KiB
JavaScript
Raw Normal View History

2020-08-14 08:46:34 +02:00
import 'jquery';
import loading from '../../../components/loading/loading';
import globalize from '../../../scripts/globalize';
import '../../../elements/emby-select/emby-select';
import '../../../elements/emby-button/emby-button';
import '../../../elements/emby-input/emby-input';
import '../../../elements/emby-checkbox/emby-checkbox';
2021-01-26 16:25:38 -05:00
import '../../../components/listview/listview.scss';
import Dashboard from '../../../scripts/clientUtils';
import toast from '../../../components/toast/toast';
/* eslint-disable indent */
2018-10-23 01:05:09 +03:00
function loadProfile(page) {
loading.show();
const promise1 = getProfile();
const promise2 = ApiClient.getUsers();
2019-04-02 23:14:16 +01:00
Promise.all([promise1, promise2]).then(function (responses) {
currentProfile = responses[0];
renderProfile(page, currentProfile, responses[1]);
loading.hide();
});
2018-10-23 01:05:09 +03:00
}
function getProfile() {
const id = getParameterByName('id');
const url = id ? 'Dlna/Profiles/' + id : 'Dlna/Profiles/Default';
2019-04-02 23:14:16 +01:00
return ApiClient.getJSON(ApiClient.getUrl(url));
2018-10-23 01:05:09 +03:00
}
function renderProfile(page, profile, users) {
2020-05-04 12:44:12 +02:00
$('#txtName', page).val(profile.Name);
$('.chkMediaType', page).each(function () {
2020-07-30 16:07:13 +02:00
this.checked = (profile.SupportedMediaTypes || '').split(',').indexOf(this.getAttribute('data-value')) != -1;
2019-04-02 23:14:16 +01:00
});
2020-06-07 17:14:01 -06:00
$('#chkEnableAlbumArtInDidl', page).prop('checked', profile.EnableAlbumArtInDidl);
$('#chkEnableSingleImageLimit', page).prop('checked', profile.EnableSingleAlbumArtLimit);
2019-04-02 23:14:16 +01:00
renderXmlDocumentAttributes(page, profile.XmlRootAttributes || []);
const idInfo = profile.Identification || {};
2019-04-02 23:14:16 +01:00
renderIdentificationHeaders(page, idInfo.Headers || []);
renderSubtitleProfiles(page, profile.SubtitleProfiles || []);
2020-05-04 12:44:12 +02:00
$('#txtInfoFriendlyName', page).val(profile.FriendlyName || '');
$('#txtInfoModelName', page).val(profile.ModelName || '');
$('#txtInfoModelNumber', page).val(profile.ModelNumber || '');
$('#txtInfoModelDescription', page).val(profile.ModelDescription || '');
$('#txtInfoModelUrl', page).val(profile.ModelUrl || '');
$('#txtInfoManufacturer', page).val(profile.Manufacturer || '');
$('#txtInfoManufacturerUrl', page).val(profile.ManufacturerUrl || '');
$('#txtInfoSerialNumber', page).val(profile.SerialNumber || '');
$('#txtIdFriendlyName', page).val(idInfo.FriendlyName || '');
$('#txtIdModelName', page).val(idInfo.ModelName || '');
$('#txtIdModelNumber', page).val(idInfo.ModelNumber || '');
$('#txtIdModelDescription', page).val(idInfo.ModelDescription || '');
$('#txtIdModelUrl', page).val(idInfo.ModelUrl || '');
$('#txtIdManufacturer', page).val(idInfo.Manufacturer || '');
$('#txtIdManufacturerUrl', page).val(idInfo.ManufacturerUrl || '');
$('#txtIdSerialNumber', page).val(idInfo.SerialNumber || '');
$('#txtIdDeviceDescription', page).val(idInfo.DeviceDescription || '');
$('#txtAlbumArtPn', page).val(profile.AlbumArtPn || '');
$('#txtAlbumArtMaxWidth', page).val(profile.MaxAlbumArtWidth || '');
$('#txtAlbumArtMaxHeight', page).val(profile.MaxAlbumArtHeight || '');
$('#txtIconMaxWidth', page).val(profile.MaxIconWidth || '');
$('#txtIconMaxHeight', page).val(profile.MaxIconHeight || '');
2020-06-07 17:14:01 -06:00
$('#chkIgnoreTranscodeByteRangeRequests', page).prop('checked', profile.IgnoreTranscodeByteRangeRequests);
2020-05-04 12:44:12 +02:00
$('#txtMaxAllowedBitrate', page).val(profile.MaxStreamingBitrate || '');
$('#txtMusicStreamingTranscodingBitrate', page).val(profile.MusicStreamingTranscodingBitrate || '');
2020-06-07 17:14:01 -06:00
$('#chkRequiresPlainFolders', page).prop('checked', profile.RequiresPlainFolders);
$('#chkRequiresPlainVideoItems', page).prop('checked', profile.RequiresPlainVideoItems);
2020-05-04 12:44:12 +02:00
$('#txtProtocolInfo', page).val(profile.ProtocolInfo || '');
$('#txtXDlnaCap', page).val(profile.XDlnaCap || '');
$('#txtXDlnaDoc', page).val(profile.XDlnaDoc || '');
$('#txtSonyAggregationFlags', page).val(profile.SonyAggregationFlags || '');
2019-04-02 23:14:16 +01:00
profile.DirectPlayProfiles = profile.DirectPlayProfiles || [];
profile.TranscodingProfiles = profile.TranscodingProfiles || [];
profile.ContainerProfiles = profile.ContainerProfiles || [];
profile.CodecProfiles = profile.CodecProfiles || [];
profile.ResponseProfiles = profile.ResponseProfiles || [];
const usersHtml = '<option></option>' + users.map(function (u) {
2020-05-04 12:44:12 +02:00
return '<option value="' + u.Id + '">' + u.Name + '</option>';
}).join('');
$('#selectUser', page).html(usersHtml).val(profile.UserId || '');
2019-04-02 23:14:16 +01:00
renderSubProfiles(page, profile);
2018-10-23 01:05:09 +03:00
}
function renderIdentificationHeaders(page, headers) {
let index = 0;
const html = '<div class="paperList">' + headers.map(function (h) {
let li = '<div class="listItem">';
2020-04-26 02:37:28 +03:00
li += '<span class="material-icons listItemIcon info"></span>';
2019-04-02 23:14:16 +01:00
li += '<div class="listItemBody">';
2020-05-04 12:44:12 +02:00
li += '<h3 class="listItemBodyText">' + h.Name + ': ' + (h.Value || '') + '</h3>';
li += '<div class="listItemBodyText secondary">' + (h.Match || '') + '</div>';
li += '</div>';
2020-04-26 02:37:28 +03:00
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteIdentificationHeader listItemButton" data-index="' + index + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
li += '</div>';
2019-04-02 23:14:16 +01:00
index++;
return li;
2020-05-04 12:44:12 +02:00
}).join('') + '</div>';
const elem = $('.httpHeaderIdentificationList', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteIdentificationHeader', elem).on('click', function () {
const itemIndex = parseInt(this.getAttribute('data-index'));
2019-04-02 23:14:16 +01:00
currentProfile.Identification.Headers.splice(itemIndex, 1);
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
});
2018-10-23 01:05:09 +03:00
}
function openPopup(elem) {
2020-05-04 12:44:12 +02:00
elem.classList.remove('hide');
2018-10-23 01:05:09 +03:00
}
function closePopup(elem) {
2020-05-04 12:44:12 +02:00
elem.classList.add('hide');
2018-10-23 01:05:09 +03:00
}
function editIdentificationHeader(page, header) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = header == null;
2019-04-02 23:14:16 +01:00
header = header || {};
currentSubProfile = header;
const popup = $('#identificationHeaderPopup', page);
2020-05-04 12:44:12 +02:00
$('#txtIdentificationHeaderName', popup).val(header.Name || '');
$('#txtIdentificationHeaderValue', popup).val(header.Value || '');
$('#selectMatchType', popup).val(header.Match || 'Equals');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function saveIdentificationHeader(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Name = $('#txtIdentificationHeaderName', page).val();
currentSubProfile.Value = $('#txtIdentificationHeaderValue', page).val();
currentSubProfile.Match = $('#selectMatchType', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.Identification = currentProfile.Identification || {};
currentProfile.Identification.Headers = currentProfile.Identification.Headers || [];
currentProfile.Identification.Headers.push(currentSubProfile);
}
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#identificationHeaderPopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderXmlDocumentAttributes(page, attribute) {
const html = '<div class="paperList">' + attribute.map(function (h) {
let li = '<div class="listItem">';
2020-04-26 02:37:28 +03:00
li += '<span class="material-icons listItemIcon info"></span>';
2019-04-02 23:14:16 +01:00
li += '<div class="listItemBody">';
2020-05-04 12:44:12 +02:00
li += '<h3 class="listItemBodyText">' + h.Name + ' = ' + (h.Value || '') + '</h3>';
li += '</div>';
2020-04-26 02:37:28 +03:00
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteXmlAttribute listItemButton" data-index="0"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
return li += '</div>';
}).join('') + '</div>';
const elem = $('.xmlDocumentAttributeList', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteXmlAttribute', elem).on('click', function () {
const itemIndex = parseInt(this.getAttribute('data-index'));
2019-04-02 23:14:16 +01:00
currentProfile.XmlRootAttributes.splice(itemIndex, 1);
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
});
2018-10-23 01:05:09 +03:00
}
function editXmlDocumentAttribute(page, attribute) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = attribute == null;
2019-04-02 23:14:16 +01:00
attribute = attribute || {};
currentSubProfile = attribute;
const popup = $('#xmlAttributePopup', page);
2020-05-04 12:44:12 +02:00
$('#txtXmlAttributeName', popup).val(attribute.Name || '');
$('#txtXmlAttributeValue', popup).val(attribute.Value || '');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function saveXmlDocumentAttribute(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Name = $('#txtXmlAttributeName', page).val();
currentSubProfile.Value = $('#txtXmlAttributeValue', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.XmlRootAttributes.push(currentSubProfile);
}
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#xmlAttributePopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderSubtitleProfiles(page, profiles) {
let index = 0;
const html = '<div class="paperList">' + profiles.map(function (h) {
let li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
2020-04-26 02:37:28 +03:00
li += '<span class="material-icons listItemIcon info"></span>';
2019-04-02 23:14:16 +01:00
li += '<div class="listItemBody">';
2020-05-04 12:44:12 +02:00
li += '<h3 class="listItemBodyText">' + (h.Format || '') + '</h3>';
li += '</div>';
2020-04-26 02:37:28 +03:00
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-index="' + index + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
li += '</div>';
2019-04-02 23:14:16 +01:00
index++;
return li;
2020-05-04 12:44:12 +02:00
}).join('') + '</div>';
const elem = $('.subtitleProfileList', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteProfile', elem).on('click', function () {
const itemIndex = parseInt(this.getAttribute('data-index'));
2019-04-02 23:14:16 +01:00
currentProfile.SubtitleProfiles.splice(itemIndex, 1);
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
});
2020-05-04 12:44:12 +02:00
$('.lnkEditSubProfile', elem).on('click', function () {
const itemIndex = parseInt(this.getAttribute('data-index'));
2019-04-02 23:14:16 +01:00
editSubtitleProfile(page, currentProfile.SubtitleProfiles[itemIndex]);
});
2018-10-23 01:05:09 +03:00
}
function editSubtitleProfile(page, profile) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = profile == null;
2019-04-02 23:14:16 +01:00
profile = profile || {};
currentSubProfile = profile;
const popup = $('#subtitleProfilePopup', page);
2020-05-04 12:44:12 +02:00
$('#txtSubtitleProfileFormat', popup).val(profile.Format || '');
$('#selectSubtitleProfileMethod', popup).val(profile.Method || '');
$('#selectSubtitleProfileDidlMode', popup).val(profile.DidlMode || '');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function saveSubtitleProfile(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Format = $('#txtSubtitleProfileFormat', page).val();
currentSubProfile.Method = $('#selectSubtitleProfileMethod', page).val();
currentSubProfile.DidlMode = $('#selectSubtitleProfileDidlMode', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.SubtitleProfiles.push(currentSubProfile);
}
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#subtitleProfilePopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderSubProfiles(page, profile) {
2019-04-02 23:14:16 +01:00
renderDirectPlayProfiles(page, profile.DirectPlayProfiles);
renderTranscodingProfiles(page, profile.TranscodingProfiles);
renderContainerProfiles(page, profile.ContainerProfiles);
renderCodecProfiles(page, profile.CodecProfiles);
renderResponseProfiles(page, profile.ResponseProfiles);
2018-10-23 01:05:09 +03:00
}
function saveDirectPlayProfile(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Type = $('#selectDirectPlayProfileType', page).val();
currentSubProfile.Container = $('#txtDirectPlayContainer', page).val();
currentSubProfile.AudioCodec = $('#txtDirectPlayAudioCodec', page).val();
currentSubProfile.VideoCodec = $('#txtDirectPlayVideoCodec', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.DirectPlayProfiles.push(currentSubProfile);
}
renderSubProfiles(page, currentProfile);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#popupEditDirectPlayProfile', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderDirectPlayProfiles(page, profiles) {
let html = '';
2018-10-23 01:05:09 +03:00
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
let currentType;
2019-04-02 23:14:16 +01:00
2020-07-25 13:42:03 +02:00
for (const [index, profile] of profiles.entries()) {
2019-04-02 23:14:16 +01:00
if (profile.Type !== currentType) {
2020-05-04 12:44:12 +02:00
html += '<li data-role="list-divider">' + profile.Type + '</li>';
2019-04-02 23:14:16 +01:00
currentType = profile.Type;
}
2020-05-04 12:44:12 +02:00
html += '<div>';
2020-07-25 13:42:03 +02:00
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + index + '">';
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
2019-04-02 23:14:16 +01:00
2020-07-30 16:07:13 +02:00
if (profile.Type == 'Video') {
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>';
html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
} else {
2020-07-30 16:07:13 +02:00
if (profile.Type == 'Audio') {
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
}
}
2020-05-04 12:44:12 +02:00
html += '</a>';
2020-07-25 13:42:03 +02:00
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + index + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
html += '</div>';
2018-10-23 01:05:09 +03:00
}
2019-04-02 23:14:16 +01:00
2020-05-04 12:44:12 +02:00
html += '</ul>';
const elem = $('.directPlayProfiles', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteProfile', elem).on('click', function () {
const index = this.getAttribute('data-profileindex');
2019-04-02 23:14:16 +01:00
deleteDirectPlayProfile(page, index);
});
2020-05-04 12:44:12 +02:00
$('.lnkEditSubProfile', elem).on('click', function () {
const index = parseInt(this.getAttribute('data-profileindex'));
2019-04-02 23:14:16 +01:00
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
});
2018-10-23 01:05:09 +03:00
}
function deleteDirectPlayProfile(page, index) {
2019-04-02 23:14:16 +01:00
currentProfile.DirectPlayProfiles.splice(index, 1);
renderDirectPlayProfiles(page, currentProfile.DirectPlayProfiles);
2018-10-23 01:05:09 +03:00
}
function editDirectPlayProfile(page, directPlayProfile) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = directPlayProfile == null;
2019-04-02 23:14:16 +01:00
directPlayProfile = directPlayProfile || {};
currentSubProfile = directPlayProfile;
const popup = $('#popupEditDirectPlayProfile', page);
2020-05-04 12:44:12 +02:00
$('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').trigger('change');
$('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || '');
$('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || '');
$('#txtDirectPlayVideoCodec', popup).val(directPlayProfile.VideoCodec || '');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function renderTranscodingProfiles(page, profiles) {
let html = '';
2018-10-23 01:05:09 +03:00
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
let currentType;
2019-04-02 23:14:16 +01:00
for (let i = 0, length = profiles.length; i < length; i++) {
2020-07-19 17:38:42 +02:00
const profile = profiles[i];
2019-04-02 23:14:16 +01:00
if (profile.Type !== currentType) {
2020-05-04 12:44:12 +02:00
html += '<li data-role="list-divider">' + profile.Type + '</li>';
2019-04-02 23:14:16 +01:00
currentType = profile.Type;
}
2020-05-04 12:44:12 +02:00
html += '<div>';
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
2020-05-04 12:44:12 +02:00
html += '<p>Protocol: ' + (profile.Protocol || 'Http') + '</p>';
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
2019-04-02 23:14:16 +01:00
2020-07-30 16:07:13 +02:00
if (profile.Type == 'Video') {
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>';
html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
} else {
2020-07-30 16:07:13 +02:00
if (profile.Type == 'Audio') {
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
}
}
2020-05-04 12:44:12 +02:00
html += '</a>';
2020-04-26 02:37:28 +03:00
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
html += '</div>';
2018-10-23 01:05:09 +03:00
}
2019-04-02 23:14:16 +01:00
2020-05-04 12:44:12 +02:00
html += '</ul>';
const elem = $('.transcodingProfiles', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteProfile', elem).on('click', function () {
const index = this.getAttribute('data-profileindex');
2019-04-02 23:14:16 +01:00
deleteTranscodingProfile(page, index);
});
2020-05-04 12:44:12 +02:00
$('.lnkEditSubProfile', elem).on('click', function () {
const index = parseInt(this.getAttribute('data-profileindex'));
2019-04-02 23:14:16 +01:00
editTranscodingProfile(page, currentProfile.TranscodingProfiles[index]);
});
2018-10-23 01:05:09 +03:00
}
function editTranscodingProfile(page, transcodingProfile) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = transcodingProfile == null;
2019-04-02 23:14:16 +01:00
transcodingProfile = transcodingProfile || {};
currentSubProfile = transcodingProfile;
const popup = $('#transcodingProfilePopup', page);
2020-05-04 12:44:12 +02:00
$('#selectTranscodingProfileType', popup).val(transcodingProfile.Type || 'Video').trigger('change');
$('#txtTranscodingContainer', popup).val(transcodingProfile.Container || '');
$('#txtTranscodingAudioCodec', popup).val(transcodingProfile.AudioCodec || '');
$('#txtTranscodingVideoCodec', popup).val(transcodingProfile.VideoCodec || '');
$('#selectTranscodingProtocol', popup).val(transcodingProfile.Protocol || 'Http');
2020-06-07 17:14:01 -06:00
$('#chkEnableMpegtsM2TsMode', popup).prop('checked', transcodingProfile.EnableMpegtsM2TsMode || false);
$('#chkEstimateContentLength', popup).prop('checked', transcodingProfile.EstimateContentLength || false);
2020-07-30 16:07:13 +02:00
$('#chkReportByteRangeRequests', popup).prop('checked', transcodingProfile.TranscodeSeekInfo == 'Bytes');
2020-05-04 12:44:12 +02:00
$('.radioTabButton:first', popup).trigger('click');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function deleteTranscodingProfile(page, index) {
2019-04-02 23:14:16 +01:00
currentProfile.TranscodingProfiles.splice(index, 1);
renderTranscodingProfiles(page, currentProfile.TranscodingProfiles);
2018-10-23 01:05:09 +03:00
}
function saveTranscodingProfile(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Type = $('#selectTranscodingProfileType', page).val();
currentSubProfile.Container = $('#txtTranscodingContainer', page).val();
currentSubProfile.AudioCodec = $('#txtTranscodingAudioCodec', page).val();
currentSubProfile.VideoCodec = $('#txtTranscodingVideoCodec', page).val();
currentSubProfile.Protocol = $('#selectTranscodingProtocol', page).val();
currentSubProfile.Context = 'Streaming';
2020-06-07 17:14:01 -06:00
currentSubProfile.EnableMpegtsM2TsMode = $('#chkEnableMpegtsM2TsMode', page).is(':checked');
currentSubProfile.EstimateContentLength = $('#chkEstimateContentLength', page).is(':checked');
currentSubProfile.TranscodeSeekInfo = $('#chkReportByteRangeRequests', page).is(':checked') ? 'Bytes' : 'Auto';
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.TranscodingProfiles.push(currentSubProfile);
}
renderSubProfiles(page, currentProfile);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#transcodingProfilePopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderContainerProfiles(page, profiles) {
let html = '';
2018-10-23 01:05:09 +03:00
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
let currentType;
2019-04-02 23:14:16 +01:00
for (let i = 0, length = profiles.length; i < length; i++) {
2020-07-19 17:38:42 +02:00
const profile = profiles[i];
2019-04-02 23:14:16 +01:00
if (profile.Type !== currentType) {
2020-05-04 12:44:12 +02:00
html += '<li data-role="list-divider">' + profile.Type + '</li>';
2019-04-02 23:14:16 +01:00
currentType = profile.Type;
}
2020-05-04 12:44:12 +02:00
html += '<div>';
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
2019-04-02 23:14:16 +01:00
if (profile.Conditions && profile.Conditions.length) {
2020-05-04 12:44:12 +02:00
html += '<p>';
html += globalize.translate('ValueConditions', profile.Conditions.map(function (c) {
return c.Property;
2020-05-04 12:44:12 +02:00
}).join(', '));
html += '</p>';
2019-04-02 23:14:16 +01:00
}
2020-05-04 12:44:12 +02:00
html += '</a>';
2020-04-26 02:37:28 +03:00
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
html += '</div>';
2018-10-23 01:05:09 +03:00
}
2019-04-02 23:14:16 +01:00
2020-05-04 12:44:12 +02:00
html += '</ul>';
const elem = $('.containerProfiles', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteProfile', elem).on('click', function () {
const index = this.getAttribute('data-profileindex');
2019-04-02 23:14:16 +01:00
deleteContainerProfile(page, index);
});
2020-05-04 12:44:12 +02:00
$('.lnkEditSubProfile', elem).on('click', function () {
const index = parseInt(this.getAttribute('data-profileindex'));
2019-04-02 23:14:16 +01:00
editContainerProfile(page, currentProfile.ContainerProfiles[index]);
});
2018-10-23 01:05:09 +03:00
}
function deleteContainerProfile(page, index) {
2019-04-02 23:14:16 +01:00
currentProfile.ContainerProfiles.splice(index, 1);
renderContainerProfiles(page, currentProfile.ContainerProfiles);
2018-10-23 01:05:09 +03:00
}
function editContainerProfile(page, containerProfile) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = containerProfile == null;
2019-04-02 23:14:16 +01:00
containerProfile = containerProfile || {};
currentSubProfile = containerProfile;
const popup = $('#containerProfilePopup', page);
2020-05-04 12:44:12 +02:00
$('#selectContainerProfileType', popup).val(containerProfile.Type || 'Video').trigger('change');
$('#txtContainerProfileContainer', popup).val(containerProfile.Container || '');
$('.radioTabButton:first', popup).trigger('click');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function saveContainerProfile(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Type = $('#selectContainerProfileType', page).val();
currentSubProfile.Container = $('#txtContainerProfileContainer', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.ContainerProfiles.push(currentSubProfile);
}
renderSubProfiles(page, currentProfile);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#containerProfilePopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderCodecProfiles(page, profiles) {
let html = '';
2018-10-23 01:05:09 +03:00
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
let currentType;
2019-04-02 23:14:16 +01:00
for (let i = 0, length = profiles.length; i < length; i++) {
2020-07-19 17:38:42 +02:00
const profile = profiles[i];
const type = profile.Type.replace('VideoAudio', 'Video Audio');
2019-04-02 23:14:16 +01:00
if (type !== currentType) {
2020-05-04 12:44:12 +02:00
html += '<li data-role="list-divider">' + type + '</li>';
2019-04-02 23:14:16 +01:00
currentType = type;
}
2020-05-04 12:44:12 +02:00
html += '<div>';
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueCodec', profile.Codec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
if (profile.Conditions && profile.Conditions.length) {
2020-05-04 12:44:12 +02:00
html += '<p>';
html += globalize.translate('ValueConditions', profile.Conditions.map(function (c) {
return c.Property;
2020-05-04 12:44:12 +02:00
}).join(', '));
html += '</p>';
2019-04-02 23:14:16 +01:00
}
2020-05-04 12:44:12 +02:00
html += '</a>';
2020-04-26 02:37:28 +03:00
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
html += '</div>';
2018-10-23 01:05:09 +03:00
}
2019-04-02 23:14:16 +01:00
2020-05-04 12:44:12 +02:00
html += '</ul>';
const elem = $('.codecProfiles', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteProfile', elem).on('click', function () {
const index = this.getAttribute('data-profileindex');
2019-04-02 23:14:16 +01:00
deleteCodecProfile(page, index);
});
2020-05-04 12:44:12 +02:00
$('.lnkEditSubProfile', elem).on('click', function () {
const index = parseInt(this.getAttribute('data-profileindex'));
2019-04-02 23:14:16 +01:00
editCodecProfile(page, currentProfile.CodecProfiles[index]);
});
2018-10-23 01:05:09 +03:00
}
function deleteCodecProfile(page, index) {
2019-04-02 23:14:16 +01:00
currentProfile.CodecProfiles.splice(index, 1);
renderCodecProfiles(page, currentProfile.CodecProfiles);
2018-10-23 01:05:09 +03:00
}
function editCodecProfile(page, codecProfile) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = codecProfile == null;
2019-04-02 23:14:16 +01:00
codecProfile = codecProfile || {};
currentSubProfile = codecProfile;
const popup = $('#codecProfilePopup', page);
2020-05-04 12:44:12 +02:00
$('#selectCodecProfileType', popup).val(codecProfile.Type || 'Video').trigger('change');
$('#txtCodecProfileCodec', popup).val(codecProfile.Codec || '');
$('.radioTabButton:first', popup).trigger('click');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function saveCodecProfile(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Type = $('#selectCodecProfileType', page).val();
currentSubProfile.Codec = $('#txtCodecProfileCodec', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.CodecProfiles.push(currentSubProfile);
}
renderSubProfiles(page, currentProfile);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#codecProfilePopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function renderResponseProfiles(page, profiles) {
let html = '';
2018-10-23 01:05:09 +03:00
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
let currentType;
2019-04-02 23:14:16 +01:00
for (let i = 0, length = profiles.length; i < length; i++) {
const profile = profiles[i];
2019-04-02 23:14:16 +01:00
if (profile.Type !== currentType) {
2020-05-04 12:44:12 +02:00
html += '<li data-role="list-divider">' + profile.Type + '</li>';
2019-04-02 23:14:16 +01:00
currentType = profile.Type;
}
2020-05-04 12:44:12 +02:00
html += '<div>';
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
2019-04-02 23:14:16 +01:00
2020-07-30 16:07:13 +02:00
if (profile.Type == 'Video') {
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueVideoCodec', profile.VideoCodec || allText) + '</p>';
html += '<p>' + globalize.translate('ValueAudioCodec', profile.AudioCodec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
} else {
2020-07-30 16:07:13 +02:00
if (profile.Type == 'Audio') {
2020-05-04 12:44:12 +02:00
html += '<p>' + globalize.translate('ValueCodec', profile.AudioCodec || allText) + '</p>';
2019-04-02 23:14:16 +01:00
}
}
if (profile.Conditions && profile.Conditions.length) {
2020-05-04 12:44:12 +02:00
html += '<p>';
html += globalize.translate('ValueConditions', profile.Conditions.map(function (c) {
return c.Property;
2020-05-04 12:44:12 +02:00
}).join(', '));
html += '</p>';
2019-04-02 23:14:16 +01:00
}
2020-05-04 12:44:12 +02:00
html += '</a>';
2020-04-26 02:37:28 +03:00
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><span class="material-icons delete"></span></button>';
2020-05-04 12:44:12 +02:00
html += '</div>';
2018-10-23 01:05:09 +03:00
}
2019-04-02 23:14:16 +01:00
2020-05-04 12:44:12 +02:00
html += '</ul>';
const elem = $('.mediaProfiles', page).html(html).trigger('create');
2020-05-04 12:44:12 +02:00
$('.btnDeleteProfile', elem).on('click', function () {
const index = this.getAttribute('data-profileindex');
2019-04-02 23:14:16 +01:00
deleteResponseProfile(page, index);
});
2020-05-04 12:44:12 +02:00
$('.lnkEditSubProfile', elem).on('click', function () {
const index = parseInt(this.getAttribute('data-profileindex'));
2019-04-02 23:14:16 +01:00
editResponseProfile(page, currentProfile.ResponseProfiles[index]);
});
2018-10-23 01:05:09 +03:00
}
function deleteResponseProfile(page, index) {
2019-04-02 23:14:16 +01:00
currentProfile.ResponseProfiles.splice(index, 1);
renderResponseProfiles(page, currentProfile.ResponseProfiles);
2018-10-23 01:05:09 +03:00
}
function editResponseProfile(page, responseProfile) {
2020-07-30 16:07:13 +02:00
isSubProfileNew = responseProfile == null;
2019-04-02 23:14:16 +01:00
responseProfile = responseProfile || {};
currentSubProfile = responseProfile;
const popup = $('#responseProfilePopup', page);
2020-05-04 12:44:12 +02:00
$('#selectResponseProfileType', popup).val(responseProfile.Type || 'Video').trigger('change');
$('#txtResponseProfileContainer', popup).val(responseProfile.Container || '');
$('#txtResponseProfileAudioCodec', popup).val(responseProfile.AudioCodec || '');
$('#txtResponseProfileVideoCodec', popup).val(responseProfile.VideoCodec || '');
$('.radioTabButton:first', popup).trigger('click');
2019-04-02 23:14:16 +01:00
openPopup(popup[0]);
2018-10-23 01:05:09 +03:00
}
function saveResponseProfile(page) {
2020-05-04 12:44:12 +02:00
currentSubProfile.Type = $('#selectResponseProfileType', page).val();
currentSubProfile.Container = $('#txtResponseProfileContainer', page).val();
currentSubProfile.AudioCodec = $('#txtResponseProfileAudioCodec', page).val();
currentSubProfile.VideoCodec = $('#txtResponseProfileVideoCodec', page).val();
2019-04-02 23:14:16 +01:00
if (isSubProfileNew) {
currentProfile.ResponseProfiles.push(currentSubProfile);
}
renderSubProfiles(page, currentProfile);
currentSubProfile = null;
2020-05-04 12:44:12 +02:00
closePopup($('#responseProfilePopup', page)[0]);
2018-10-23 01:05:09 +03:00
}
function saveProfile(page, profile) {
updateProfile(page, profile);
const id = getParameterByName('id');
2019-04-02 23:14:16 +01:00
if (id) {
ApiClient.ajax({
2020-05-04 12:44:12 +02:00
type: 'POST',
url: ApiClient.getUrl('Dlna/Profiles/' + id),
2019-04-02 23:14:16 +01:00
data: JSON.stringify(profile),
2020-05-04 12:44:12 +02:00
contentType: 'application/json'
2019-04-02 23:14:16 +01:00
}).then(function () {
toast('Settings saved.');
2019-04-02 23:14:16 +01:00
}, Dashboard.processErrorResponse);
} else {
ApiClient.ajax({
2020-05-04 12:44:12 +02:00
type: 'POST',
url: ApiClient.getUrl('Dlna/Profiles'),
2019-04-02 23:14:16 +01:00
data: JSON.stringify(profile),
2020-05-04 12:44:12 +02:00
contentType: 'application/json'
2019-04-02 23:14:16 +01:00
}).then(function () {
2020-05-04 12:44:12 +02:00
Dashboard.navigate('dlnaprofiles.html');
2019-04-02 23:14:16 +01:00
}, Dashboard.processErrorResponse);
}
loading.hide();
2018-10-23 01:05:09 +03:00
}
function updateProfile(page, profile) {
2020-05-04 12:44:12 +02:00
profile.Name = $('#txtName', page).val();
2020-06-07 17:14:01 -06:00
profile.EnableAlbumArtInDidl = $('#chkEnableAlbumArtInDidl', page).is(':checked');
profile.EnableSingleAlbumArtLimit = $('#chkEnableSingleImageLimit', page).is(':checked');
2020-05-04 12:44:12 +02:00
profile.SupportedMediaTypes = $('.chkMediaType:checked', page).get().map(function (c) {
return c.getAttribute('data-value');
}).join(',');
2019-04-02 23:14:16 +01:00
profile.Identification = profile.Identification || {};
2020-05-04 12:44:12 +02:00
profile.FriendlyName = $('#txtInfoFriendlyName', page).val();
profile.ModelName = $('#txtInfoModelName', page).val();
profile.ModelNumber = $('#txtInfoModelNumber', page).val();
profile.ModelDescription = $('#txtInfoModelDescription', page).val();
profile.ModelUrl = $('#txtInfoModelUrl', page).val();
profile.Manufacturer = $('#txtInfoManufacturer', page).val();
profile.ManufacturerUrl = $('#txtInfoManufacturerUrl', page).val();
profile.SerialNumber = $('#txtInfoSerialNumber', page).val();
profile.Identification.FriendlyName = $('#txtIdFriendlyName', page).val();
profile.Identification.ModelName = $('#txtIdModelName', page).val();
profile.Identification.ModelNumber = $('#txtIdModelNumber', page).val();
profile.Identification.ModelDescription = $('#txtIdModelDescription', page).val();
profile.Identification.ModelUrl = $('#txtIdModelUrl', page).val();
profile.Identification.Manufacturer = $('#txtIdManufacturer', page).val();
profile.Identification.ManufacturerUrl = $('#txtIdManufacturerUrl', page).val();
profile.Identification.SerialNumber = $('#txtIdSerialNumber', page).val();
profile.Identification.DeviceDescription = $('#txtIdDeviceDescription', page).val();
profile.AlbumArtPn = $('#txtAlbumArtPn', page).val();
profile.MaxAlbumArtWidth = $('#txtAlbumArtMaxWidth', page).val();
profile.MaxAlbumArtHeight = $('#txtAlbumArtMaxHeight', page).val();
profile.MaxIconWidth = $('#txtIconMaxWidth', page).val();
profile.MaxIconHeight = $('#txtIconMaxHeight', page).val();
2020-06-07 17:14:01 -06:00
profile.RequiresPlainFolders = $('#chkRequiresPlainFolders', page).is(':checked');
profile.RequiresPlainVideoItems = $('#chkRequiresPlainVideoItems', page).is(':checked');
profile.IgnoreTranscodeByteRangeRequests = $('#chkIgnoreTranscodeByteRangeRequests', page).is(':checked');
2020-05-04 12:44:12 +02:00
profile.MaxStreamingBitrate = $('#txtMaxAllowedBitrate', page).val();
profile.MusicStreamingTranscodingBitrate = $('#txtMusicStreamingTranscodingBitrate', page).val();
profile.ProtocolInfo = $('#txtProtocolInfo', page).val();
profile.XDlnaCap = $('#txtXDlnaCap', page).val();
profile.XDlnaDoc = $('#txtXDlnaDoc', page).val();
profile.SonyAggregationFlags = $('#txtSonyAggregationFlags', page).val();
profile.UserId = $('#selectUser', page).val();
2019-04-02 23:14:16 +01:00
}
let currentProfile;
let currentSubProfile;
let isSubProfileNew;
const allText = globalize.translate('All');
2019-04-02 23:14:16 +01:00
2020-05-04 12:44:12 +02:00
$(document).on('pageinit', '#dlnaProfilePage', function () {
const page = this;
2020-05-04 12:44:12 +02:00
$('.radioTabButton', page).on('click', function () {
$(this).siblings().removeClass('ui-btn-active');
$(this).addClass('ui-btn-active');
2020-07-30 16:07:13 +02:00
const value = this.tagName == 'A' ? this.getAttribute('data-value') : this.value;
const elem = $('.' + value, page);
2020-05-04 12:44:12 +02:00
elem.siblings('.tabContent').hide();
2019-04-02 23:14:16 +01:00
elem.show();
});
2020-05-04 12:44:12 +02:00
$('#selectDirectPlayProfileType', page).on('change', function () {
2020-07-30 16:07:13 +02:00
if (this.value == 'Video') {
2020-05-04 12:44:12 +02:00
$('#fldDirectPlayVideoCodec', page).show();
2019-04-02 23:14:16 +01:00
} else {
2020-05-04 12:44:12 +02:00
$('#fldDirectPlayVideoCodec', page).hide();
2019-04-02 23:14:16 +01:00
}
2020-07-30 16:07:13 +02:00
if (this.value == 'Photo') {
2020-05-04 12:44:12 +02:00
$('#fldDirectPlayAudioCodec', page).hide();
2019-04-02 23:14:16 +01:00
} else {
2020-05-04 12:44:12 +02:00
$('#fldDirectPlayAudioCodec', page).show();
2019-04-02 23:14:16 +01:00
}
});
2020-05-04 12:44:12 +02:00
$('#selectTranscodingProfileType', page).on('change', function () {
2020-07-30 16:07:13 +02:00
if (this.value == 'Video') {
2020-05-04 12:44:12 +02:00
$('#fldTranscodingVideoCodec', page).show();
$('#fldTranscodingProtocol', page).show();
$('#fldEnableMpegtsM2TsMode', page).show();
2019-04-02 23:14:16 +01:00
} else {
2020-05-04 12:44:12 +02:00
$('#fldTranscodingVideoCodec', page).hide();
$('#fldTranscodingProtocol', page).hide();
$('#fldEnableMpegtsM2TsMode', page).hide();
2019-04-02 23:14:16 +01:00
}
2020-07-30 16:07:13 +02:00
if (this.value == 'Photo') {
2020-05-04 12:44:12 +02:00
$('#fldTranscodingAudioCodec', page).hide();
$('#fldEstimateContentLength', page).hide();
$('#fldReportByteRangeRequests', page).hide();
2019-04-02 23:14:16 +01:00
} else {
2020-05-04 12:44:12 +02:00
$('#fldTranscodingAudioCodec', page).show();
$('#fldEstimateContentLength', page).show();
$('#fldReportByteRangeRequests', page).show();
2019-04-02 23:14:16 +01:00
}
});
2020-05-04 12:44:12 +02:00
$('#selectResponseProfileType', page).on('change', function () {
2020-07-30 16:07:13 +02:00
if (this.value == 'Video') {
2020-05-04 12:44:12 +02:00
$('#fldResponseProfileVideoCodec', page).show();
2019-04-02 23:14:16 +01:00
} else {
2020-05-04 12:44:12 +02:00
$('#fldResponseProfileVideoCodec', page).hide();
2019-04-02 23:14:16 +01:00
}
2020-07-30 16:07:13 +02:00
if (this.value == 'Photo') {
2020-05-04 12:44:12 +02:00
$('#fldResponseProfileAudioCodec', page).hide();
2019-04-02 23:14:16 +01:00
} else {
2020-05-04 12:44:12 +02:00
$('#fldResponseProfileAudioCodec', page).show();
2019-04-02 23:14:16 +01:00
}
});
2020-05-04 12:44:12 +02:00
$('.btnAddDirectPlayProfile', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editDirectPlayProfile(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddTranscodingProfile', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editTranscodingProfile(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddContainerProfile', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editContainerProfile(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddCodecProfile', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editCodecProfile(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddResponseProfile', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editResponseProfile(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddIdentificationHttpHeader', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editIdentificationHeader(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddXmlDocumentAttribute', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editXmlDocumentAttribute(page);
});
2020-05-04 12:44:12 +02:00
$('.btnAddSubtitleProfile', page).on('click', function () {
2019-04-02 23:14:16 +01:00
editSubtitleProfile(page);
});
2020-05-04 12:44:12 +02:00
$('.dlnaProfileForm').off('submit', DlnaProfilePage.onSubmit).on('submit', DlnaProfilePage.onSubmit);
$('.editDirectPlayProfileForm').off('submit', DlnaProfilePage.onDirectPlayFormSubmit).on('submit', DlnaProfilePage.onDirectPlayFormSubmit);
$('.transcodingProfileForm').off('submit', DlnaProfilePage.onTranscodingProfileFormSubmit).on('submit', DlnaProfilePage.onTranscodingProfileFormSubmit);
$('.containerProfileForm').off('submit', DlnaProfilePage.onContainerProfileFormSubmit).on('submit', DlnaProfilePage.onContainerProfileFormSubmit);
$('.codecProfileForm').off('submit', DlnaProfilePage.onCodecProfileFormSubmit).on('submit', DlnaProfilePage.onCodecProfileFormSubmit);
$('.editResponseProfileForm').off('submit', DlnaProfilePage.onResponseProfileFormSubmit).on('submit', DlnaProfilePage.onResponseProfileFormSubmit);
$('.identificationHeaderForm').off('submit', DlnaProfilePage.onIdentificationHeaderFormSubmit).on('submit', DlnaProfilePage.onIdentificationHeaderFormSubmit);
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
$('.subtitleProfileForm').off('submit', DlnaProfilePage.onSubtitleProfileFormSubmit).on('submit', DlnaProfilePage.onSubtitleProfileFormSubmit);
}).on('pageshow', '#dlnaProfilePage', function () {
const page = this;
2020-05-04 12:44:12 +02:00
$('#radioInfo', page).trigger('click');
2019-04-02 23:14:16 +01:00
loadProfile(page);
});
window.DlnaProfilePage = {
onSubmit: function () {
loading.show();
2020-05-04 12:44:12 +02:00
saveProfile($(this).parents('.page'), currentProfile);
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onDirectPlayFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveDirectPlayProfile($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onTranscodingProfileFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveTranscodingProfile($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onContainerProfileFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveContainerProfile($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onCodecProfileFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveCodecProfile($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onResponseProfileFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveResponseProfile($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onIdentificationHeaderFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveIdentificationHeader($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onXmlAttributeFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveXmlDocumentAttribute($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
},
2019-04-02 23:14:16 +01:00
onSubtitleProfileFormSubmit: function () {
2020-05-04 12:44:12 +02:00
saveSubtitleProfile($(this).parents('.page'));
2019-04-02 23:14:16 +01:00
return false;
2018-10-23 01:05:09 +03:00
}
2019-04-02 23:14:16 +01:00
};
/* eslint-enable indent */