mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add dlna service methods
This commit is contained in:
parent
adc96abf4e
commit
da74410dfb
5 changed files with 217 additions and 1 deletions
39
dashboard-ui/dlnaprofile.html
Normal file
39
dashboard-ui/dlnaprofile.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>DLNA</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="dlnaProfilePage" data-role="page" class="page type-interior adminPage dlnaPage">
|
||||
|
||||
<div data-role="content">
|
||||
<div class="content-primary">
|
||||
|
||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||
<a href="dlnasettings.html" data-role="button">Settings</a>
|
||||
<a href="#" data-role="button" class="ui-btn-active">Profiles</a>
|
||||
</div>
|
||||
|
||||
<form class="dlnaProfileForm">
|
||||
|
||||
<ul data-role="listview" class="ulForm">
|
||||
<li>
|
||||
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
|
||||
Save
|
||||
</button>
|
||||
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete" data-mini="true">
|
||||
Cancel
|
||||
</button>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('.dlnaProfileForm').off('submit', DlnaProfilePage.onSubmit).on('submit', DlnaProfilePage.onSubmit);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -14,6 +14,26 @@
|
|||
<a href="#" data-role="button" class="ui-btn-active">Profiles</a>
|
||||
</div>
|
||||
|
||||
<div class="readOnlyContent">
|
||||
|
||||
<div style="position: relative;">
|
||||
<h2>Custom Profiles</h2>
|
||||
<div style="position: absolute; right: 0; top: -12px;">
|
||||
<a data-role="button" data-icon="plus" data-mini="true" href="dlnaprofile.html">New</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Create a custom profile to target a new device or override a system profile.</p>
|
||||
|
||||
<div class="customProfiles"></div>
|
||||
|
||||
<br />
|
||||
<h2>System Profiles</h2>
|
||||
|
||||
<p>System profiles are read-only. To override a system profile, create a custom profile targeting the same device.</p>
|
||||
|
||||
<div class="systemProfiles"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
39
dashboard-ui/scripts/dlnaprofile.js
Normal file
39
dashboard-ui/scripts/dlnaprofile.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
(function ($, document, window) {
|
||||
|
||||
function loadProfile(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var id = getParameterByName('id');
|
||||
var url = id ? 'Dlna/Profiles/' + id :
|
||||
'Dlna/Profiles/Default';
|
||||
|
||||
$.getJSON(ApiClient.getUrl(url)).done(function (result) {
|
||||
|
||||
renderProfile(page, result);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
function renderProfile(page, profile) {
|
||||
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#dlnaProfilePage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
loadProfile(page);
|
||||
|
||||
});
|
||||
|
||||
window.DlnaProfilePage = {
|
||||
|
||||
onSubmit: function() {
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, document, window);
|
|
@ -1 +1,115 @@
|
|||
|
||||
(function ($, document, window) {
|
||||
|
||||
function loadProfiles(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).done(function (result) {
|
||||
|
||||
renderProfiles(page, result);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function renderProfiles(page, profiles) {
|
||||
|
||||
renderUserProfiles(page, profiles);
|
||||
renderSystemProfiles(page, profiles);
|
||||
}
|
||||
|
||||
function renderUserProfiles(page, profiles) {
|
||||
|
||||
profiles = profiles.filter(function (p) {
|
||||
return p.Type == 'User';
|
||||
});
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
|
||||
var profile = profiles[i];
|
||||
|
||||
html += '<li>';
|
||||
html += '<a href="dlnaprofile.html?id=' + profile.Id + '">';
|
||||
html += profile.Name;
|
||||
html += '</a>';
|
||||
|
||||
html += '<a href="#" data-icon="delete" class="btnDeleteProfile" data-profileid="' + profile.Id + '">Delete</a>';
|
||||
|
||||
html += '</li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
var elem = $('.customProfiles', page).html(html).trigger('create');
|
||||
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
|
||||
var id = this.getAttribute('data-profileid');
|
||||
deleteProfile(page, id);
|
||||
});
|
||||
}
|
||||
|
||||
function renderSystemProfiles(page, profiles) {
|
||||
|
||||
profiles = profiles.filter(function (p) {
|
||||
return p.Type == 'System';
|
||||
});
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true">';
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
|
||||
var profile = profiles[i];
|
||||
|
||||
html += '<li>';
|
||||
html += '<a href="dlnaprofile.html?id=' + profile.Id + '">';
|
||||
html += profile.Name;
|
||||
html += '</a>';
|
||||
html += '</li>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
|
||||
$('.systemProfiles', page).html(html).trigger('create');
|
||||
}
|
||||
|
||||
function deleteProfile(page, id) {
|
||||
|
||||
Dashboard.confirm("Are you sure you wish to delete this profile?", "Confirm Profile Deletion", function (result) {
|
||||
|
||||
if (result) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Dlna/Profiles/" + id)
|
||||
|
||||
}).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
loadProfiles(page);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#dlnaProfilesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
loadProfiles(page);
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document, window);
|
||||
|
|
|
@ -1118,6 +1118,10 @@
|
|||
attributes.push(createAttribute("Sample Rate", stream.SampleRate + ' khz'));
|
||||
}
|
||||
|
||||
if (stream.PixelFormat) {
|
||||
attributes.push(createAttribute("Pixel Format", stream.PixelFormat));
|
||||
}
|
||||
|
||||
if (stream.Type != "Video") {
|
||||
attributes.push(createAttribute("Default", (stream.IsDefault ? 'Yes' : 'No')));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue