mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update channels
This commit is contained in:
parent
949a67054f
commit
c0918e89de
2 changed files with 5 additions and 118 deletions
|
@ -29,36 +29,6 @@
|
||||||
<div class="fieldDescription">${LabelChannelStreamQualityHelp}</div>
|
<div class="fieldDescription">${LabelChannelStreamQualityHelp}</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="channelDownloading" style="display: none;">
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label>${LabelEnableChannelContentDownloadingFor}</label>
|
|
||||||
</div>
|
|
||||||
<div class="channelDownloadingList"></div>
|
|
||||||
<div class="fieldDescription">${LabelEnableChannelContentDownloadingForHelp}</div>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<ul data-role="listview" class="ulForm">
|
|
||||||
<li>
|
|
||||||
<label for="txtCachePath">${LabelChannelDownloadPath}</label>
|
|
||||||
<div style="display: inline-block; width: 85%;">
|
|
||||||
<input type="text" id="txtCachePath" name="txtCachePath" />
|
|
||||||
</div>
|
|
||||||
<button id="btnSelectCachePath" type="button" data-icon="search" data-iconpos="notext" data-inline="true">${ButtonSelectDirectory}</button>
|
|
||||||
<div class="fieldDescription">${LabelChannelDownloadPathHelp}</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="txtDownloadSizeLimit">${LabelChannelDownloadSizeLimit}</label>
|
|
||||||
<input type="number" id="txtDownloadSizeLimit" pattern="[0-9]*" min="0.1" step=".1" />
|
|
||||||
<div class="fieldDescription">${LabelChannelDownloadSizeLimitHelpText}</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="txtDownloadAge">${LabelChannelDownloadAge}</label>
|
|
||||||
<input type="number" id="txtDownloadAge" pattern="[0-9]*" min="1" />
|
|
||||||
<div class="fieldDescription">${LabelChannelDownloadAgeHelp}</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<ul data-role="listview" class="ulForm">
|
<ul data-role="listview" class="ulForm">
|
||||||
<li>
|
<li>
|
||||||
<button type="submit" data-role="none" class="clearButton">
|
<button type="submit" data-role="none" class="clearButton">
|
||||||
|
|
|
@ -1,55 +1,8 @@
|
||||||
(function ($, document, window) {
|
(function ($, document, window) {
|
||||||
|
|
||||||
function populateDownloadList(page, config, downloadableList) {
|
function loadPage(page, config) {
|
||||||
|
|
||||||
if (downloadableList.length) {
|
$('#selectChannelResolution', page).val(config.PreferredStreamingWidth || '').selectmenu("refresh");
|
||||||
$('.channelDownloading', page).show();
|
|
||||||
} else {
|
|
||||||
$('.channelDownloading', page).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
html += '<div data-role="controlgroup">';
|
|
||||||
|
|
||||||
for (var i = 0, length = downloadableList.length; i < length; i++) {
|
|
||||||
|
|
||||||
var channel = downloadableList[i];
|
|
||||||
|
|
||||||
var id = 'chkChannelDownload' + i;
|
|
||||||
|
|
||||||
var isChecked = config.DownloadingChannels.indexOf(channel.Id) != -1 ? ' checked="checked"' : '';
|
|
||||||
|
|
||||||
html += '<input class="chkChannelDownload" type="checkbox" name="' + id + '" id="' + id + '" data-channelid="' + channel.Id + '"' + isChecked + '>';
|
|
||||||
html += '<label for="' + id + '">' + channel.Name + '</label>';
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
$('.channelDownloadingList', page).html(html).trigger('create');
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadPage(page, config, allChannelFeatures) {
|
|
||||||
|
|
||||||
if (allChannelFeatures.length) {
|
|
||||||
$('.noChannelsHeader', page).hide();
|
|
||||||
} else {
|
|
||||||
$('.noChannelsHeader', page).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
var downloadableList = allChannelFeatures.filter(function (i) {
|
|
||||||
return i.SupportsContentDownloading;
|
|
||||||
});
|
|
||||||
|
|
||||||
populateDownloadList(page, config, downloadableList);
|
|
||||||
|
|
||||||
$('#selectChannelResolution', page).val(config.PreferredStreamingWidth || '')
|
|
||||||
.selectmenu("refresh");
|
|
||||||
|
|
||||||
$('#txtDownloadAge', page).val(config.MaxDownloadAge || '');
|
|
||||||
$('#txtDownloadSizeLimit', page).val(config.DownloadSizeLimit || '');
|
|
||||||
|
|
||||||
$('#txtCachePath', page).val(config.DownloadPath || '');
|
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
@ -64,16 +17,6 @@
|
||||||
|
|
||||||
// This should be null if empty
|
// This should be null if empty
|
||||||
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
|
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
|
||||||
config.MaxDownloadAge = $('#txtDownloadAge', form).val() || null;
|
|
||||||
config.DownloadSizeLimit = $('#txtDownloadSizeLimit', form).val() || null;
|
|
||||||
|
|
||||||
config.DownloadPath = $('#txtCachePath', form).val() || null;
|
|
||||||
|
|
||||||
config.DownloadingChannels = $('.chkChannelDownload:checked', form)
|
|
||||||
.get()
|
|
||||||
.map(function (i) {
|
|
||||||
return i.getAttribute('data-channelid');
|
|
||||||
});
|
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
@ -86,27 +29,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
|
$('.channelSettingsForm', page).off('submit', onSubmit).on('submit', onSubmit);
|
||||||
|
|
||||||
var picker = new DirectoryBrowser(page);
|
|
||||||
|
|
||||||
picker.show({
|
|
||||||
|
|
||||||
callback: function (path) {
|
|
||||||
|
|
||||||
if (path) {
|
|
||||||
$('#txtCachePath', page).val(path);
|
|
||||||
}
|
|
||||||
picker.close();
|
|
||||||
},
|
|
||||||
|
|
||||||
header: Globalize.translate('HeaderSelectChannelDownloadPath'),
|
|
||||||
|
|
||||||
instruction: Globalize.translate('HeaderSelectChannelDownloadPathHelp')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.channelSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
||||||
|
|
||||||
}).on('pageshowready', "#channelSettingsPage", function () {
|
}).on('pageshowready', "#channelSettingsPage", function () {
|
||||||
|
|
||||||
|
@ -114,15 +37,9 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
var promise1 = ApiClient.getNamedConfiguration("channels");
|
ApiClient.getNamedConfiguration("channels").done(function (config) {
|
||||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Channels/Features"));
|
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
loadPage(page, config);
|
||||||
|
|
||||||
var config = response1[0];
|
|
||||||
var allFeatures = response2[0];
|
|
||||||
|
|
||||||
loadPage(page, config, allFeatures);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue