mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update more route locations
This commit is contained in:
parent
99b7781f9a
commit
34aad3e338
15 changed files with 57 additions and 62 deletions
83
src/controllers/dashboard/apikeys.js
Normal file
83
src/controllers/dashboard/apikeys.js
Normal file
|
@ -0,0 +1,83 @@
|
|||
define(["datetime", "loading", "libraryMenu", "dom", "globalize", "emby-button"], function (datetime, loading, libraryMenu, dom, globalize) {
|
||||
"use strict";
|
||||
|
||||
function revoke(page, key) {
|
||||
require(["confirm"], function (confirm) {
|
||||
confirm(globalize.translate("MessageConfirmRevokeApiKey"), globalize.translate("HeaderConfirmRevokeApiKey")).then(function () {
|
||||
loading.show();
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Auth/Keys/" + key)
|
||||
}).then(function () {
|
||||
loadData(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function renderKeys(page, keys) {
|
||||
var rows = keys.map(function (item) {
|
||||
var html = "";
|
||||
html += '<tr class="detailTableBodyRow detailTableBodyRow-shaded">';
|
||||
html += '<td class="detailTableBodyCell">';
|
||||
html += '<button type="button" is="emby-button" data-token="' + item.AccessToken + '" class="raised raised-mini btnRevoke" data-mini="true" title="' + globalize.translate("ButtonRevoke") + '" style="margin:0;">' + globalize.translate("ButtonRevoke") + "</button>";
|
||||
html += "</td>";
|
||||
html += '<td class="detailTableBodyCell" style="vertical-align:middle;">';
|
||||
html += item.AccessToken;
|
||||
html += "</td>";
|
||||
html += '<td class="detailTableBodyCell" style="vertical-align:middle;">';
|
||||
html += item.AppName || "";
|
||||
html += "</td>";
|
||||
html += '<td class="detailTableBodyCell" style="vertical-align:middle;">';
|
||||
var date = datetime.parseISO8601Date(item.DateCreated, true);
|
||||
html += datetime.toLocaleDateString(date) + " " + datetime.getDisplayTime(date);
|
||||
html += "</td>";
|
||||
return html += "</tr>";
|
||||
}).join("");
|
||||
page.querySelector(".resultBody").innerHTML = rows;
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function loadData(page) {
|
||||
loading.show();
|
||||
ApiClient.getJSON(ApiClient.getUrl("Auth/Keys")).then(function (result) {
|
||||
renderKeys(page, result.Items);
|
||||
});
|
||||
}
|
||||
|
||||
function showNewKeyPrompt(page) {
|
||||
require(["prompt"], function (prompt) {
|
||||
prompt({
|
||||
title: globalize.translate("HeaderNewApiKey"),
|
||||
label: globalize.translate("LabelAppName"),
|
||||
description: globalize.translate("LabelAppNameExample")
|
||||
}).then(function (value) {
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: ApiClient.getUrl("Auth/Keys", {
|
||||
App: value
|
||||
})
|
||||
}).then(function () {
|
||||
loadData(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
pageIdOn("pageinit", "apiKeysPage", function () {
|
||||
var page = this;
|
||||
page.querySelector(".btnNewKey").addEventListener("click", function () {
|
||||
showNewKeyPrompt(page);
|
||||
});
|
||||
page.querySelector(".tblApiKeys").addEventListener("click", function (e) {
|
||||
var btnRevoke = dom.parentWithClass(e.target, "btnRevoke");
|
||||
|
||||
if (btnRevoke) {
|
||||
revoke(page, btnRevoke.getAttribute("data-token"));
|
||||
}
|
||||
});
|
||||
});
|
||||
pageIdOn("pagebeforeshow", "apiKeysPage", function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
50
src/controllers/dashboard/devices/device.js
Normal file
50
src/controllers/dashboard/devices/device.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
define(["loading", "libraryMenu", "dom", "emby-input", "emby-button"], function (loading, libraryMenu, dom) {
|
||||
"use strict";
|
||||
|
||||
function load(page, device, deviceOptions) {
|
||||
page.querySelector("#txtCustomName", page).value = deviceOptions.CustomName || "";
|
||||
page.querySelector(".reportedName", page).innerHTML = device.Name || "";
|
||||
}
|
||||
|
||||
function loadData() {
|
||||
var page = this;
|
||||
loading.show();
|
||||
var id = getParameterByName("id");
|
||||
var promise1 = ApiClient.getJSON(ApiClient.getUrl("Devices/Info", {
|
||||
Id: id
|
||||
}));
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Devices/Options", {
|
||||
Id: id
|
||||
}));
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
load(page, responses[0], responses[1]);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
var id = getParameterByName("id");
|
||||
ApiClient.ajax({
|
||||
url: ApiClient.getUrl("Devices/Options", {
|
||||
Id: id
|
||||
}),
|
||||
type: "POST",
|
||||
data: JSON.stringify({
|
||||
CustomName: page.querySelector("#txtCustomName").value
|
||||
}),
|
||||
contentType: "application/json"
|
||||
}).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
save(dom.parentWithClass(form, "page"));
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
view.querySelector("form").addEventListener("submit", onSubmit);
|
||||
view.addEventListener("viewshow", loadData);
|
||||
};
|
||||
});
|
140
src/controllers/dashboard/devices/devices.js
Normal file
140
src/controllers/dashboard/devices/devices.js
Normal file
|
@ -0,0 +1,140 @@
|
|||
define(["loading", "dom", "libraryMenu", "globalize", "scripts/imagehelper", "date-fns", "dfnshelper", "emby-button", "emby-itemscontainer", "cardStyle"], function (loading, dom, libraryMenu, globalize, imageHelper, datefns, dfnshelper) {
|
||||
"use strict";
|
||||
|
||||
function canDelete(deviceId) {
|
||||
return deviceId !== ApiClient.deviceId();
|
||||
}
|
||||
|
||||
function deleteDevice(page, id) {
|
||||
var msg = globalize.translate("DeleteDeviceConfirmation");
|
||||
|
||||
require(["confirm"], function (confirm) {
|
||||
confirm({
|
||||
text: msg,
|
||||
title: globalize.translate("HeaderDeleteDevice"),
|
||||
confirmText: globalize.translate("ButtonDelete"),
|
||||
primary: "delete"
|
||||
}).then(function () {
|
||||
loading.show();
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Devices", {
|
||||
Id: id
|
||||
})
|
||||
}).then(function () {
|
||||
loadData(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showDeviceMenu(view, btn, deviceId) {
|
||||
var menuItems = [];
|
||||
|
||||
if (canEdit) {
|
||||
menuItems.push({
|
||||
name: globalize.translate("Edit"),
|
||||
id: "open",
|
||||
icon: "mode_edit"
|
||||
});
|
||||
}
|
||||
|
||||
if (canDelete(deviceId)) {
|
||||
menuItems.push({
|
||||
name: globalize.translate("Delete"),
|
||||
id: "delete",
|
||||
icon: "delete"
|
||||
});
|
||||
}
|
||||
|
||||
require(["actionsheet"], function (actionsheet) {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: btn,
|
||||
callback: function (id) {
|
||||
switch (id) {
|
||||
case "open":
|
||||
Dashboard.navigate("device.html?id=" + deviceId);
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
deleteDevice(view, deviceId);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function load(page, devices) {
|
||||
var html = "";
|
||||
html += devices.map(function (device) {
|
||||
var deviceHtml = "";
|
||||
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>";
|
||||
deviceHtml += '<div class="cardBox visualCardBox">';
|
||||
deviceHtml += '<div class="cardScalable">';
|
||||
deviceHtml += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||
deviceHtml += '<a is="emby-linkbutton" href="' + (canEdit ? "device.html?id=" + device.Id : "#") + '" class="cardContent cardImageContainer">';
|
||||
var iconUrl = imageHelper.getDeviceIcon(device);
|
||||
|
||||
if (iconUrl) {
|
||||
deviceHtml += '<div class="cardImage" style="background-image:url(\'' + iconUrl + "');background-size: auto 64%;background-position:center center;\">";
|
||||
deviceHtml += "</div>";
|
||||
} else {
|
||||
deviceHtml += '<i class="cardImageIcon material-icons tablet_android"></i>';
|
||||
}
|
||||
|
||||
deviceHtml += "</a>";
|
||||
deviceHtml += "</div>";
|
||||
deviceHtml += '<div class="cardFooter">';
|
||||
|
||||
if (canEdit || canDelete(device.Id)) {
|
||||
deviceHtml += '<div style="text-align:right; float:right;padding-top:5px;">';
|
||||
deviceHtml += '<button type="button" is="paper-icon-button-light" data-id="' + device.Id + '" title="' + globalize.translate("Menu") + '" class="btnDeviceMenu"><i class="material-icons more_horiz"></i></button>';
|
||||
deviceHtml += "</div>";
|
||||
}
|
||||
|
||||
deviceHtml += "<div class='cardText'>";
|
||||
deviceHtml += device.Name;
|
||||
deviceHtml += "</div>";
|
||||
deviceHtml += "<div class='cardText cardText-secondary'>";
|
||||
deviceHtml += device.AppName + " " + device.AppVersion;
|
||||
deviceHtml += "</div>";
|
||||
deviceHtml += "<div class='cardText cardText-secondary'>";
|
||||
|
||||
if (device.LastUserName) {
|
||||
deviceHtml += device.LastUserName;
|
||||
deviceHtml += ", " + datefns.formatDistanceToNow(Date.parse(device.DateLastActivity), dfnshelper.localeWithSuffix);
|
||||
}
|
||||
|
||||
deviceHtml += " ";
|
||||
deviceHtml += "</div>";
|
||||
deviceHtml += "</div>";
|
||||
deviceHtml += "</div>";
|
||||
deviceHtml += "</div>";
|
||||
return deviceHtml;
|
||||
}).join("");
|
||||
page.querySelector(".devicesList").innerHTML = html;
|
||||
}
|
||||
|
||||
function loadData(page) {
|
||||
loading.show();
|
||||
ApiClient.getJSON(ApiClient.getUrl("Devices")).then(function (result) {
|
||||
load(page, result.Items);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
var canEdit = ApiClient.isMinServerVersion("3.4.1.31");
|
||||
return function (view, params) {
|
||||
view.querySelector(".devicesList").addEventListener("click", function (e) {
|
||||
var btnDeviceMenu = dom.parentWithClass(e.target, "btnDeviceMenu");
|
||||
|
||||
if (btnDeviceMenu) {
|
||||
showDeviceMenu(view, btnDeviceMenu, btnDeviceMenu.getAttribute("data-id"));
|
||||
}
|
||||
});
|
||||
view.addEventListener("viewshow", function () {
|
||||
loadData(this);
|
||||
});
|
||||
};
|
||||
});
|
829
src/controllers/dashboard/dlna/dlnaprofile.js
Normal file
829
src/controllers/dashboard/dlna/dlnaprofile.js
Normal file
|
@ -0,0 +1,829 @@
|
|||
define(["jQuery", "loading", "fnchecked", "emby-select", "emby-button", "emby-input", "emby-checkbox", "listViewStyle", "emby-button"], function ($, loading) {
|
||||
"use strict";
|
||||
|
||||
function loadProfile(page) {
|
||||
loading.show();
|
||||
var promise1 = getProfile();
|
||||
var promise2 = ApiClient.getUsers();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
currentProfile = responses[0];
|
||||
renderProfile(page, currentProfile, responses[1]);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function getProfile() {
|
||||
var id = getParameterByName("id");
|
||||
var url = id ? "Dlna/Profiles/" + id : "Dlna/Profiles/Default";
|
||||
return ApiClient.getJSON(ApiClient.getUrl(url));
|
||||
}
|
||||
|
||||
function renderProfile(page, profile, users) {
|
||||
$("#txtName", page).val(profile.Name);
|
||||
$(".chkMediaType", page).each(function () {
|
||||
this.checked = -1 != (profile.SupportedMediaTypes || "").split(",").indexOf(this.getAttribute("data-value"));
|
||||
});
|
||||
$("#chkEnableAlbumArtInDidl", page).checked(profile.EnableAlbumArtInDidl);
|
||||
$("#chkEnableSingleImageLimit", page).checked(profile.EnableSingleAlbumArtLimit);
|
||||
renderXmlDocumentAttributes(page, profile.XmlRootAttributes || []);
|
||||
var idInfo = profile.Identification || {};
|
||||
renderIdentificationHeaders(page, idInfo.Headers || []);
|
||||
renderSubtitleProfiles(page, profile.SubtitleProfiles || []);
|
||||
$("#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 || "");
|
||||
$("#chkIgnoreTranscodeByteRangeRequests", page).checked(profile.IgnoreTranscodeByteRangeRequests);
|
||||
$("#txtMaxAllowedBitrate", page).val(profile.MaxStreamingBitrate || "");
|
||||
$("#txtMusicStreamingTranscodingBitrate", page).val(profile.MusicStreamingTranscodingBitrate || "");
|
||||
$("#chkRequiresPlainFolders", page).checked(profile.RequiresPlainFolders);
|
||||
$("#chkRequiresPlainVideoItems", page).checked(profile.RequiresPlainVideoItems);
|
||||
$("#txtProtocolInfo", page).val(profile.ProtocolInfo || "");
|
||||
$("#txtXDlnaCap", page).val(profile.XDlnaCap || "");
|
||||
$("#txtXDlnaDoc", page).val(profile.XDlnaDoc || "");
|
||||
$("#txtSonyAggregationFlags", page).val(profile.SonyAggregationFlags || "");
|
||||
profile.DirectPlayProfiles = profile.DirectPlayProfiles || [];
|
||||
profile.TranscodingProfiles = profile.TranscodingProfiles || [];
|
||||
profile.ContainerProfiles = profile.ContainerProfiles || [];
|
||||
profile.CodecProfiles = profile.CodecProfiles || [];
|
||||
profile.ResponseProfiles = profile.ResponseProfiles || [];
|
||||
var usersHtml = "<option></option>" + users.map(function (u) {
|
||||
return '<option value="' + u.Id + '">' + u.Name + "</option>";
|
||||
}).join("");
|
||||
$("#selectUser", page).html(usersHtml).val(profile.UserId || "");
|
||||
renderSubProfiles(page, profile);
|
||||
}
|
||||
|
||||
function renderIdentificationHeaders(page, headers) {
|
||||
var index = 0;
|
||||
var html = '<div class="paperList">' + headers.map(function (h) {
|
||||
var li = '<div class="listItem">';
|
||||
li += '<i class="material-icons listItemIcon">info</i>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + h.Name + ": " + (h.Value || "") + "</h3>";
|
||||
li += '<div class="listItemBodyText secondary">' + (h.Match || "") + "</div>";
|
||||
li += "</div>";
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteIdentificationHeader listItemButton" data-index="' + index + '"><i class="material-icons">delete</i></button>';
|
||||
li += "</div>";
|
||||
index++;
|
||||
return li;
|
||||
}).join("") + "</div>";
|
||||
var elem = $(".httpHeaderIdentificationList", page).html(html).trigger("create");
|
||||
$(".btnDeleteIdentificationHeader", elem).on("click", function () {
|
||||
var itemIndex = parseInt(this.getAttribute("data-index"));
|
||||
currentProfile.Identification.Headers.splice(itemIndex, 1);
|
||||
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
|
||||
});
|
||||
}
|
||||
|
||||
function openPopup(elem) {
|
||||
elem.classList.remove("hide");
|
||||
}
|
||||
|
||||
function closePopup(elem) {
|
||||
elem.classList.add("hide");
|
||||
}
|
||||
|
||||
function editIdentificationHeader(page, header) {
|
||||
isSubProfileNew = null == header;
|
||||
header = header || {};
|
||||
currentSubProfile = header;
|
||||
var popup = $("#identificationHeaderPopup", page);
|
||||
$("#txtIdentificationHeaderName", popup).val(header.Name || "");
|
||||
$("#txtIdentificationHeaderValue", popup).val(header.Value || "");
|
||||
$("#selectMatchType", popup).val(header.Match || "Equals");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function saveIdentificationHeader(page) {
|
||||
currentSubProfile.Name = $("#txtIdentificationHeaderName", page).val();
|
||||
currentSubProfile.Value = $("#txtIdentificationHeaderValue", page).val();
|
||||
currentSubProfile.Match = $("#selectMatchType", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.Identification = currentProfile.Identification || {};
|
||||
currentProfile.Identification.Headers = currentProfile.Identification.Headers || [];
|
||||
currentProfile.Identification.Headers.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#identificationHeaderPopup", page)[0]);
|
||||
}
|
||||
|
||||
function renderXmlDocumentAttributes(page, attribute) {
|
||||
var html = '<div class="paperList">' + attribute.map(function (h) {
|
||||
var li = '<div class="listItem">';
|
||||
li += '<i class="material-icons listItemIcon">info</i>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + h.Name + " = " + (h.Value || "") + "</h3>";
|
||||
li += "</div>";
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteXmlAttribute listItemButton" data-index="0"><i class="material-icons">delete</i></button>';
|
||||
return li += "</div>";
|
||||
}).join("") + "</div>";
|
||||
var elem = $(".xmlDocumentAttributeList", page).html(html).trigger("create");
|
||||
$(".btnDeleteXmlAttribute", elem).on("click", function () {
|
||||
var itemIndex = parseInt(this.getAttribute("data-index"));
|
||||
currentProfile.XmlRootAttributes.splice(itemIndex, 1);
|
||||
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
|
||||
});
|
||||
}
|
||||
|
||||
function editXmlDocumentAttribute(page, attribute) {
|
||||
isSubProfileNew = null == attribute;
|
||||
attribute = attribute || {};
|
||||
currentSubProfile = attribute;
|
||||
var popup = $("#xmlAttributePopup", page);
|
||||
$("#txtXmlAttributeName", popup).val(attribute.Name || "");
|
||||
$("#txtXmlAttributeValue", popup).val(attribute.Value || "");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function saveXmlDocumentAttribute(page) {
|
||||
currentSubProfile.Name = $("#txtXmlAttributeName", page).val();
|
||||
currentSubProfile.Value = $("#txtXmlAttributeValue", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.XmlRootAttributes.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#xmlAttributePopup", page)[0]);
|
||||
}
|
||||
|
||||
function renderSubtitleProfiles(page, profiles) {
|
||||
var index = 0;
|
||||
var html = '<div class="paperList">' + profiles.map(function (h) {
|
||||
var li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
|
||||
li += '<i class="material-icons listItemIcon">info</i>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + (h.Format || "") + "</h3>";
|
||||
li += "</div>";
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-index="' + index + '"><i class="material-icons">delete</i></button>';
|
||||
li += "</div>";
|
||||
index++;
|
||||
return li;
|
||||
}).join("") + "</div>";
|
||||
var elem = $(".subtitleProfileList", page).html(html).trigger("create");
|
||||
$(".btnDeleteProfile", elem).on("click", function () {
|
||||
var itemIndex = parseInt(this.getAttribute("data-index"));
|
||||
currentProfile.SubtitleProfiles.splice(itemIndex, 1);
|
||||
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
|
||||
});
|
||||
$(".lnkEditSubProfile", elem).on("click", function () {
|
||||
var itemIndex = parseInt(this.getAttribute("data-index"));
|
||||
editSubtitleProfile(page, currentProfile.SubtitleProfiles[itemIndex]);
|
||||
});
|
||||
}
|
||||
|
||||
function editSubtitleProfile(page, profile) {
|
||||
isSubProfileNew = null == profile;
|
||||
profile = profile || {};
|
||||
currentSubProfile = profile;
|
||||
var popup = $("#subtitleProfilePopup", page);
|
||||
$("#txtSubtitleProfileFormat", popup).val(profile.Format || "");
|
||||
$("#selectSubtitleProfileMethod", popup).val(profile.Method || "");
|
||||
$("#selectSubtitleProfileDidlMode", popup).val(profile.DidlMode || "");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function saveSubtitleProfile(page) {
|
||||
currentSubProfile.Format = $("#txtSubtitleProfileFormat", page).val();
|
||||
currentSubProfile.Method = $("#selectSubtitleProfileMethod", page).val();
|
||||
currentSubProfile.DidlMode = $("#selectSubtitleProfileDidlMode", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.SubtitleProfiles.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#subtitleProfilePopup", page)[0]);
|
||||
}
|
||||
|
||||
function renderSubProfiles(page, profile) {
|
||||
renderDirectPlayProfiles(page, profile.DirectPlayProfiles);
|
||||
renderTranscodingProfiles(page, profile.TranscodingProfiles);
|
||||
renderContainerProfiles(page, profile.ContainerProfiles);
|
||||
renderCodecProfiles(page, profile.CodecProfiles);
|
||||
renderResponseProfiles(page, profile.ResponseProfiles);
|
||||
}
|
||||
|
||||
function saveDirectPlayProfile(page) {
|
||||
currentSubProfile.Type = $("#selectDirectPlayProfileType", page).val();
|
||||
currentSubProfile.Container = $("#txtDirectPlayContainer", page).val();
|
||||
currentSubProfile.AudioCodec = $("#txtDirectPlayAudioCodec", page).val();
|
||||
currentSubProfile.VideoCodec = $("#txtDirectPlayVideoCodec", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.DirectPlayProfiles.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderSubProfiles(page, currentProfile);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#popupEditDirectPlayProfile", page)[0]);
|
||||
}
|
||||
|
||||
function renderDirectPlayProfiles(page, profiles) {
|
||||
var html = "";
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + "</li>";
|
||||
currentType = profile.Type;
|
||||
}
|
||||
|
||||
html += "<div>";
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += "<p>" + Globalize.translate("ValueContainer", profile.Container || allText) + "</p>";
|
||||
|
||||
if ("Video" == profile.Type) {
|
||||
html += "<p>" + Globalize.translate("ValueVideoCodec", profile.VideoCodec || allText) + "</p>";
|
||||
html += "<p>" + Globalize.translate("ValueAudioCodec", profile.AudioCodec || allText) + "</p>";
|
||||
} else {
|
||||
if ("Audio" == profile.Type) {
|
||||
html += "<p>" + Globalize.translate("ValueCodec", profile.AudioCodec || allText) + "</p>";
|
||||
}
|
||||
}
|
||||
|
||||
html += "</a>";
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><i class="material-icons">delete</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
var elem = $(".directPlayProfiles", page).html(html).trigger("create");
|
||||
$(".btnDeleteProfile", elem).on("click", function () {
|
||||
var index = this.getAttribute("data-profileindex");
|
||||
deleteDirectPlayProfile(page, index);
|
||||
});
|
||||
$(".lnkEditSubProfile", elem).on("click", function () {
|
||||
var index = parseInt(this.getAttribute("data-profileindex"));
|
||||
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteDirectPlayProfile(page, index) {
|
||||
currentProfile.DirectPlayProfiles.splice(index, 1);
|
||||
renderDirectPlayProfiles(page, currentProfile.DirectPlayProfiles);
|
||||
}
|
||||
|
||||
function editDirectPlayProfile(page, directPlayProfile) {
|
||||
isSubProfileNew = null == directPlayProfile;
|
||||
directPlayProfile = directPlayProfile || {};
|
||||
currentSubProfile = directPlayProfile;
|
||||
var popup = $("#popupEditDirectPlayProfile", page);
|
||||
$("#selectDirectPlayProfileType", popup).val(directPlayProfile.Type || "Video").trigger("change");
|
||||
$("#txtDirectPlayContainer", popup).val(directPlayProfile.Container || "");
|
||||
$("#txtDirectPlayAudioCodec", popup).val(directPlayProfile.AudioCodec || "");
|
||||
$("#txtDirectPlayVideoCodec", popup).val(directPlayProfile.VideoCodec || "");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function renderTranscodingProfiles(page, profiles) {
|
||||
var html = "";
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + "</li>";
|
||||
currentType = profile.Type;
|
||||
}
|
||||
|
||||
html += "<div>";
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += "<p>Protocol: " + (profile.Protocol || "Http") + "</p>";
|
||||
html += "<p>" + Globalize.translate("ValueContainer", profile.Container || allText) + "</p>";
|
||||
|
||||
if ("Video" == profile.Type) {
|
||||
html += "<p>" + Globalize.translate("ValueVideoCodec", profile.VideoCodec || allText) + "</p>";
|
||||
html += "<p>" + Globalize.translate("ValueAudioCodec", profile.AudioCodec || allText) + "</p>";
|
||||
} else {
|
||||
if ("Audio" == profile.Type) {
|
||||
html += "<p>" + Globalize.translate("ValueCodec", profile.AudioCodec || allText) + "</p>";
|
||||
}
|
||||
}
|
||||
|
||||
html += "</a>";
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><i class="material-icons">delete</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
var elem = $(".transcodingProfiles", page).html(html).trigger("create");
|
||||
$(".btnDeleteProfile", elem).on("click", function () {
|
||||
var index = this.getAttribute("data-profileindex");
|
||||
deleteTranscodingProfile(page, index);
|
||||
});
|
||||
$(".lnkEditSubProfile", elem).on("click", function () {
|
||||
var index = parseInt(this.getAttribute("data-profileindex"));
|
||||
editTranscodingProfile(page, currentProfile.TranscodingProfiles[index]);
|
||||
});
|
||||
}
|
||||
|
||||
function editTranscodingProfile(page, transcodingProfile) {
|
||||
isSubProfileNew = null == transcodingProfile;
|
||||
transcodingProfile = transcodingProfile || {};
|
||||
currentSubProfile = transcodingProfile;
|
||||
var popup = $("#transcodingProfilePopup", page);
|
||||
$("#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");
|
||||
$("#chkEnableMpegtsM2TsMode", popup).checked(transcodingProfile.EnableMpegtsM2TsMode || false);
|
||||
$("#chkEstimateContentLength", popup).checked(transcodingProfile.EstimateContentLength || false);
|
||||
$("#chkReportByteRangeRequests", popup).checked("Bytes" == transcodingProfile.TranscodeSeekInfo);
|
||||
$(".radioTabButton:first", popup).trigger("click");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function deleteTranscodingProfile(page, index) {
|
||||
currentProfile.TranscodingProfiles.splice(index, 1);
|
||||
renderTranscodingProfiles(page, currentProfile.TranscodingProfiles);
|
||||
}
|
||||
|
||||
function saveTranscodingProfile(page) {
|
||||
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";
|
||||
currentSubProfile.EnableMpegtsM2TsMode = $("#chkEnableMpegtsM2TsMode", page).checked();
|
||||
currentSubProfile.EstimateContentLength = $("#chkEstimateContentLength", page).checked();
|
||||
currentSubProfile.TranscodeSeekInfo = $("#chkReportByteRangeRequests", page).checked() ? "Bytes" : "Auto";
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.TranscodingProfiles.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderSubProfiles(page, currentProfile);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#transcodingProfilePopup", page)[0]);
|
||||
}
|
||||
|
||||
function renderContainerProfiles(page, profiles) {
|
||||
var html = "";
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + "</li>";
|
||||
currentType = profile.Type;
|
||||
}
|
||||
|
||||
html += "<div>";
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += "<p>" + Globalize.translate("ValueContainer", profile.Container || allText) + "</p>";
|
||||
|
||||
if (profile.Conditions && profile.Conditions.length) {
|
||||
html += "<p>";
|
||||
html += Globalize.translate("ValueConditions", profile.Conditions.map(function (c) {
|
||||
return c.Property;
|
||||
}).join(", "));
|
||||
html += "</p>";
|
||||
}
|
||||
|
||||
html += "</a>";
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><i class="material-icons">delete</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
var elem = $(".containerProfiles", page).html(html).trigger("create");
|
||||
$(".btnDeleteProfile", elem).on("click", function () {
|
||||
var index = this.getAttribute("data-profileindex");
|
||||
deleteContainerProfile(page, index);
|
||||
});
|
||||
$(".lnkEditSubProfile", elem).on("click", function () {
|
||||
var index = parseInt(this.getAttribute("data-profileindex"));
|
||||
editContainerProfile(page, currentProfile.ContainerProfiles[index]);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteContainerProfile(page, index) {
|
||||
currentProfile.ContainerProfiles.splice(index, 1);
|
||||
renderContainerProfiles(page, currentProfile.ContainerProfiles);
|
||||
}
|
||||
|
||||
function editContainerProfile(page, containerProfile) {
|
||||
isSubProfileNew = null == containerProfile;
|
||||
containerProfile = containerProfile || {};
|
||||
currentSubProfile = containerProfile;
|
||||
var popup = $("#containerProfilePopup", page);
|
||||
$("#selectContainerProfileType", popup).val(containerProfile.Type || "Video").trigger("change");
|
||||
$("#txtContainerProfileContainer", popup).val(containerProfile.Container || "");
|
||||
$(".radioTabButton:first", popup).trigger("click");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function saveContainerProfile(page) {
|
||||
currentSubProfile.Type = $("#selectContainerProfileType", page).val();
|
||||
currentSubProfile.Container = $("#txtContainerProfileContainer", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.ContainerProfiles.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderSubProfiles(page, currentProfile);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#containerProfilePopup", page)[0]);
|
||||
}
|
||||
|
||||
function renderCodecProfiles(page, profiles) {
|
||||
var html = "";
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
var type = profile.Type.replace("VideoAudio", "Video Audio");
|
||||
|
||||
if (type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + type + "</li>";
|
||||
currentType = type;
|
||||
}
|
||||
|
||||
html += "<div>";
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += "<p>" + Globalize.translate("ValueCodec", profile.Codec || allText) + "</p>";
|
||||
|
||||
if (profile.Conditions && profile.Conditions.length) {
|
||||
html += "<p>";
|
||||
html += Globalize.translate("ValueConditions", profile.Conditions.map(function (c) {
|
||||
return c.Property;
|
||||
}).join(", "));
|
||||
html += "</p>";
|
||||
}
|
||||
|
||||
html += "</a>";
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><i class="material-icons">delete</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
var elem = $(".codecProfiles", page).html(html).trigger("create");
|
||||
$(".btnDeleteProfile", elem).on("click", function () {
|
||||
var index = this.getAttribute("data-profileindex");
|
||||
deleteCodecProfile(page, index);
|
||||
});
|
||||
$(".lnkEditSubProfile", elem).on("click", function () {
|
||||
var index = parseInt(this.getAttribute("data-profileindex"));
|
||||
editCodecProfile(page, currentProfile.CodecProfiles[index]);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteCodecProfile(page, index) {
|
||||
currentProfile.CodecProfiles.splice(index, 1);
|
||||
renderCodecProfiles(page, currentProfile.CodecProfiles);
|
||||
}
|
||||
|
||||
function editCodecProfile(page, codecProfile) {
|
||||
isSubProfileNew = null == codecProfile;
|
||||
codecProfile = codecProfile || {};
|
||||
currentSubProfile = codecProfile;
|
||||
var popup = $("#codecProfilePopup", page);
|
||||
$("#selectCodecProfileType", popup).val(codecProfile.Type || "Video").trigger("change");
|
||||
$("#txtCodecProfileCodec", popup).val(codecProfile.Codec || "");
|
||||
$(".radioTabButton:first", popup).trigger("click");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function saveCodecProfile(page) {
|
||||
currentSubProfile.Type = $("#selectCodecProfileType", page).val();
|
||||
currentSubProfile.Codec = $("#txtCodecProfileCodec", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.CodecProfiles.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderSubProfiles(page, currentProfile);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#codecProfilePopup", page)[0]);
|
||||
}
|
||||
|
||||
function renderResponseProfiles(page, profiles) {
|
||||
var html = "";
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + "</li>";
|
||||
currentType = profile.Type;
|
||||
}
|
||||
|
||||
html += "<div>";
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += "<p>" + Globalize.translate("ValueContainer", profile.Container || allText) + "</p>";
|
||||
|
||||
if ("Video" == profile.Type) {
|
||||
html += "<p>" + Globalize.translate("ValueVideoCodec", profile.VideoCodec || allText) + "</p>";
|
||||
html += "<p>" + Globalize.translate("ValueAudioCodec", profile.AudioCodec || allText) + "</p>";
|
||||
} else {
|
||||
if ("Audio" == profile.Type) {
|
||||
html += "<p>" + Globalize.translate("ValueCodec", profile.AudioCodec || allText) + "</p>";
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.Conditions && profile.Conditions.length) {
|
||||
html += "<p>";
|
||||
html += Globalize.translate("ValueConditions", profile.Conditions.map(function (c) {
|
||||
return c.Property;
|
||||
}).join(", "));
|
||||
html += "</p>";
|
||||
}
|
||||
|
||||
html += "</a>";
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><i class="material-icons">delete</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
var elem = $(".mediaProfiles", page).html(html).trigger("create");
|
||||
$(".btnDeleteProfile", elem).on("click", function () {
|
||||
var index = this.getAttribute("data-profileindex");
|
||||
deleteResponseProfile(page, index);
|
||||
});
|
||||
$(".lnkEditSubProfile", elem).on("click", function () {
|
||||
var index = parseInt(this.getAttribute("data-profileindex"));
|
||||
editResponseProfile(page, currentProfile.ResponseProfiles[index]);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteResponseProfile(page, index) {
|
||||
currentProfile.ResponseProfiles.splice(index, 1);
|
||||
renderResponseProfiles(page, currentProfile.ResponseProfiles);
|
||||
}
|
||||
|
||||
function editResponseProfile(page, responseProfile) {
|
||||
isSubProfileNew = null == responseProfile;
|
||||
responseProfile = responseProfile || {};
|
||||
currentSubProfile = responseProfile;
|
||||
var popup = $("#responseProfilePopup", page);
|
||||
$("#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");
|
||||
openPopup(popup[0]);
|
||||
}
|
||||
|
||||
function saveResponseProfile(page) {
|
||||
currentSubProfile.Type = $("#selectResponseProfileType", page).val();
|
||||
currentSubProfile.Container = $("#txtResponseProfileContainer", page).val();
|
||||
currentSubProfile.AudioCodec = $("#txtResponseProfileAudioCodec", page).val();
|
||||
currentSubProfile.VideoCodec = $("#txtResponseProfileVideoCodec", page).val();
|
||||
|
||||
if (isSubProfileNew) {
|
||||
currentProfile.ResponseProfiles.push(currentSubProfile);
|
||||
}
|
||||
|
||||
renderSubProfiles(page, currentProfile);
|
||||
currentSubProfile = null;
|
||||
closePopup($("#responseProfilePopup", page)[0]);
|
||||
}
|
||||
|
||||
function saveProfile(page, profile) {
|
||||
updateProfile(page, profile);
|
||||
var id = getParameterByName("id");
|
||||
|
||||
if (id) {
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: ApiClient.getUrl("Dlna/Profiles/" + id),
|
||||
data: JSON.stringify(profile),
|
||||
contentType: "application/json"
|
||||
}).then(function () {
|
||||
require(["toast"], function (toast) {
|
||||
toast("Settings saved.");
|
||||
});
|
||||
}, Dashboard.processErrorResponse);
|
||||
} else {
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: ApiClient.getUrl("Dlna/Profiles"),
|
||||
data: JSON.stringify(profile),
|
||||
contentType: "application/json"
|
||||
}).then(function () {
|
||||
Dashboard.navigate("dlnaprofiles.html");
|
||||
}, Dashboard.processErrorResponse);
|
||||
}
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function updateProfile(page, profile) {
|
||||
profile.Name = $("#txtName", page).val();
|
||||
profile.EnableAlbumArtInDidl = $("#chkEnableAlbumArtInDidl", page).checked();
|
||||
profile.EnableSingleAlbumArtLimit = $("#chkEnableSingleImageLimit", page).checked();
|
||||
profile.SupportedMediaTypes = $(".chkMediaType:checked", page).get().map(function (c) {
|
||||
return c.getAttribute("data-value");
|
||||
}).join(",");
|
||||
profile.Identification = profile.Identification || {};
|
||||
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();
|
||||
profile.RequiresPlainFolders = $("#chkRequiresPlainFolders", page).checked();
|
||||
profile.RequiresPlainVideoItems = $("#chkRequiresPlainVideoItems", page).checked();
|
||||
profile.IgnoreTranscodeByteRangeRequests = $("#chkIgnoreTranscodeByteRangeRequests", page).checked();
|
||||
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();
|
||||
}
|
||||
|
||||
var currentProfile;
|
||||
var currentSubProfile;
|
||||
var isSubProfileNew;
|
||||
var allText = Globalize.translate("LabelAll");
|
||||
|
||||
$(document).on("pageinit", "#dlnaProfilePage", function () {
|
||||
var page = this;
|
||||
$(".radioTabButton", page).on("click", function () {
|
||||
$(this).siblings().removeClass("ui-btn-active");
|
||||
$(this).addClass("ui-btn-active");
|
||||
var value = "A" == this.tagName ? this.getAttribute("data-value") : this.value;
|
||||
var elem = $("." + value, page);
|
||||
elem.siblings(".tabContent").hide();
|
||||
elem.show();
|
||||
});
|
||||
$("#selectDirectPlayProfileType", page).on("change", function () {
|
||||
if ("Video" == this.value) {
|
||||
$("#fldDirectPlayVideoCodec", page).show();
|
||||
} else {
|
||||
$("#fldDirectPlayVideoCodec", page).hide();
|
||||
}
|
||||
|
||||
if ("Photo" == this.value) {
|
||||
$("#fldDirectPlayAudioCodec", page).hide();
|
||||
} else {
|
||||
$("#fldDirectPlayAudioCodec", page).show();
|
||||
}
|
||||
});
|
||||
$("#selectTranscodingProfileType", page).on("change", function () {
|
||||
if ("Video" == this.value) {
|
||||
$("#fldTranscodingVideoCodec", page).show();
|
||||
$("#fldTranscodingProtocol", page).show();
|
||||
$("#fldEnableMpegtsM2TsMode", page).show();
|
||||
} else {
|
||||
$("#fldTranscodingVideoCodec", page).hide();
|
||||
$("#fldTranscodingProtocol", page).hide();
|
||||
$("#fldEnableMpegtsM2TsMode", page).hide();
|
||||
}
|
||||
|
||||
if ("Photo" == this.value) {
|
||||
$("#fldTranscodingAudioCodec", page).hide();
|
||||
$("#fldEstimateContentLength", page).hide();
|
||||
$("#fldReportByteRangeRequests", page).hide();
|
||||
} else {
|
||||
$("#fldTranscodingAudioCodec", page).show();
|
||||
$("#fldEstimateContentLength", page).show();
|
||||
$("#fldReportByteRangeRequests", page).show();
|
||||
}
|
||||
});
|
||||
$("#selectResponseProfileType", page).on("change", function () {
|
||||
if ("Video" == this.value) {
|
||||
$("#fldResponseProfileVideoCodec", page).show();
|
||||
} else {
|
||||
$("#fldResponseProfileVideoCodec", page).hide();
|
||||
}
|
||||
|
||||
if ("Photo" == this.value) {
|
||||
$("#fldResponseProfileAudioCodec", page).hide();
|
||||
} else {
|
||||
$("#fldResponseProfileAudioCodec", page).show();
|
||||
}
|
||||
});
|
||||
$(".btnAddDirectPlayProfile", page).on("click", function () {
|
||||
editDirectPlayProfile(page);
|
||||
});
|
||||
$(".btnAddTranscodingProfile", page).on("click", function () {
|
||||
editTranscodingProfile(page);
|
||||
});
|
||||
$(".btnAddContainerProfile", page).on("click", function () {
|
||||
editContainerProfile(page);
|
||||
});
|
||||
$(".btnAddCodecProfile", page).on("click", function () {
|
||||
editCodecProfile(page);
|
||||
});
|
||||
$(".btnAddResponseProfile", page).on("click", function () {
|
||||
editResponseProfile(page);
|
||||
});
|
||||
$(".btnAddIdentificationHttpHeader", page).on("click", function () {
|
||||
editIdentificationHeader(page);
|
||||
});
|
||||
$(".btnAddXmlDocumentAttribute", page).on("click", function () {
|
||||
editXmlDocumentAttribute(page);
|
||||
});
|
||||
$(".btnAddSubtitleProfile", page).on("click", function () {
|
||||
editSubtitleProfile(page);
|
||||
});
|
||||
$(".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 () {
|
||||
var page = this;
|
||||
$("#radioInfo", page).trigger("click");
|
||||
loadProfile(page);
|
||||
});
|
||||
window.DlnaProfilePage = {
|
||||
onSubmit: function () {
|
||||
loading.show();
|
||||
saveProfile($(this).parents(".page"), currentProfile);
|
||||
return false;
|
||||
},
|
||||
onDirectPlayFormSubmit: function () {
|
||||
saveDirectPlayProfile($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onTranscodingProfileFormSubmit: function () {
|
||||
saveTranscodingProfile($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onContainerProfileFormSubmit: function () {
|
||||
saveContainerProfile($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onCodecProfileFormSubmit: function () {
|
||||
saveCodecProfile($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onResponseProfileFormSubmit: function () {
|
||||
saveResponseProfile($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onIdentificationHeaderFormSubmit: function () {
|
||||
saveIdentificationHeader($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onXmlAttributeFormSubmit: function () {
|
||||
saveXmlDocumentAttribute($(this).parents(".page"));
|
||||
return false;
|
||||
},
|
||||
onSubtitleProfileFormSubmit: function () {
|
||||
saveSubtitleProfile($(this).parents(".page"));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
89
src/controllers/dashboard/dlna/dlnaprofiles.js
Normal file
89
src/controllers/dashboard/dlna/dlnaprofiles.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
define(["jQuery", "globalize", "loading", "libraryMenu", "listViewStyle", "emby-button"], function ($, globalize, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadProfiles(page) {
|
||||
loading.show();
|
||||
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
|
||||
renderUserProfiles(page, result);
|
||||
renderSystemProfiles(page, result);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function renderUserProfiles(page, profiles) {
|
||||
renderProfiles(page, page.querySelector(".customProfiles"), profiles.filter(function (p) {
|
||||
return "User" == p.Type;
|
||||
}));
|
||||
}
|
||||
|
||||
function renderSystemProfiles(page, profiles) {
|
||||
renderProfiles(page, page.querySelector(".systemProfiles"), profiles.filter(function (p) {
|
||||
return "System" == p.Type;
|
||||
}));
|
||||
}
|
||||
|
||||
function renderProfiles(page, element, profiles) {
|
||||
var html = "";
|
||||
|
||||
if (profiles.length) {
|
||||
html += '<div class="paperList">';
|
||||
}
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
html += '<div class="listItem listItem-border">';
|
||||
html += '<i class="listItemIcon material-icons live_tv"></i>';
|
||||
html += '<div class="listItemBody two-line">';
|
||||
html += "<a is='emby-linkbutton' style='padding:0;margin:0;' data-ripple='false' class='clearLink' href='dlnaprofile.html?id=" + profile.Id + "'>";
|
||||
html += "<div>" + profile.Name + "</div>";
|
||||
html += "</a>";
|
||||
html += "</div>";
|
||||
|
||||
if ("User" == profile.Type) {
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile" data-profileid="' + profile.Id + '" title="' + globalize.translate("ButtonDelete") + '"><i class="material-icons">delete</i></button>';
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
if (profiles.length) {
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
element.innerHTML = html;
|
||||
$(".btnDeleteProfile", element).on("click", function () {
|
||||
var id = this.getAttribute("data-profileid");
|
||||
deleteProfile(page, id);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteProfile(page, id) {
|
||||
require(["confirm"], function (confirm) {
|
||||
confirm(globalize.translate("MessageConfirmProfileDeletion"), globalize.translate("HeaderConfirmProfileDeletion")).then(function () {
|
||||
loading.show();
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Dlna/Profiles/" + id)
|
||||
}).then(function () {
|
||||
loading.hide();
|
||||
loadProfiles(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "dlnasettings.html",
|
||||
name: globalize.translate("TabSettings")
|
||||
}, {
|
||||
href: "dlnaprofiles.html",
|
||||
name: globalize.translate("TabProfiles")
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageshow", "#dlnaProfilesPage", function () {
|
||||
libraryMenu.setTabs("dlna", 1, getTabs);
|
||||
loadProfiles(this);
|
||||
});
|
||||
});
|
56
src/controllers/dashboard/dlna/dlnasettings.js
Normal file
56
src/controllers/dashboard/dlna/dlnasettings.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
define(["jQuery", "loading", "libraryMenu", "fnchecked"], function ($, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadPage(page, config, users) {
|
||||
page.querySelector("#chkEnablePlayTo").checked = config.EnablePlayTo;
|
||||
page.querySelector("#chkEnableDlnaDebugLogging").checked = config.EnableDebugLog;
|
||||
$("#txtClientDiscoveryInterval", page).val(config.ClientDiscoveryIntervalSeconds);
|
||||
$("#chkEnableServer", page).checked(config.EnableServer);
|
||||
$("#chkBlastAliveMessages", page).checked(config.BlastAliveMessages);
|
||||
$("#txtBlastInterval", page).val(config.BlastAliveMessageIntervalSeconds);
|
||||
var usersHtml = users.map(function (u) {
|
||||
return '<option value="' + u.Id + '">' + u.Name + "</option>";
|
||||
}).join("");
|
||||
$("#selectUser", page).html(usersHtml).val(config.DefaultUserId || "");
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||
config.EnablePlayTo = form.querySelector("#chkEnablePlayTo").checked;
|
||||
config.EnableDebugLog = form.querySelector("#chkEnableDlnaDebugLogging").checked;
|
||||
config.ClientDiscoveryIntervalSeconds = $("#txtClientDiscoveryInterval", form).val();
|
||||
config.EnableServer = $("#chkEnableServer", form).checked();
|
||||
config.BlastAliveMessages = $("#chkBlastAliveMessages", form).checked();
|
||||
config.BlastAliveMessageIntervalSeconds = $("#txtBlastInterval", form).val();
|
||||
config.DefaultUserId = $("#selectUser", form).val();
|
||||
ApiClient.updateNamedConfiguration("dlna", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "dlnasettings.html",
|
||||
name: Globalize.translate("TabSettings")
|
||||
}, {
|
||||
href: "dlnaprofiles.html",
|
||||
name: Globalize.translate("TabProfiles")
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#dlnaSettingsPage", function () {
|
||||
$(".dlnaSettingsForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#dlnaSettingsPage", function () {
|
||||
libraryMenu.setTabs("dlna", 0, getTabs);
|
||||
loading.show();
|
||||
var page = this;
|
||||
var promise1 = ApiClient.getNamedConfiguration("dlna");
|
||||
var promise2 = ApiClient.getUsers();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
});
|
||||
});
|
||||
});
|
191
src/controllers/dashboard/encodingsettings.js
Normal file
191
src/controllers/dashboard/encodingsettings.js
Normal file
|
@ -0,0 +1,191 @@
|
|||
define(["jQuery", "loading", "globalize", "dom", "libraryMenu"], function ($, loading, globalize, dom, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadPage(page, config, systemInfo) {
|
||||
Array.prototype.forEach.call(page.querySelectorAll(".chkDecodeCodec"), function (c) {
|
||||
c.checked = -1 !== (config.HardwareDecodingCodecs || []).indexOf(c.getAttribute("data-codec"));
|
||||
});
|
||||
page.querySelector("#chkHardwareEncoding").checked = config.EnableHardwareEncoding;
|
||||
$("#selectVideoDecoder", page).val(config.HardwareAccelerationType);
|
||||
$("#selectThreadCount", page).val(config.EncodingThreadCount);
|
||||
$("#txtDownMixAudioBoost", page).val(config.DownMixAudioBoost);
|
||||
page.querySelector(".txtEncoderPath").value = config.EncoderAppPathDisplay || "";
|
||||
$("#txtTranscodingTempPath", page).val(systemInfo.TranscodingTempPath || "");
|
||||
$("#txtVaapiDevice", page).val(config.VaapiDevice || "");
|
||||
page.querySelector("#selectEncoderPreset").value = config.EncoderPreset || "";
|
||||
page.querySelector("#txtH264Crf").value = config.H264Crf || "";
|
||||
page.querySelector("#selectDeinterlaceMethod").value = config.DeinterlaceMethod || "";
|
||||
page.querySelector("#chkEnableSubtitleExtraction").checked = config.EnableSubtitleExtraction || false;
|
||||
page.querySelector("#chkEnableThrottling").checked = config.EnableThrottling || false;
|
||||
page.querySelector("#selectVideoDecoder").dispatchEvent(new CustomEvent("change", {
|
||||
bubbles: true
|
||||
}));
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onSaveEncodingPathFailure(response) {
|
||||
loading.hide();
|
||||
var msg = "";
|
||||
msg = globalize.translate("FFmpegSavePathNotFound");
|
||||
|
||||
require(["alert"], function (alert) {
|
||||
alert(msg);
|
||||
});
|
||||
}
|
||||
|
||||
function updateEncoder(form) {
|
||||
return ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
return ApiClient.ajax({
|
||||
url: ApiClient.getUrl("System/MediaEncoder/Path"),
|
||||
type: "POST",
|
||||
data: {
|
||||
Path: form.querySelector(".txtEncoderPath").value,
|
||||
PathType: "Custom"
|
||||
}
|
||||
}).then(Dashboard.processServerConfigurationUpdateResult, onSaveEncodingPathFailure);
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
|
||||
var onDecoderConfirmed = function () {
|
||||
loading.show();
|
||||
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||
config.DownMixAudioBoost = $("#txtDownMixAudioBoost", form).val();
|
||||
config.TranscodingTempPath = $("#txtTranscodingTempPath", form).val();
|
||||
config.EncodingThreadCount = $("#selectThreadCount", form).val();
|
||||
config.HardwareAccelerationType = $("#selectVideoDecoder", form).val();
|
||||
config.VaapiDevice = $("#txtVaapiDevice", form).val();
|
||||
config.EncoderPreset = form.querySelector("#selectEncoderPreset").value;
|
||||
config.H264Crf = parseInt(form.querySelector("#txtH264Crf").value || "0");
|
||||
config.DeinterlaceMethod = form.querySelector("#selectDeinterlaceMethod").value;
|
||||
config.EnableSubtitleExtraction = form.querySelector("#chkEnableSubtitleExtraction").checked;
|
||||
config.EnableThrottling = form.querySelector("#chkEnableThrottling").checked;
|
||||
config.HardwareDecodingCodecs = Array.prototype.map.call(Array.prototype.filter.call(form.querySelectorAll(".chkDecodeCodec"), function (c) {
|
||||
return c.checked;
|
||||
}), function (c) {
|
||||
return c.getAttribute("data-codec");
|
||||
});
|
||||
config.EnableHardwareEncoding = form.querySelector("#chkHardwareEncoding").checked;
|
||||
ApiClient.updateNamedConfiguration("encoding", config).then(function () {
|
||||
updateEncoder(form);
|
||||
}, function () {
|
||||
require(["alert"], function (alert) {
|
||||
alert(globalize.translate("DefaultErrorMessage"));
|
||||
});
|
||||
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if ($("#selectVideoDecoder", form).val()) {
|
||||
require(["alert"], function (alert) {
|
||||
alert({
|
||||
title: globalize.translate("TitleHardwareAcceleration"),
|
||||
text: globalize.translate("HardwareAccelerationWarning")
|
||||
}).then(onDecoderConfirmed);
|
||||
});
|
||||
} else {
|
||||
onDecoderConfirmed();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function setDecodingCodecsVisible(context, value) {
|
||||
value = value || "";
|
||||
var any;
|
||||
Array.prototype.forEach.call(context.querySelectorAll(".chkDecodeCodec"), function (c) {
|
||||
if (-1 === c.getAttribute("data-types").split(",").indexOf(value)) {
|
||||
dom.parentWithTag(c, "LABEL").classList.add("hide");
|
||||
} else {
|
||||
dom.parentWithTag(c, "LABEL").classList.remove("hide");
|
||||
any = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (any) {
|
||||
context.querySelector(".decodingCodecsList").classList.remove("hide");
|
||||
} else {
|
||||
context.querySelector(".decodingCodecsList").classList.add("hide");
|
||||
}
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "encodingsettings.html",
|
||||
name: Globalize.translate("Transcoding")
|
||||
}, {
|
||||
href: "playbackconfiguration.html",
|
||||
name: Globalize.translate("TabResumeSettings")
|
||||
}, {
|
||||
href: "streamingsettings.html",
|
||||
name: Globalize.translate("TabStreaming")
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#encodingSettingsPage", function () {
|
||||
var page = this;
|
||||
page.querySelector("#selectVideoDecoder").addEventListener("change", function () {
|
||||
if ("vaapi" == this.value) {
|
||||
page.querySelector(".fldVaapiDevice").classList.remove("hide");
|
||||
page.querySelector("#txtVaapiDevice").setAttribute("required", "required");
|
||||
} else {
|
||||
page.querySelector(".fldVaapiDevice").classList.add("hide");
|
||||
page.querySelector("#txtVaapiDevice").removeAttribute("required");
|
||||
}
|
||||
|
||||
if (this.value) {
|
||||
page.querySelector(".hardwareAccelerationOptions").classList.remove("hide");
|
||||
} else {
|
||||
page.querySelector(".hardwareAccelerationOptions").classList.add("hide");
|
||||
}
|
||||
|
||||
setDecodingCodecsVisible(page, this.value);
|
||||
});
|
||||
$("#btnSelectEncoderPath", page).on("click.selectDirectory", function () {
|
||||
require(["directorybrowser"], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
$(".txtEncoderPath", page).val(path);
|
||||
}
|
||||
|
||||
picker.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#btnSelectTranscodingTempPath", page).on("click.selectDirectory", function () {
|
||||
require(["directorybrowser"], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
$("#txtTranscodingTempPath", page).val(path);
|
||||
}
|
||||
|
||||
picker.close();
|
||||
},
|
||||
validateWriteable: true,
|
||||
header: globalize.translate("HeaderSelectTranscodingPath"),
|
||||
instruction: globalize.translate("HeaderSelectTranscodingPathHelp")
|
||||
});
|
||||
});
|
||||
});
|
||||
$(".encodingSettingsForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#encodingSettingsPage", function () {
|
||||
loading.show();
|
||||
libraryMenu.setTabs("playback", 0, getTabs);
|
||||
var page = this;
|
||||
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
loadPage(page, config, systemInfo);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
71
src/controllers/dashboard/librarydisplay.js
Normal file
71
src/controllers/dashboard/librarydisplay.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
define(["globalize", "loading", "libraryMenu", "emby-checkbox", "emby-button", "emby-button"], function(globalize, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "library.html",
|
||||
name: Globalize.translate("HeaderLibraries")
|
||||
}, {
|
||||
href: "librarydisplay.html",
|
||||
name: Globalize.translate("TabDisplay")
|
||||
}, {
|
||||
href: "metadataimages.html",
|
||||
name: Globalize.translate("TabMetadata")
|
||||
}, {
|
||||
href: "metadatanfo.html",
|
||||
name: Globalize.translate("TabNfoSettings")
|
||||
}];
|
||||
}
|
||||
|
||||
return function(view, params) {
|
||||
function loadData() {
|
||||
ApiClient.getServerConfiguration().then(function(config) {
|
||||
view.querySelector(".chkFolderView").checked = config.EnableFolderView;
|
||||
view.querySelector(".chkGroupMoviesIntoCollections").checked = config.EnableGroupingIntoCollections;
|
||||
view.querySelector(".chkDisplaySpecialsWithinSeasons").checked = config.DisplaySpecialsWithinSeasons;
|
||||
view.querySelector(".chkExternalContentInSuggestions").checked = config.EnableExternalContentInSuggestions;
|
||||
view.querySelector("#chkSaveMetadataHidden").checked = config.SaveMetadataHidden;
|
||||
});
|
||||
ApiClient.getNamedConfiguration("metadata").then(function(metadata) {
|
||||
loadMetadataConfig(this, metadata);
|
||||
});
|
||||
}
|
||||
|
||||
function loadMetadataConfig(page, config) {
|
||||
$("#selectDateAdded", page).val(config.UseFileCreationTimeForDateAdded ? "1" : "0");
|
||||
}
|
||||
|
||||
view.querySelector("form").addEventListener("submit", function(e) {
|
||||
loading.show();
|
||||
var form = this;
|
||||
ApiClient.getServerConfiguration().then(function(config) {
|
||||
config.EnableFolderView = form.querySelector(".chkFolderView").checked;
|
||||
config.EnableGroupingIntoCollections = form.querySelector(".chkGroupMoviesIntoCollections").checked;
|
||||
config.DisplaySpecialsWithinSeasons = form.querySelector(".chkDisplaySpecialsWithinSeasons").checked;
|
||||
config.EnableExternalContentInSuggestions = form.querySelector(".chkExternalContentInSuggestions").checked;
|
||||
config.SaveMetadataHidden = form.querySelector("#chkSaveMetadataHidden").checked;
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
ApiClient.getNamedConfiguration("metadata").then(function(config) {
|
||||
config.UseFileCreationTimeForDateAdded = "1" === $("#selectDateAdded", form).val();
|
||||
ApiClient.updateNamedConfiguration("metadata", config);
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
loading.hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
view.addEventListener("viewshow", function() {
|
||||
libraryMenu.setTabs("librarysetup", 1, getTabs);
|
||||
loadData();
|
||||
ApiClient.getSystemInfo().then(function(info) {
|
||||
if ("Windows" === info.OperatingSystem) {
|
||||
view.querySelector(".fldSaveMetadataHidden").classList.remove("hide");
|
||||
} else {
|
||||
view.querySelector(".fldSaveMetadataHidden").classList.add("hide");
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
391
src/controllers/dashboard/medialibrarypage.js
Normal file
391
src/controllers/dashboard/medialibrarypage.js
Normal file
|
@ -0,0 +1,391 @@
|
|||
define(["jQuery", "apphost", "scripts/taskbutton", "loading", "libraryMenu", "globalize", "dom", "indicators", "scripts/imagehelper", "cardStyle", "emby-itemrefreshindicator"], function ($, appHost, taskButton, loading, libraryMenu, globalize, dom, indicators, imageHelper) {
|
||||
"use strict";
|
||||
|
||||
function addVirtualFolder(page) {
|
||||
require(["medialibrarycreator"], function (medialibrarycreator) {
|
||||
new medialibrarycreator().show({
|
||||
collectionTypeOptions: getCollectionTypeOptions().filter(function (f) {
|
||||
return !f.hidden;
|
||||
}),
|
||||
refresh: shouldRefreshLibraryAfterChanges(page)
|
||||
}).then(function (hasChanges) {
|
||||
if (hasChanges) {
|
||||
reloadLibrary(page);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function editVirtualFolder(page, virtualFolder) {
|
||||
require(["medialibraryeditor"], function (medialibraryeditor) {
|
||||
new medialibraryeditor().show({
|
||||
refresh: shouldRefreshLibraryAfterChanges(page),
|
||||
library: virtualFolder
|
||||
}).then(function (hasChanges) {
|
||||
if (hasChanges) {
|
||||
reloadLibrary(page);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function deleteVirtualFolder(page, virtualFolder) {
|
||||
var msg = globalize.translate("MessageAreYouSureYouWishToRemoveMediaFolder");
|
||||
|
||||
if (virtualFolder.Locations.length) {
|
||||
msg += "<br/><br/>" + globalize.translate("MessageTheFollowingLocationWillBeRemovedFromLibrary") + "<br/><br/>";
|
||||
msg += virtualFolder.Locations.join("<br/>");
|
||||
}
|
||||
|
||||
require(["confirm"], function (confirm) {
|
||||
confirm({
|
||||
|
||||
text: msg,
|
||||
title: globalize.translate('HeaderRemoveMediaFolder'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
|
||||
}).then(function () {
|
||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refreshVirtualFolder(page, virtualFolder) {
|
||||
require(["refreshDialog"], function (refreshDialog) {
|
||||
new refreshDialog({
|
||||
itemIds: [virtualFolder.ItemId],
|
||||
serverId: ApiClient.serverId(),
|
||||
mode: "scan"
|
||||
}).show();
|
||||
});
|
||||
}
|
||||
|
||||
function renameVirtualFolder(page, virtualFolder) {
|
||||
require(["prompt"], function (prompt) {
|
||||
prompt({
|
||||
label: globalize.translate("LabelNewName"),
|
||||
confirmText: globalize.translate("ButtonRename")
|
||||
}).then(function (newName) {
|
||||
if (newName && newName != virtualFolder.Name) {
|
||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showCardMenu(page, elem, virtualFolders) {
|
||||
var card = dom.parentWithClass(elem, "card");
|
||||
var index = parseInt(card.getAttribute("data-index"));
|
||||
var virtualFolder = virtualFolders[index];
|
||||
var menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate("ButtonEditImages"),
|
||||
id: "editimages",
|
||||
icon: "photo"
|
||||
});
|
||||
menuItems.push({
|
||||
name: globalize.translate("ManageLibrary"),
|
||||
id: "edit",
|
||||
icon: "folder_open"
|
||||
});
|
||||
menuItems.push({
|
||||
name: globalize.translate("ButtonRemove"),
|
||||
id: "delete",
|
||||
icon: "delete"
|
||||
});
|
||||
menuItems.push({
|
||||
name: globalize.translate("ButtonRename"),
|
||||
id: "rename",
|
||||
icon: "mode_edit"
|
||||
});
|
||||
menuItems.push({
|
||||
name: globalize.translate("ScanLibrary"),
|
||||
id: "refresh",
|
||||
icon: "refresh"
|
||||
});
|
||||
|
||||
require(["actionsheet"], function (actionsheet) {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: elem,
|
||||
callback: function (resultId) {
|
||||
switch (resultId) {
|
||||
case "edit":
|
||||
editVirtualFolder(page, virtualFolder);
|
||||
break;
|
||||
|
||||
case "editimages":
|
||||
editImages(page, virtualFolder);
|
||||
break;
|
||||
|
||||
case "rename":
|
||||
renameVirtualFolder(page, virtualFolder);
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
deleteVirtualFolder(page, virtualFolder);
|
||||
break;
|
||||
|
||||
case "refresh":
|
||||
refreshVirtualFolder(page, virtualFolder);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function reloadLibrary(page) {
|
||||
loading.show();
|
||||
ApiClient.getVirtualFolders().then(function (result) {
|
||||
reloadVirtualFolders(page, result);
|
||||
});
|
||||
}
|
||||
|
||||
function shouldRefreshLibraryAfterChanges(page) {
|
||||
return "mediaLibraryPage" === page.id;
|
||||
}
|
||||
|
||||
function reloadVirtualFolders(page, virtualFolders) {
|
||||
var html = "";
|
||||
virtualFolders.push({
|
||||
Name: globalize.translate("ButtonAddMediaLibrary"),
|
||||
icon: "add_circle",
|
||||
Locations: [],
|
||||
showType: false,
|
||||
showLocations: false,
|
||||
showMenu: false,
|
||||
showNameWithIcon: true
|
||||
});
|
||||
|
||||
for (var i = 0; i < virtualFolders.length; i++) {
|
||||
var virtualFolder = virtualFolders[i];
|
||||
html += getVirtualFolderHtml(page, virtualFolder, i);
|
||||
}
|
||||
|
||||
var divVirtualFolders = page.querySelector("#divVirtualFolders");
|
||||
divVirtualFolders.innerHTML = html;
|
||||
divVirtualFolders.classList.add("itemsContainer");
|
||||
divVirtualFolders.classList.add("vertical-wrap");
|
||||
$(".btnCardMenu", divVirtualFolders).on("click", function () {
|
||||
showCardMenu(page, this, virtualFolders);
|
||||
});
|
||||
divVirtualFolders.querySelector(".addLibrary").addEventListener("click", function () {
|
||||
addVirtualFolder(page);
|
||||
});
|
||||
$(".editLibrary", divVirtualFolders).on("click", function () {
|
||||
var card = $(this).parents(".card")[0];
|
||||
var index = parseInt(card.getAttribute("data-index"));
|
||||
var virtualFolder = virtualFolders[index];
|
||||
|
||||
if (virtualFolder.ItemId) {
|
||||
editVirtualFolder(page, virtualFolder);
|
||||
}
|
||||
});
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function editImages(page, virtualFolder) {
|
||||
require(["imageEditor"], function (imageEditor) {
|
||||
imageEditor.show({
|
||||
itemId: virtualFolder.ItemId,
|
||||
serverId: ApiClient.serverId()
|
||||
}).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getLink(text, url) {
|
||||
return globalize.translate(text, '<a is="emby-linkbutton" class="button-link" href="' + url + '" target="_blank" data-autohide="true">', "</a>");
|
||||
}
|
||||
|
||||
function getCollectionTypeOptions() {
|
||||
return [{
|
||||
name: "",
|
||||
value: ""
|
||||
}, {
|
||||
name: globalize.translate("FolderTypeMovies"),
|
||||
value: "movies",
|
||||
message: getLink("MovieLibraryHelp", "https://docs.jellyfin.org/general/server/media/movies.html")
|
||||
}, {
|
||||
name: globalize.translate("FolderTypeMusic"),
|
||||
value: "music",
|
||||
message: getLink("MusicLibraryHelp", "https://docs.jellyfin.org/general/server/media/music.html")
|
||||
}, {
|
||||
name: globalize.translate("FolderTypeTvShows"),
|
||||
value: "tvshows",
|
||||
message: getLink("TvLibraryHelp", "https://docs.jellyfin.org/general/server/media/shows.html")
|
||||
}, {
|
||||
name: globalize.translate("FolderTypeBooks"),
|
||||
value: "books",
|
||||
message: getLink("BookLibraryHelp", "https://docs.jellyfin.org/general/server/media/books.html")
|
||||
}, {
|
||||
name: globalize.translate("OptionHomeVideos"),
|
||||
value: "homevideos"
|
||||
}, {
|
||||
name: globalize.translate("FolderTypeMusicVideos"),
|
||||
value: "musicvideos"
|
||||
}, {
|
||||
name: globalize.translate("FolderTypeUnset"),
|
||||
value: "mixed",
|
||||
message: globalize.translate("MessageUnsetContentHelp")
|
||||
}];
|
||||
}
|
||||
|
||||
function getVirtualFolderHtml(page, virtualFolder, index) {
|
||||
var html = "";
|
||||
var style = "";
|
||||
|
||||
if (page.classList.contains("wizardPage")) {
|
||||
style += "min-width:33.3%;";
|
||||
}
|
||||
|
||||
html += '<div class="card backdropCard scalableCard backdropCard-scalable" style="' + style + '" data-index="' + index + '" data-id="' + virtualFolder.ItemId + '">';
|
||||
html += '<div class="cardBox visualCardBox">';
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||
html += '<div class="cardContent">';
|
||||
var imgUrl = "";
|
||||
|
||||
if (virtualFolder.PrimaryImageItemId) {
|
||||
imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, {
|
||||
maxWidth: Math.round(dom.getScreenWidth() * 0.40),
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
|
||||
var hasCardImageContainer;
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<div class="cardImageContainer editLibrary" style="cursor:pointer;background-image:url(\'' + imgUrl + "');\">";
|
||||
hasCardImageContainer = true;
|
||||
} else if (!virtualFolder.showNameWithIcon) {
|
||||
html += '<div class="cardImageContainer editLibrary" style="cursor:pointer;">';
|
||||
html += '<i class="cardImageIcon-small material-icons">' + (virtualFolder.icon || imageHelper.getLibraryIcon(virtualFolder.CollectionType)) + "</i>";
|
||||
hasCardImageContainer = true;
|
||||
}
|
||||
|
||||
if (hasCardImageContainer) {
|
||||
html += '<div class="cardIndicators backdropCardIndicators">';
|
||||
html += '<div is="emby-itemrefreshindicator"' + (virtualFolder.RefreshProgress || virtualFolder.RefreshStatus && "Idle" !== virtualFolder.RefreshStatus ? "" : ' class="hide"') + ' data-progress="' + (virtualFolder.RefreshProgress || 0) + '" data-status="' + virtualFolder.RefreshStatus + '"></div>';
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
if (!imgUrl && virtualFolder.showNameWithIcon) {
|
||||
html += '<h3 class="cardImageContainer addLibrary" style="position:absolute;top:0;left:0;right:0;bottom:0;cursor:pointer;flex-direction:column;">';
|
||||
html += '<i class="cardImageIcon-small material-icons">' + (virtualFolder.icon || imageHelper.getLibraryIcon(virtualFolder.CollectionType)) + "</i>";
|
||||
|
||||
if (virtualFolder.showNameWithIcon) {
|
||||
html += '<div style="margin:1em 0;position:width:100%;">';
|
||||
html += virtualFolder.Name;
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</h3>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
html += '<div class="cardFooter visualCardBox-cardFooter">'; // always show menu unless explicitly hidden
|
||||
|
||||
if (virtualFolder.showMenu !== false) {
|
||||
html += '<div style="text-align:right; float:right;padding-top:5px;">';
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><i class="material-icons more_horiz"></i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "<div class='cardText'>";
|
||||
|
||||
if (virtualFolder.showNameWithIcon) {
|
||||
html += " ";
|
||||
} else {
|
||||
html += virtualFolder.Name;
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
var typeName = getCollectionTypeOptions().filter(function (t) {
|
||||
return t.value == virtualFolder.CollectionType;
|
||||
})[0];
|
||||
typeName = typeName ? typeName.name : globalize.translate("FolderTypeUnset");
|
||||
html += "<div class='cardText cardText-secondary'>";
|
||||
|
||||
if (virtualFolder.showType === false) {
|
||||
html += " ";
|
||||
} else {
|
||||
html += typeName;
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
|
||||
if (virtualFolder.showLocations === false) {
|
||||
html += "<div class='cardText cardText-secondary'>";
|
||||
html += " ";
|
||||
html += "</div>";
|
||||
} else if (virtualFolder.Locations.length && virtualFolder.Locations.length === 1) {
|
||||
html += "<div class='cardText cardText-secondary'>";
|
||||
html += virtualFolder.Locations[0];
|
||||
html += "</div>";
|
||||
} else {
|
||||
html += "<div class='cardText cardText-secondary'>";
|
||||
html += globalize.translate("NumLocationsValue", virtualFolder.Locations.length);
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
html += "</div>";
|
||||
return html;
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "library.html",
|
||||
name: globalize.translate("HeaderLibraries")
|
||||
}, {
|
||||
href: "librarydisplay.html",
|
||||
name: globalize.translate("TabDisplay")
|
||||
}, {
|
||||
href: "metadataimages.html",
|
||||
name: globalize.translate("TabMetadata")
|
||||
}, {
|
||||
href: "metadatanfo.html",
|
||||
name: globalize.translate("TabNfoSettings")
|
||||
}];
|
||||
}
|
||||
|
||||
window.WizardLibraryPage = {
|
||||
next: function () {
|
||||
Dashboard.navigate("wizardsettings.html");
|
||||
}
|
||||
};
|
||||
pageClassOn("pageshow", "mediaLibraryPage", function () {
|
||||
reloadLibrary(this);
|
||||
});
|
||||
pageIdOn("pageshow", "mediaLibraryPage", function () {
|
||||
libraryMenu.setTabs("librarysetup", 0, getTabs);
|
||||
var page = this;
|
||||
taskButton({
|
||||
mode: "on",
|
||||
progressElem: page.querySelector(".refreshProgress"),
|
||||
taskKey: "RefreshLibrary",
|
||||
button: page.querySelector(".btnRefresh")
|
||||
});
|
||||
});
|
||||
pageIdOn("pagebeforehide", "mediaLibraryPage", function () {
|
||||
var page = this;
|
||||
taskButton({
|
||||
mode: "off",
|
||||
progressElem: page.querySelector(".refreshProgress"),
|
||||
taskKey: "RefreshLibrary",
|
||||
button: page.querySelector(".btnRefresh")
|
||||
});
|
||||
});
|
||||
});
|
64
src/controllers/dashboard/metadataimagespage.js
Normal file
64
src/controllers/dashboard/metadataimagespage.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
define(["jQuery", "dom", "loading", "libraryMenu", "listViewStyle"], function($, dom, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function populateLanguages(select) {
|
||||
return ApiClient.getCultures().then(function(languages) {
|
||||
var html = "";
|
||||
html += "<option value=''></option>";
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
var culture = languages[i];
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
select.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
function populateCountries(select) {
|
||||
return ApiClient.getCountries().then(function(allCountries) {
|
||||
var html = "";
|
||||
html += "<option value=''></option>";
|
||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
||||
var culture = allCountries[i];
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
select.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
function loadPage(page) {
|
||||
var promises = [ApiClient.getServerConfiguration(), populateLanguages(page.querySelector("#selectLanguage")), populateCountries(page.querySelector("#selectCountry"))];
|
||||
Promise.all(promises).then(function(responses) {
|
||||
var config = responses[0];
|
||||
page.querySelector("#selectLanguage").value = config.PreferredMetadataLanguage || "", page.querySelector("#selectCountry").value = config.MetadataCountryCode || "", loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
return loading.show(), ApiClient.getServerConfiguration().then(function(config) {
|
||||
config.PreferredMetadataLanguage = form.querySelector("#selectLanguage").value, config.MetadataCountryCode = form.querySelector("#selectCountry").value, ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
}), !1;
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "library.html",
|
||||
name: Globalize.translate("HeaderLibraries")
|
||||
}, {
|
||||
href: "librarydisplay.html",
|
||||
name: Globalize.translate("TabDisplay")
|
||||
}, {
|
||||
href: "metadataimages.html",
|
||||
name: Globalize.translate("TabMetadata")
|
||||
}, {
|
||||
href: "metadatanfo.html",
|
||||
name: Globalize.translate("TabNfoSettings")
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#metadataImagesConfigurationPage", function() {
|
||||
$(".metadataImagesConfigurationForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#metadataImagesConfigurationPage", function() {
|
||||
libraryMenu.setTabs("metadata", 2, getTabs), loading.show(), loadPage(this);
|
||||
});
|
||||
});
|
74
src/controllers/dashboard/metadatanfo.js
Normal file
74
src/controllers/dashboard/metadatanfo.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
define(["jQuery", "loading", "libraryMenu"], function ($, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadPage(page, config, users) {
|
||||
var html = '<option value="" selected="selected">' + Globalize.translate("OptionNone") + "</option>";
|
||||
html += users.map(function (user) {
|
||||
return '<option value="' + user.Id + '">' + user.Name + "</option>";
|
||||
}).join("");
|
||||
$("#selectUser", page).html(html).val(config.UserId || "");
|
||||
$("#selectReleaseDateFormat", page).val(config.ReleaseDateFormat);
|
||||
page.querySelector("#chkSaveImagePaths").checked = config.SaveImagePathsInNfo;
|
||||
page.querySelector("#chkEnablePathSubstitution").checked = config.EnablePathSubstitution;
|
||||
page.querySelector("#chkEnableExtraThumbs").checked = config.EnableExtraThumbsDuplication;
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
ApiClient.getNamedConfiguration(metadataKey).then(function (config) {
|
||||
config.UserId = $("#selectUser", form).val() || null;
|
||||
config.ReleaseDateFormat = $("#selectReleaseDateFormat", form).val();
|
||||
config.SaveImagePathsInNfo = form.querySelector("#chkSaveImagePaths").checked;
|
||||
config.EnablePathSubstitution = form.querySelector("#chkEnablePathSubstitution").checked;
|
||||
config.EnableExtraThumbsDuplication = form.querySelector("#chkEnableExtraThumbs").checked;
|
||||
ApiClient.updateNamedConfiguration(metadataKey, config).then(function () {
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
showConfirmMessage(config);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function showConfirmMessage(config) {
|
||||
var msg = [];
|
||||
msg.push(Globalize.translate("MetadataSettingChangeHelp"));
|
||||
|
||||
require(["alert"], function (alert) {
|
||||
alert({
|
||||
text: msg.join("<br/><br/>")
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "library.html",
|
||||
name: Globalize.translate("HeaderLibraries")
|
||||
}, {
|
||||
href: "librarydisplay.html",
|
||||
name: Globalize.translate("TabDisplay")
|
||||
}, {
|
||||
href: "metadataimages.html",
|
||||
name: Globalize.translate("TabMetadata")
|
||||
}, {
|
||||
href: "metadatanfo.html",
|
||||
name: Globalize.translate("TabNfoSettings")
|
||||
}];
|
||||
}
|
||||
|
||||
var metadataKey = "xbmcmetadata";
|
||||
$(document).on("pageinit", "#metadataNfoPage", function () {
|
||||
$(".metadataNfoForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#metadataNfoPage", function () {
|
||||
libraryMenu.setTabs("metadata", 3, getTabs);
|
||||
loading.show();
|
||||
var page = this;
|
||||
var promise1 = ApiClient.getUsers();
|
||||
var promise2 = ApiClient.getNamedConfiguration(metadataKey);
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadPage(page, responses[1], responses[0]);
|
||||
});
|
||||
});
|
||||
});
|
48
src/controllers/dashboard/playbackconfiguration.js
Normal file
48
src/controllers/dashboard/playbackconfiguration.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
define(["jQuery", "loading", "libraryMenu"], function ($, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadPage(page, config) {
|
||||
$("#txtMinResumePct", page).val(config.MinResumePct);
|
||||
$("#txtMaxResumePct", page).val(config.MaxResumePct);
|
||||
$("#txtMinResumeDuration", page).val(config.MinResumeDurationSeconds);
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
config.MinResumePct = $('#txtMinResumePct', form).val();
|
||||
config.MaxResumePct = $('#txtMaxResumePct', form).val();
|
||||
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "encodingsettings.html",
|
||||
name: Globalize.translate("Transcoding")
|
||||
}, {
|
||||
href: "playbackconfiguration.html",
|
||||
name: Globalize.translate("TabResumeSettings")
|
||||
}, {
|
||||
href: "streamingsettings.html",
|
||||
name: Globalize.translate("TabStreaming")
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#playbackConfigurationPage", function () {
|
||||
$(".playbackConfigurationForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#playbackConfigurationPage", function () {
|
||||
loading.show();
|
||||
libraryMenu.setTabs("playback", 1, getTabs);
|
||||
var page = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
loadPage(page, config);
|
||||
});
|
||||
});
|
||||
});
|
31
src/controllers/dashboard/serveractivity.js
Normal file
31
src/controllers/dashboard/serveractivity.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
define(["components/activitylog", "globalize"], function (ActivityLog, globalize) {
|
||||
"use strict";
|
||||
|
||||
return function (view, params) {
|
||||
var activityLog;
|
||||
|
||||
if (params.useractivity !== "false") {
|
||||
view.querySelector(".activityItems").setAttribute("data-useractivity", "true");
|
||||
view.querySelector(".sectionTitle").innerHTML = globalize.translate("HeaderActivity");
|
||||
} else {
|
||||
view.querySelector(".activityItems").setAttribute("data-useractivity", "false");
|
||||
view.querySelector(".sectionTitle").innerHTML = globalize.translate("Alerts");
|
||||
}
|
||||
|
||||
view.addEventListener("viewshow", function () {
|
||||
if (!activityLog) {
|
||||
activityLog = new ActivityLog({
|
||||
serverId: ApiClient.serverId(),
|
||||
element: view.querySelector(".activityItems")
|
||||
});
|
||||
}
|
||||
});
|
||||
view.addEventListener("viewdestroy", function () {
|
||||
if (activityLog) {
|
||||
activityLog.destroy();
|
||||
}
|
||||
|
||||
activityLog = null;
|
||||
});
|
||||
};
|
||||
});
|
43
src/controllers/dashboard/streamingsettings.js
Normal file
43
src/controllers/dashboard/streamingsettings.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
define(["jQuery", "libraryMenu", "loading"], function ($, libraryMenu, loading) {
|
||||
"use strict";
|
||||
|
||||
function loadPage(page, config) {
|
||||
$("#txtRemoteClientBitrateLimit", page).val(config.RemoteClientBitrateLimit / 1e6 || "");
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
config.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($("#txtRemoteClientBitrateLimit", form).val() || "0"));
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
href: "encodingsettings.html",
|
||||
name: Globalize.translate("Transcoding")
|
||||
}, {
|
||||
href: "playbackconfiguration.html",
|
||||
name: Globalize.translate("TabResumeSettings")
|
||||
}, {
|
||||
href: "streamingsettings.html",
|
||||
name: Globalize.translate("TabStreaming")
|
||||
}];
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#streamingSettingsPage", function () {
|
||||
$(".streamingSettingsForm").off("submit", onSubmit).on("submit", onSubmit);
|
||||
}).on("pageshow", "#streamingSettingsPage", function () {
|
||||
loading.show();
|
||||
libraryMenu.setTabs("playback", 2, getTabs);
|
||||
var page = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
loadPage(page, config);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue