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

84 lines
2.5 KiB
JavaScript
Raw Normal View History

2014-01-12 11:55:38 -05:00
(function ($, document, window) {
2015-07-23 09:23:22 -04:00
function loadPage(page, config) {
2014-01-12 11:55:38 -05:00
2015-07-23 09:23:22 -04:00
$('.liveTvSettingsForm', page).show();
$('.noLiveTvServices', page).hide();
2014-01-12 11:55:38 -05:00
2015-09-03 13:01:51 -04:00
$('#selectGuideDays', page).val(config.GuideDays || '');
2014-01-16 17:49:31 -05:00
2015-08-19 02:12:58 -04:00
$('#chkMovies', page).checked(config.EnableMovieProviders);
2015-08-22 15:46:55 -04:00
$('#chkOrganize', page).checked(config.EnableAutoOrganize);
2014-01-16 17:49:31 -05:00
2015-07-23 10:58:27 -04:00
$('#txtRecordingPath', page).val(config.RecordingPath || '');
2015-08-23 22:08:20 -04:00
$('#txtPrePaddingMinutes', page).val(config.PrePaddingSeconds / 60);
$('#txtPostPaddingMinutes', page).val(config.PostPaddingSeconds / 60);
2014-01-12 11:55:38 -05:00
Dashboard.hideLoadingMsg();
}
2015-06-06 22:51:04 -04:00
function onSubmit() {
2014-01-12 11:55:38 -05:00
2015-06-06 22:51:04 -04:00
Dashboard.showLoadingMsg();
2014-01-12 11:55:38 -05:00
2015-06-06 22:51:04 -04:00
var form = this;
2014-01-12 11:55:38 -05:00
2015-12-14 10:43:03 -05:00
ApiClient.getNamedConfiguration("livetv").then(function (config) {
2014-01-12 11:55:38 -05:00
2015-06-06 22:51:04 -04:00
config.GuideDays = $('#selectGuideDays', form).val() || null;
config.EnableMovieProviders = $('#chkMovies', form).checked();
2015-08-22 15:46:55 -04:00
config.EnableAutoOrganize = $('#chkOrganize', form).checked();
2015-07-23 10:58:27 -04:00
config.RecordingPath = $('#txtRecordingPath', form).val() || null;
2014-01-12 11:55:38 -05:00
2015-08-23 22:08:20 -04:00
config.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
config.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
2015-12-14 10:43:03 -05:00
ApiClient.updateNamedConfiguration("livetv", config).then(Dashboard.processServerConfigurationUpdateResult);
2015-06-06 22:51:04 -04:00
});
2014-01-12 11:55:38 -05:00
2015-06-06 22:51:04 -04:00
// Disable default form submission
return false;
}
2014-01-12 11:55:38 -05:00
2015-09-01 10:01:59 -04:00
$(document).on('pageinit', "#liveTvSettingsPage", function () {
2014-01-12 11:55:38 -05:00
2015-07-23 10:58:27 -04:00
var page = this;
2015-06-06 22:51:04 -04:00
$('.liveTvSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
2014-01-12 11:55:38 -05:00
2015-07-23 10:58:27 -04:00
$('#btnSelectRecordingPath', page).on("click.selectDirectory", function () {
2015-10-13 15:22:45 -04:00
require(['directorybrowser'], function (directoryBrowser) {
2015-07-23 10:58:27 -04:00
2015-10-13 15:22:45 -04:00
var picker = new directoryBrowser();
2015-07-23 10:58:27 -04:00
2015-10-13 15:22:45 -04:00
picker.show({
2015-07-23 10:58:27 -04:00
2015-10-13 15:22:45 -04:00
callback: function (path) {
if (path) {
$('#txtRecordingPath', page).val(path);
}
picker.close();
2015-07-23 10:58:27 -04:00
}
2015-10-13 15:22:45 -04:00
});
2015-07-23 10:58:27 -04:00
});
});
2015-09-24 13:08:10 -04:00
}).on('pageshow', "#liveTvSettingsPage", function () {
2014-01-16 17:49:31 -05:00
2015-06-06 22:51:04 -04:00
Dashboard.showLoadingMsg();
2014-01-16 17:49:31 -05:00
2015-06-06 22:51:04 -04:00
var page = this;
2014-01-12 11:55:38 -05:00
2015-12-14 10:43:03 -05:00
ApiClient.getNamedConfiguration("livetv").then(function (config) {
2014-01-12 11:55:38 -05:00
2015-07-23 09:23:22 -04:00
loadPage(page, config);
2014-01-12 11:55:38 -05:00
2015-06-06 22:51:04 -04:00
});
});
2014-01-12 11:55:38 -05:00
})(jQuery, document, window);