completed tuner hosts

This commit is contained in:
Luke Pulverenti 2015-07-21 00:22:46 -04:00
parent 0e4e4da6c8
commit 68526e2c1d
13 changed files with 248 additions and 54 deletions

View file

@ -81,7 +81,6 @@
var context = getParameterByName('context');
$('.sectionTabs', page).hide();
$('.' + context + 'SectionTabs', page).show();
if (context == 'sync') {
Dashboard.setPageTitle(Globalize.translate('TitleSync'));
@ -96,6 +95,17 @@
page.setAttribute('data-helpurl', 'https://github.com/MediaBrowser/Wiki/wiki/Notifications');
}
}).on('pagebeforeshowready', "#appServicesPage", function () {
// This needs both events for the helpurl to get done at the right time
var page = this;
var context = getParameterByName('context');
$('.sectionTabs', page).hide();
$('.' + context + 'SectionTabs', page).show();
}).on('pageshowready', "#appServicesPage", function () {
// This needs both events for the helpurl to get done at the right time

View file

@ -150,7 +150,19 @@
$('.noLiveTvServices', page).show();
}
$('.servicesList', page).html(liveTvInfo.Services.map(getServiceHtml).join('')).trigger('create');
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');
var tuners = [];
for (var i = 0, length = liveTvInfo.Services.length; i < length; i++) {
@ -162,9 +174,83 @@
renderTuners(page, tuners);
ApiClient.getNamedConfiguration("livetv").done(function (config) {
renderDevices(page, config.TunerHosts);
});
Dashboard.hideLoadingMsg();
}
function renderDevices(page, devices) {
var html = '';
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
for (var i = 0, length = devices.length; i < length; i++) {
var device = devices[i];
html += '<li>';
html += '<a href="#">';
html += '<h3>';
if (device.Type == 'm3u') {
html += "M3U";
}
else if (device.Type == 'hdhomerun') {
html += "HD Homerun";
} else {
html += device.Type;
}
html += '</h3>';
html += '<p>';
html += device.Url;
html += '</p>';
html += '</a>';
html += '<a href="#" class="btnDeleteDevice">';
html += '</a>';
html += '</li>';
}
html += '</ul>';
var elem = $('.devicesList', page).html(html).trigger('create');
$('.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
})
}).done(function () {
reload(page);
});
}
});
}
function reload(page) {
Dashboard.showLoadingMsg();
@ -176,29 +262,45 @@
});
}
$(document).on('pageshowready', "#liveTvStatusPage", function () {
function submitAddDeviceForm(page) {
page.querySelector('.dlgAddDevice').close();
Dashboard.showLoadingMsg();
ApiClient.ajax({
type: "POST",
url: ApiClient.getUrl('LiveTv/TunerHosts'),
data: JSON.stringify({
Type: $('#selectTunerDeviceType', page).val(),
Url: $('#txtDevicePath', page).val()
}),
contentType: "application/json"
}).done(function () {
reload(page);
});
}
$(document).on('pageinitdepends', "#liveTvStatusPage", function () {
var page = this;
$('.btnAddDevice', page).on('click', function () {
page.querySelector('.dlgAddDevice').open();
});
$('.dlgAddDevice', page).on('submit', function () {
submitAddDeviceForm(page);
return false;
});
}).on('pageshowready', "#liveTvStatusPage", function () {
var page = this;
reload(page);
// on here
$('.btnRefreshGuide', page).taskButton({
mode: 'on',
progressElem: $('.refreshGuideProgress', page),
lastResultElem: $('.lastRefreshGuideResult', page),
taskKey: 'RefreshGuide'
});
}).on('pagebeforehide', "#liveTvStatusPage", function () {
var page = this;
// off here
$('.btnRefreshGuide', page).taskButton({
mode: 'off'
});
});
})(jQuery, document, window);

View file

@ -58,6 +58,7 @@
options.push({ name: '1080p - 8Mbps', maxHeight: 1080, bitrate: 8000001 });
options.push({ name: '1080p - 6Mbps', maxHeight: 1080, bitrate: 6000001 });
options.push({ name: '1080p - 5Mbps', maxHeight: 1080, bitrate: 5000001 });
options.push({ name: '1080p - 4Mbps', maxHeight: 1080, bitrate: 4000002 });
} else if (maxAllowedWidth >= 1260) {
options.push({ name: '720p - 10Mbps', maxHeight: 720, bitrate: 10000000 });
@ -119,14 +120,22 @@
})[0].maxHeight;
}
var isVlc = AppInfo.isNativeApp && $.browser.android;
var bitrateSetting = AppSettings.maxStreamingBitrate();
if (isVlc) {
// Work around vlc 1080p stutter for now
if ((maxHeight || 1080) >= 1080) {
bitrateSetting = Math.min(bitrateSetting, 4000002);
}
}
var canPlayWebm = self.canPlayWebm();
var profile = {};
profile.MaxStreamingBitrate = bitrateSetting;
profile.MaxStaticBitrate = 40000000;
profile.MaxStaticBitrate = 4000000;
profile.MusicStreamingTranscodingBitrate = Math.min(bitrateSetting, 192000);
profile.DirectPlayProfiles = [];
@ -303,8 +312,6 @@
}]
});
var isVlc = AppInfo.isNativeApp && $.browser.android;
if (!isVlc) {
profile.CodecProfiles.push({
Type: 'VideoAudio',

View file

@ -29,7 +29,7 @@
});
}
function getPluginCardHtml(plugin, pluginConfigurationPages) {
function getPluginCardHtml(plugin, getTextLinesCallback, pluginConfigurationPages) {
var configPage = $.grep(pluginConfigurationPages, function (pluginConfigurationPage) {
return pluginConfigurationPage.PluginId == plugin.Id;
@ -96,6 +96,10 @@
html += plugin.Version;
html += "</div>";
if (getTextLinesCallback) {
html += getTextLinesCallback(plugin);
}
// cardFooter
html += "</div>";
@ -108,16 +112,16 @@
return html;
}
function renderPlugins(page, plugins) {
function renderPlugins(page, plugins, getTextLinesCallback) {
ApiClient.getJSON(ApiClient.getUrl("dashboard/configurationpages") + "?pageType=PluginConfiguration").done(function (configPages) {
populateList(page, plugins, configPages);
populateList(page, plugins, getTextLinesCallback, configPages);
});
}
function populateList(page, plugins, pluginConfigurationPages) {
function populateList(page, plugins, getTextLinesCallback, pluginConfigurationPages) {
plugins = plugins.sort(function (plugin1, plugin2) {
@ -126,7 +130,7 @@
});
var html = plugins.map(function (p) {
return getPluginCardHtml(p, pluginConfigurationPages);
return getPluginCardHtml(p, getTextLinesCallback, pluginConfigurationPages);
}).join('');
@ -187,7 +191,7 @@
ActionSheetElement.show({
items: menuItems,
positionTo: card,
positionTo: elem,
callback: function (resultId) {
switch (resultId) {