update sat/ip discovery

This commit is contained in:
Luke Pulverenti 2016-03-13 03:34:17 -04:00
parent 5c4854b777
commit 4fb729169f
10 changed files with 210 additions and 92 deletions

View file

@ -74,7 +74,11 @@
html += '</div>';
html += '</paper-item-body>';
html += '<paper-icon-button icon="refresh" data-tunerid="' + tuner.Id + '" title="' + Globalize.translate('ButtonResetTuner') + '" class="btnResetTuner"></paper-icon-button>';
if (tuner.CanReset) {
html += '<paper-icon-button icon="refresh" data-tunerid="' + tuner.Id + '" title="' + Globalize.translate('ButtonResetTuner') + '" class="btnResetTuner"></paper-icon-button>';
}
html += '</paper-icon-item>';
}
@ -201,7 +205,7 @@
html += '<paper-item-body two-line>';
html += '<a class="clearLink" href="' + href + '">';
html += '<div>';
html += getTunerName(device.Type);
html += device.FriendlyName || getTunerName(device.Type);
html += '</div>';
html += '<div secondary>';
@ -367,6 +371,8 @@
return 'M3U Playlist';
case 'hdhomerun':
return 'HDHomerun';
case 'satip':
return 'DVB';
default:
return 'Unknown';
}
@ -445,6 +451,11 @@
var menuItems = [];
//menuItems.push({
// name: getTunerName('satip'),
// id: 'satip'
//});
menuItems.push({
name: 'HDHomerun',
id: 'hdhomerun'

View file

@ -0,0 +1,84 @@
(function ($, document, window) {
function reload(page, providerId) {
page.querySelector('.txtDevicePath').value = '';
if (providerId) {
ApiClient.getNamedConfiguration("livetv").then(function (config) {
var info = config.TunerHosts.filter(function (i) {
return i.Id == providerId;
})[0];
page.querySelector('.txtDevicePath').value = info.Url || '';
});
}
}
function submitForm(page) {
Dashboard.showLoadingMsg();
var id = getParameterByName('id');
if (id) {
ApiClient.getNamedConfiguration("livetv").then(function (config) {
var info = config.TunerHosts.filter(function (i) {
return i.Id == id;
})[0];
info.Url = page.querySelector('.txtDevicePath').value;
submitTunerInfo(page, info);
});
} else {
var info = {
Type: 'satip',
Url: page.querySelector('.txtDevicePath').value
};
submitTunerInfo(page, info);
}
}
function submitTunerInfo(page, info) {
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl('LiveTv/TunerHosts'),
data: JSON.stringify(info),
contentType: "application/json"
}).then(function () {
Dashboard.processServerConfigurationUpdateResult();
Dashboard.navigate('livetvstatus.html');
}, function () {
Dashboard.hideLoadingMsg();
Dashboard.alert({
message: Globalize.translate('ErrorSavingTvProvider')
});
});
}
$(document).on('pageinit', "#liveTvTunerProviderSatPage", function () {
var page = this;
$('form', page).on('submit', function () {
submitForm(page);
return false;
});
}).on('pageshow', "#liveTvTunerProviderSatPage", function () {
var providerId = getParameterByName('id');
var page = this;
reload(page, providerId);
});
})(jQuery, document, window);