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

added tuner list to tv status page

This commit is contained in:
Luke Pulverenti 2014-01-23 17:15:15 -05:00
parent 70dcad3253
commit e22622a6ac
4 changed files with 113 additions and 5 deletions

View file

@ -655,6 +655,20 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
self.resetLiveTvTuner = function (id) {
if (!id) {
throw new Error("null id");
}
var url = self.getUrl("LiveTv/Tuners/" + id + "/Reset");
return self.ajax({
type: "POST",
url: url
});
};
self.getLiveTvSeriesTimers = function (options) {
var url = self.getUrl("LiveTv/SeriesTimers", options || {});

View file

@ -23,7 +23,23 @@
<p>Status: <span id="activeServiceStatus"></span></p>
<p>Version: <span id="activeServiceVersion"></span></p>
</div>
<br />
<h2>Tuners</h2>
<table data-role="table" data-mode="reflow" class="tblTuners stripedTable ui-responsive table-stroke">
<thead>
<tr>
<th>Name</th>
<th>Source</th>
<th>Status</th>
<th>Program</th>
<th>Clients</th>
<th></th>
</tr>
</thead>
<tbody class="tunersResultBody">
</tbody>
</table>
</div>
<div class="noLiveTvServices" style="display: none;">

View file

@ -1,5 +1,76 @@
(function ($, document, window) {
function resetTuner(page, id) {
var message = 'Are you sure you wish to reset this tuner? Any active players or recordings will be abruptly stopped.';
Dashboard.confirm(message, "Reset Tuner", function (confirmResult) {
if (confirmResult) {
Dashboard.showLoadingMsg();
ApiClient.resetLiveTvTuner(id).done(function () {
Dashboard.hideLoadingMsg();
reload(page);
});
}
});
}
function renderTuners(page, tuners) {
var html = '';
for (var i = 0, length = tuners.length; i < length; i++) {
var tuner = tuners[i];
html += '<tr>';
html += '<td>';
html += tuner.Name;
html += '</td>';
html += '<td>';
html += tuner.SourceType;
html += '</td>';
html += '<td>';
html += tuner.Status;
html += '</td>';
html += '<td>';
if (tuner.ProgramName) {
html += tuner.ProgramName;
}
html += '</td>';
html += '<td>';
html += tuner.Clients.join('<br/>');
html += '</td>';
html += '<td>';
html += '<button data-tunerid="' + tuner.Id + '" type="button" data-inline="true" data-icon="refresh" data-mini="true" data-iconpos="notext" class="btnResetTuner organizerButton" title="Reset Tuner">Reset</button>';
html += '</td>';
html += '</tr>';
}
var elem = $('.tunersResultBody', page).html(html).parents('.tblTuners').table("refresh").trigger('create');
$('.btnResetTuner', elem).on('click', function () {
var id = this.getAttribute('data-tunerid');
resetTuner(page, id);
});
}
function loadPage(page, liveTvInfo) {
if (liveTvInfo.IsEnabled) {
@ -48,20 +119,27 @@
$('#activeServiceStatus', page).html(status);
renderTuners(page, service.Tuners || []);
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#liveTvStatusPage", function () {
function reload(page) {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getLiveTvInfo().done(function (liveTvInfo) {
loadPage(page, liveTvInfo);
});
}
$(document).on('pageshow', "#liveTvStatusPage", function () {
var page = this;
reload(page);
});

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.243" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.244" targetFramework="net45" />
</packages>