2014-01-22 13:46:01 -07:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
2014-01-23 15:15:15 -07:00
|
|
|
|
function resetTuner(page, id) {
|
|
|
|
|
|
2014-05-30 12:23:56 -07:00
|
|
|
|
var message = Globalize.translate('MessageConfirmResetTuner');
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2014-05-30 12:23:56 -07:00
|
|
|
|
Dashboard.confirm(message, Globalize.translate('HeaderResetTuner'), function (confirmResult) {
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
|
|
|
|
if (confirmResult) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.resetLiveTvTuner(id).then(function () {
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderTuners(page, tuners) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
if (tuners.length) {
|
|
|
|
|
html += '<div class="paperList">';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
for (var i = 0, length = tuners.length; i < length; i++) {
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
var tuner = tuners[i];
|
|
|
|
|
html += '<paper-icon-item>';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-10-26 11:55:46 -07:00
|
|
|
|
html += '<paper-fab mini style="background:#52B54B;" icon="live-tv" item-icon></paper-fab>';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '<paper-item-body two-line>';
|
|
|
|
|
|
|
|
|
|
html += '<div>';
|
|
|
|
|
html += tuner.Name;
|
|
|
|
|
html += '</div>';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '<div secondary>';
|
|
|
|
|
html += tuner.SourceType;
|
|
|
|
|
html += '</div>';
|
2014-01-24 11:09:50 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '<div secondary>';
|
|
|
|
|
if (tuner.Status == 'RecordingTv') {
|
|
|
|
|
if (tuner.ChannelName) {
|
2014-01-24 11:09:50 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '<a href="itemdetails.html?id=' + tuner.ChannelId + '">';
|
|
|
|
|
html += Globalize.translate('StatusRecordingProgram').replace('{0}', tuner.ChannelName);
|
|
|
|
|
html += '</a>';
|
|
|
|
|
} else {
|
2014-01-24 11:09:50 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += Globalize.translate('StatusRecording');
|
|
|
|
|
}
|
2014-01-24 11:09:50 -07:00
|
|
|
|
}
|
2015-09-12 09:39:24 -07:00
|
|
|
|
else if (tuner.Status == 'LiveTv') {
|
2014-01-24 11:09:50 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
if (tuner.ChannelName) {
|
2014-01-24 11:09:50 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '<a href="itemdetails.html?id=' + tuner.ChannelId + '">';
|
|
|
|
|
html += Globalize.translate('StatusWatchingProgram').replace('{0}', tuner.ChannelName);
|
|
|
|
|
html += '</a>';
|
|
|
|
|
} else {
|
2014-01-24 11:09:50 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += Globalize.translate('StatusWatching');
|
|
|
|
|
}
|
2014-01-24 11:09:50 -07:00
|
|
|
|
}
|
2015-09-12 09:39:24 -07:00
|
|
|
|
else {
|
|
|
|
|
html += tuner.Status;
|
|
|
|
|
}
|
|
|
|
|
html += '</div>';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '</paper-item-body>';
|
|
|
|
|
html += '<paper-icon-button icon="refresh" data-tunerid="' + tuner.Id + '" title="' + Globalize.translate('ButtonResetTuner') + '" class="btnResetTuner"></paper-icon-button>';
|
|
|
|
|
html += '</paper-icon-item>';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
html += '</div>';
|
2014-01-23 15:15:15 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-16 15:21:03 -07:00
|
|
|
|
if (tuners.length) {
|
|
|
|
|
page.querySelector('.tunerSection').classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.tunerSection').classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-12 09:39:24 -07:00
|
|
|
|
var elem = $('.tunerList', page).html(html);
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
|
|
|
|
$('.btnResetTuner', elem).on('click', function () {
|
|
|
|
|
|
|
|
|
|
var id = this.getAttribute('data-tunerid');
|
|
|
|
|
|
|
|
|
|
resetTuner(page, id);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
function getServiceHtml(service) {
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
html += '<div>';
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
|
|
|
|
var serviceUrl = service.HomePageUrl || '#';
|
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
html += '<p><a href="' + serviceUrl + '" target="_blank">' + service.Name + '</a></p>';
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
|
|
|
|
var versionHtml = service.Version || 'Unknown';
|
|
|
|
|
|
|
|
|
|
if (service.HasUpdateAvailable) {
|
2014-05-30 12:23:56 -07:00
|
|
|
|
versionHtml += ' <a style="margin-left: .25em;" href="' + serviceUrl + '" target="_blank">' + Globalize.translate('LiveTvUpdateAvailable') + '</a>';
|
2014-01-22 13:46:01 -07:00
|
|
|
|
}
|
|
|
|
|
else {
|
2014-05-30 12:23:56 -07:00
|
|
|
|
versionHtml += '<img src="css/images/checkmarkgreen.png" style="height: 17px; margin-left: 10px; margin-right: 0; position: relative; top: 5px; border-radius:3px;" /> ' + Globalize.translate('LabelVersionUpToDate');
|
2014-01-22 13:46:01 -07:00
|
|
|
|
}
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
html += '<p>' + versionHtml + '</p>';
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
var status = service.Status;
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
if (service.Status == 'Ok') {
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
|
|
|
|
status = '<span style="color:green;">' + status + '</span>';
|
|
|
|
|
} else {
|
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
if (service.StatusMessage) {
|
|
|
|
|
status += ' (' + service.StatusMessage + ')';
|
2014-01-22 13:46:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status = '<span style="color:red;">' + status + '</span>';
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
html += '<p>' + Globalize.translate('ValueStatus', status) + '</p>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadPage(page, liveTvInfo) {
|
|
|
|
|
|
|
|
|
|
if (liveTvInfo.IsEnabled) {
|
|
|
|
|
|
|
|
|
|
$('.liveTvStatusContent', page).show();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$('.liveTvStatusContent', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
var servicesToDisplay = liveTvInfo.Services.filter(function (s) {
|
|
|
|
|
|
|
|
|
|
return s.IsVisible;
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (servicesToDisplay.length) {
|
|
|
|
|
$('.servicesSection', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.servicesSection', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('.servicesList', page).html(servicesToDisplay.map(getServiceHtml).join('')).trigger('create');
|
2015-03-12 08:51:48 -07:00
|
|
|
|
|
|
|
|
|
var tuners = [];
|
|
|
|
|
for (var i = 0, length = liveTvInfo.Services.length; i < length; i++) {
|
|
|
|
|
|
|
|
|
|
for (var j = 0, numTuners = liveTvInfo.Services[i].Tuners.length; j < numTuners; j++) {
|
|
|
|
|
tuners.push(liveTvInfo.Services[i].Tuners[j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
2015-03-12 08:51:48 -07:00
|
|
|
|
renderTuners(page, tuners);
|
2014-01-23 15:15:15 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
|
|
|
|
renderDevices(page, config.TunerHosts);
|
2015-07-23 06:23:22 -07:00
|
|
|
|
renderProviders(page, config.ListingProviders);
|
2015-07-20 21:22:46 -07:00
|
|
|
|
});
|
|
|
|
|
|
2014-01-22 13:46:01 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
function renderDevices(page, devices) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
if (devices.length) {
|
|
|
|
|
html += '<div class="paperList">';
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
for (var i = 0, length = devices.length; i < length; i++) {
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
var device = devices[i];
|
2015-07-25 11:11:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
var href = 'livetvtunerprovider-' + device.Type + '.html?id=' + device.Id;
|
2015-07-25 11:11:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '<paper-icon-item>';
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-10-26 11:55:46 -07:00
|
|
|
|
html += '<paper-fab mini style="background:#52B54B;" icon="live-tv" item-icon></paper-fab>';
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '<paper-item-body two-line>';
|
|
|
|
|
html += '<a class="clearLink" href="' + href + '">';
|
|
|
|
|
html += '<div>';
|
|
|
|
|
html += getTunerName(device.Type);
|
|
|
|
|
html += '</div>';
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '<div secondary>';
|
|
|
|
|
html += device.Url;
|
|
|
|
|
html += '</div>';
|
|
|
|
|
html += '</a>';
|
|
|
|
|
html += '</paper-item-body>';
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-08-20 20:21:27 -07:00
|
|
|
|
html += '<paper-icon-button icon="delete" data-id="' + device.Id + '" title="' + Globalize.translate('ButtonDelete') + '" class="btnDeleteDevice"></paper-icon-button>';
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '</paper-icon-item>';
|
|
|
|
|
}
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var elem = $('.devicesList', page).html(html);
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
|
|
|
|
$('.btnDeleteDevice', elem).on('click', function () {
|
|
|
|
|
|
|
|
|
|
var id = this.getAttribute('data-id');
|
|
|
|
|
|
|
|
|
|
deleteDevice(page, id);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteDevice(page, id) {
|
|
|
|
|
|
|
|
|
|
var message = Globalize.translate('MessageConfirmDeleteTunerDevice');
|
|
|
|
|
|
|
|
|
|
Dashboard.confirm(message, Globalize.translate('HeaderDeleteDevice'), function (confirmResult) {
|
|
|
|
|
|
|
|
|
|
if (confirmResult) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
type: "DELETE",
|
|
|
|
|
url: ApiClient.getUrl('LiveTv/TunerHosts', {
|
|
|
|
|
Id: id
|
|
|
|
|
})
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function () {
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-23 15:15:15 -07:00
|
|
|
|
function reload(page) {
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getLiveTvInfo().then(function (liveTvInfo) {
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
|
|
|
|
loadPage(page, liveTvInfo);
|
|
|
|
|
|
|
|
|
|
});
|
2014-01-23 15:15:15 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
function submitAddDeviceForm(page) {
|
2014-03-16 12:39:58 -07:00
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
page.querySelector('.dlgAddDevice').close();
|
|
|
|
|
Dashboard.showLoadingMsg();
|
2014-03-16 12:39:58 -07:00
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: ApiClient.getUrl('LiveTv/TunerHosts'),
|
|
|
|
|
data: JSON.stringify({
|
|
|
|
|
Type: $('#selectTunerDeviceType', page).val(),
|
|
|
|
|
Url: $('#txtDevicePath', page).val()
|
|
|
|
|
}),
|
|
|
|
|
contentType: "application/json"
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function () {
|
2014-01-22 13:46:01 -07:00
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
reload(page);
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}, function () {
|
2015-07-23 06:23:22 -07:00
|
|
|
|
Dashboard.alert({
|
|
|
|
|
message: Globalize.translate('ErrorAddingTunerDevice')
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderProviders(page, providers) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
if (providers.length) {
|
|
|
|
|
html += '<div class="paperList">';
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
for (var i = 0, length = providers.length; i < length; i++) {
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
var provider = providers[i];
|
|
|
|
|
html += '<paper-icon-item>';
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-10-26 11:55:46 -07:00
|
|
|
|
html += '<paper-fab mini style="background:#52B54B;" icon="dvr" item-icon></paper-fab>';
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '<paper-item-body two-line>';
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-08-21 19:59:10 -07:00
|
|
|
|
html += '<a class="clearLink" href="' + getProviderConfigurationUrl(provider.Type) + '&id=' + provider.Id + '">';
|
2015-08-20 14:58:07 -07:00
|
|
|
|
|
|
|
|
|
html += '<div>';
|
|
|
|
|
html += getProviderName(provider.Type);
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</a>';
|
|
|
|
|
html += '</paper-item-body>';
|
2015-08-20 20:21:27 -07:00
|
|
|
|
html += '<paper-icon-button icon="delete" data-id="' + provider.Id + '" title="' + Globalize.translate('ButtonDelete') + '" class="btnDelete"></paper-icon-button>';
|
2015-08-20 14:58:07 -07:00
|
|
|
|
html += '</paper-icon-item>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
}
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-08-20 14:58:07 -07:00
|
|
|
|
var elem = $('.providerList', page).html(html);
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
|
|
|
|
$('.btnDelete', elem).on('click', function () {
|
|
|
|
|
|
|
|
|
|
var id = this.getAttribute('data-id');
|
|
|
|
|
|
|
|
|
|
deleteProvider(page, id);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteProvider(page, id) {
|
|
|
|
|
|
|
|
|
|
var message = Globalize.translate('MessageConfirmDeleteGuideProvider');
|
|
|
|
|
|
|
|
|
|
Dashboard.confirm(message, Globalize.translate('HeaderDeleteProvider'), function (confirmResult) {
|
|
|
|
|
|
|
|
|
|
if (confirmResult) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
type: "DELETE",
|
|
|
|
|
url: ApiClient.getUrl('LiveTv/ListingProviders', {
|
|
|
|
|
Id: id
|
|
|
|
|
})
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}).then(function () {
|
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
|
|
|
|
|
}, function () {
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
|
|
|
|
reload(page);
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-03-16 12:39:58 -07:00
|
|
|
|
});
|
2015-07-23 06:23:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-25 11:42:39 -07:00
|
|
|
|
function getTunerName(providerId) {
|
|
|
|
|
|
|
|
|
|
providerId = providerId.toLowerCase();
|
|
|
|
|
|
|
|
|
|
switch (providerId) {
|
|
|
|
|
|
|
|
|
|
case 'm3u':
|
2015-08-23 19:08:20 -07:00
|
|
|
|
return 'M3U Playlist';
|
2015-07-25 11:42:39 -07:00
|
|
|
|
case 'hdhomerun':
|
|
|
|
|
return 'HDHomerun';
|
|
|
|
|
default:
|
|
|
|
|
return 'Unknown';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
function getProviderName(providerId) {
|
|
|
|
|
|
|
|
|
|
providerId = providerId.toLowerCase();
|
2014-03-16 12:39:58 -07:00
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
switch (providerId) {
|
|
|
|
|
|
|
|
|
|
case 'schedulesdirect':
|
|
|
|
|
return 'Schedules Direct';
|
2015-08-10 12:55:33 -07:00
|
|
|
|
case 'emby':
|
|
|
|
|
return 'Emby Guide';
|
2015-07-23 06:23:22 -07:00
|
|
|
|
default:
|
|
|
|
|
return 'Unknown';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getProviderConfigurationUrl(providerId) {
|
|
|
|
|
|
|
|
|
|
providerId = providerId.toLowerCase();
|
|
|
|
|
|
|
|
|
|
switch (providerId) {
|
|
|
|
|
|
|
|
|
|
case 'schedulesdirect':
|
2015-08-21 19:59:10 -07:00
|
|
|
|
return 'livetvguideprovider.html?type=schedulesdirect';
|
2015-08-10 10:37:50 -07:00
|
|
|
|
case 'emby':
|
2015-08-21 19:59:10 -07:00
|
|
|
|
return 'livetvguideprovider.html?type=emby';
|
2015-07-23 06:23:22 -07:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addProvider(button) {
|
|
|
|
|
|
|
|
|
|
var menuItems = [];
|
|
|
|
|
|
2015-08-15 13:33:53 -07:00
|
|
|
|
menuItems.push({
|
|
|
|
|
name: 'Schedules Direct',
|
|
|
|
|
id: 'SchedulesDirect'
|
|
|
|
|
});
|
2015-08-10 10:37:50 -07:00
|
|
|
|
|
2015-08-15 11:46:57 -07:00
|
|
|
|
//menuItems.push({
|
|
|
|
|
// name: 'Emby Guide',
|
|
|
|
|
// id: 'emby'
|
|
|
|
|
//});
|
2015-07-23 06:23:22 -07:00
|
|
|
|
|
2015-08-25 19:13:28 -07:00
|
|
|
|
menuItems.push({
|
|
|
|
|
name: Globalize.translate('ButtonOther'),
|
|
|
|
|
id: 'other'
|
|
|
|
|
});
|
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
require(['actionsheet'], function () {
|
|
|
|
|
|
|
|
|
|
ActionSheetElement.show({
|
|
|
|
|
items: menuItems,
|
|
|
|
|
positionTo: button,
|
|
|
|
|
callback: function (id) {
|
|
|
|
|
|
2015-08-25 19:13:28 -07:00
|
|
|
|
if (id == 'other') {
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
message: Globalize.translate('ForAdditionalLiveTvOptions')
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
Dashboard.navigate(getProviderConfigurationUrl(id));
|
|
|
|
|
}
|
2015-07-23 06:23:22 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
2015-07-20 21:22:46 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-25 11:11:46 -07:00
|
|
|
|
function addDevice(button) {
|
|
|
|
|
|
|
|
|
|
var menuItems = [];
|
|
|
|
|
|
|
|
|
|
menuItems.push({
|
2015-07-25 11:42:39 -07:00
|
|
|
|
name: 'HDHomerun',
|
2015-07-25 11:11:46 -07:00
|
|
|
|
id: 'hdhomerun'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
menuItems.push({
|
2015-08-23 19:08:20 -07:00
|
|
|
|
name: getTunerName('m3u'),
|
2015-07-25 11:11:46 -07:00
|
|
|
|
id: 'm3u'
|
|
|
|
|
});
|
|
|
|
|
|
2015-08-25 19:13:28 -07:00
|
|
|
|
menuItems.push({
|
|
|
|
|
name: Globalize.translate('ButtonOther'),
|
|
|
|
|
id: 'other'
|
|
|
|
|
});
|
|
|
|
|
|
2015-07-25 11:11:46 -07:00
|
|
|
|
require(['actionsheet'], function () {
|
|
|
|
|
|
|
|
|
|
ActionSheetElement.show({
|
|
|
|
|
items: menuItems,
|
|
|
|
|
positionTo: button,
|
|
|
|
|
callback: function (id) {
|
|
|
|
|
|
2015-08-25 19:13:28 -07:00
|
|
|
|
if (id == 'other') {
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
message: Globalize.translate('ForAdditionalLiveTvOptions')
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
Dashboard.navigate('livetvtunerprovider-' + id + '.html');
|
|
|
|
|
}
|
2015-07-25 11:11:46 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#liveTvStatusPage", function () {
|
2014-03-16 12:39:58 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-07-20 21:22:46 -07:00
|
|
|
|
$('.btnAddDevice', page).on('click', function () {
|
2015-07-25 11:11:46 -07:00
|
|
|
|
addDevice(this);
|
2015-07-20 21:22:46 -07:00
|
|
|
|
});
|
|
|
|
|
|
2015-07-22 22:25:55 -07:00
|
|
|
|
$('.formAddDevice', page).on('submit', function () {
|
2015-07-20 21:22:46 -07:00
|
|
|
|
submitAddDeviceForm(page);
|
|
|
|
|
return false;
|
2015-01-20 13:19:54 -07:00
|
|
|
|
});
|
2014-03-16 12:39:58 -07:00
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
$('.btnAddProvider', page).on('click', function () {
|
|
|
|
|
addProvider(this);
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#liveTvStatusPage", function () {
|
2015-07-20 21:22:46 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
reload(page);
|
2015-09-12 09:39:24 -07:00
|
|
|
|
|
2015-10-16 15:21:03 -07:00
|
|
|
|
// on here
|
|
|
|
|
$('.btnRefresh', page).taskButton({
|
|
|
|
|
mode: 'on',
|
|
|
|
|
progressElem: page.querySelector('.refreshGuideProgress'),
|
|
|
|
|
taskKey: 'RefreshGuide'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).on('pagehide', "#liveTvStatusPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
// off here
|
|
|
|
|
$('.btnRefreshGuide', page).taskButton({
|
|
|
|
|
mode: 'off'
|
|
|
|
|
});
|
|
|
|
|
|
2014-01-22 13:46:01 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document, window);
|