2016-03-18 21:26:17 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
function loadPage(page, config) {
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
$('.liveTvSettingsForm', page).show();
|
|
|
|
|
$('.noLiveTvServices', page).hide();
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-09-03 10:01:51 -07:00
|
|
|
|
$('#selectGuideDays', page).val(config.GuideDays || '');
|
2014-01-16 15:49:31 -07:00
|
|
|
|
|
2015-08-18 23:12:58 -07:00
|
|
|
|
$('#chkMovies', page).checked(config.EnableMovieProviders);
|
2015-08-22 12:46:55 -07:00
|
|
|
|
$('#chkOrganize', page).checked(config.EnableAutoOrganize);
|
2016-02-12 00:01:38 -07:00
|
|
|
|
$('#chkConvertRecordings', page).checked(config.EnableRecordingEncoding);
|
2014-01-16 15:49:31 -07:00
|
|
|
|
|
2015-07-23 07:58:27 -07:00
|
|
|
|
$('#txtRecordingPath', page).val(config.RecordingPath || '');
|
|
|
|
|
|
2015-08-23 19:08:20 -07:00
|
|
|
|
$('#txtPrePaddingMinutes', page).val(config.PrePaddingSeconds / 60);
|
|
|
|
|
$('#txtPostPaddingMinutes', page).val(config.PostPaddingSeconds / 60);
|
|
|
|
|
|
2014-01-12 09:55:38 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-06 19:51:04 -07:00
|
|
|
|
function onSubmit() {
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
var form = this;
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
config.GuideDays = $('#selectGuideDays', form).val() || null;
|
|
|
|
|
config.EnableMovieProviders = $('#chkMovies', form).checked();
|
|
|
|
|
config.EnableAutoOrganize = $('#chkOrganize', form).checked();
|
|
|
|
|
config.EnableRecordingEncoding = $('#chkConvertRecordings', form).checked();
|
|
|
|
|
config.RecordingPath = $('#txtRecordingPath', form).val() || null;
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
config.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
|
|
|
|
config.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
2015-08-23 19:08:20 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
ApiClient.updateNamedConfiguration("livetv", config).then(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
|
});
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-02-12 11:12:59 -07:00
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
2015-06-06 19:51:04 -07:00
|
|
|
|
}
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-04-12 23:02:07 -07:00
|
|
|
|
function getTabs() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
href: 'livetvstatus.html',
|
|
|
|
|
name: Globalize.translate('TabDevices')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
href: 'livetvsettings.html',
|
|
|
|
|
name: Globalize.translate('TabSettings')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
href: 'appservices.html?context=livetv',
|
|
|
|
|
name: Globalize.translate('TabServices')
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
$(document).on('pageinit', "#liveTvSettingsPage", function () {
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-07-23 07:58:27 -07:00
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-06-06 19:51:04 -07:00
|
|
|
|
$('.liveTvSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-07-23 07:58:27 -07:00
|
|
|
|
$('#btnSelectRecordingPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2015-07-23 07:58:27 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
var picker = new directoryBrowser();
|
2015-07-23 07:58:27 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
picker.show({
|
2015-07-23 07:58:27 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
callback: function (path) {
|
|
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtRecordingPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
2015-07-23 07:58:27 -07:00
|
|
|
|
}
|
2015-10-13 12:22:45 -07:00
|
|
|
|
});
|
2015-07-23 07:58:27 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
}).on('pageshow', "#liveTvSettingsPage", function () {
|
2014-01-16 15:49:31 -07:00
|
|
|
|
|
2016-04-12 23:02:07 -07:00
|
|
|
|
LibraryMenu.setTabs('livetvadmin', 1, getTabs);
|
2015-06-06 19:51:04 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
2014-01-16 15:49:31 -07:00
|
|
|
|
|
2015-06-06 19:51:04 -07:00
|
|
|
|
var page = this;
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-07-23 06:23:22 -07:00
|
|
|
|
loadPage(page, config);
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2015-06-06 19:51:04 -07:00
|
|
|
|
});
|
|
|
|
|
|
2016-02-12 00:08:55 -07:00
|
|
|
|
if (AppInfo.enableSupporterMembership) {
|
2016-02-13 00:19:49 -07:00
|
|
|
|
page.querySelector('.btnSupporterForConverting a').href = 'https://emby.media/premiere';
|
2016-02-12 00:08:55 -07:00
|
|
|
|
} else {
|
2016-02-13 00:19:49 -07:00
|
|
|
|
page.querySelector('.btnSupporterForConverting a').href = '#';
|
2016-02-12 00:08:55 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-06 19:51:04 -07:00
|
|
|
|
});
|
2014-01-12 09:55:38 -07:00
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|