jellyfin-web/dashboard-ui/scripts/dlnaprofile.js

1 line
30 KiB
JavaScript
Raw Normal View History

2017-01-27 20:16:59 -07:00
define(["jQuery","fnchecked","jqmlistview","emby-select","emby-button","emby-input","emby-checkbox","listViewStyle"],function($){"use strict";function loadProfile(page){Dashboard.showLoadingMsg();var promise1=getProfile(),promise2=ApiClient.getUsers();Promise.all([promise1,promise2]).then(function(responses){currentProfile=responses[0],renderProfile(page,currentProfile,responses[1]),Dashboard.hideLoadingMsg()})}function getProfile(){var id=getParameterByName("id"),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=(profile.SupportedMediaTypes||"").split(",").indexOf(this.getAttribute("data-value"))!=-1}),$("#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,html='<div class="paperList">'+headers.map(function(h){var li='<div class="listItem">';return li+='<i class="md-icon 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 lis