add tv genre configuration options
This commit is contained in:
parent
81ab24a44c
commit
f13258a120
24 changed files with 261 additions and 143 deletions
|
@ -1,34 +1,53 @@
|
|||
define(['jQuery', 'paper-checkbox', 'paper-button', 'paper-input', 'paper-item-body', 'paper-icon-item'], function ($) {
|
||||
define(['jQuery', 'paper-checkbox', 'paper-button', 'emby-input', 'paper-item-body', 'paper-icon-item'], function ($) {
|
||||
|
||||
return function (page, providerId, options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
function getListingProvider(config, id) {
|
||||
|
||||
if (config && id) {
|
||||
return config.ListingProviders.filter(function (i) {
|
||||
return i.Id == id;
|
||||
})[0] || getListingProvider();
|
||||
}
|
||||
|
||||
return ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/Default'));
|
||||
}
|
||||
|
||||
function reload() {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
|
||||
var info = config.ListingProviders.filter(function (i) {
|
||||
return i.Id == providerId;
|
||||
})[0] || {};
|
||||
getListingProvider(config, providerId).then(function (info) {
|
||||
page.querySelector('.txtPath').value = info.Path || '';
|
||||
page.querySelector('.txtKids').value = (info.KidsGenres || []).join('|');
|
||||
page.querySelector('.txtNews').value = (info.NewsGenres || []).join('|');
|
||||
page.querySelector('.txtSports').value = (info.SportsGenres || []).join('|');
|
||||
|
||||
page.querySelector('.txtPath').value = info.Path || '';
|
||||
page.querySelector('.chkAllTuners').checked = info.EnableAllTuners;
|
||||
|
||||
page.querySelector('.chkAllTuners').checked = info.EnableAllTuners;
|
||||
if (page.querySelector('.chkAllTuners').checked) {
|
||||
page.querySelector('.selectTunersSection').classList.add('hide');
|
||||
} else {
|
||||
page.querySelector('.selectTunersSection').classList.remove('hide');
|
||||
}
|
||||
|
||||
if (page.querySelector('.chkAllTuners').checked) {
|
||||
page.querySelector('.selectTunersSection').classList.add('hide');
|
||||
} else {
|
||||
page.querySelector('.selectTunersSection').classList.remove('hide');
|
||||
}
|
||||
|
||||
refreshTunerDevices(page, info, config.TunerHosts);
|
||||
Dashboard.hideLoadingMsg();
|
||||
refreshTunerDevices(page, info, config.TunerHosts);
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getGenres(txtInput) {
|
||||
|
||||
var value = txtInput.value;
|
||||
|
||||
return value ? value.split('|') : [];
|
||||
}
|
||||
|
||||
function submitListingsForm() {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
@ -42,7 +61,13 @@
|
|||
})[0] || {};
|
||||
|
||||
info.Type = 'xmltv';
|
||||
|
||||
info.Path = page.querySelector('.txtPath').value;
|
||||
|
||||
info.KidsGenres = getGenres(page.querySelector('.txtKids'));
|
||||
info.NewsGenres = getGenres(page.querySelector('.txtNews'));
|
||||
info.SportsGenres = getGenres(page.querySelector('.txtSports'));
|
||||
|
||||
info.EnableAllTuners = page.querySelector('.chkAllTuners').checked;
|
||||
info.EnabledTuners = info.EnableAllTuners ? [] : $('.chkTuner', page).get().filter(function (i) {
|
||||
return i.checked;
|
||||
|
|
|
@ -2,25 +2,39 @@
|
|||
|
||||
<form>
|
||||
<div>
|
||||
<div>
|
||||
<paper-input class="txtPath" label="${LabelPath}" required="required" autocomplete="off"></paper-input>
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" class="txtPath" label="${LabelPath}" required="required" autocomplete="off" />
|
||||
</div>
|
||||
<div>
|
||||
<br />
|
||||
<paper-checkbox class="chkAllTuners">${OptionEnableForAllTuners}</paper-checkbox>
|
||||
<div class="selectTunersSection hide">
|
||||
<br /><br />
|
||||
<div class="paperListLabel">${HeaderTuners}</div>
|
||||
<div class="paperCheckboxList paperList tunerList">
|
||||
</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" class="txtKids" label="${LabelKidsGenres}" autocomplete="off" />
|
||||
<div class="fieldDescription">${XmlTvKidsGenresHelp}</div>
|
||||
</div>
|
||||
<br /><br />
|
||||
<div>
|
||||
<button type="submit" data-role="none" class="clearButton btnSubmitListingsContainer">
|
||||
<paper-button raised class="submit block btnSubmitListings hide"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||
</button>
|
||||
<paper-button raised class="cancel block btnCancel hide" onclick="history.back();"><iron-icon icon="close"></iron-icon><span>${ButtonCancel}</span></paper-button>
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" class="txtNews" label="${LabelNewsGenres}" autocomplete="off" />
|
||||
<div class="fieldDescription"></div>
|
||||
<div class="fieldDescription">${XmlTvNewsGenresHelp}</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" class="txtSports" label="${LabelSportsGenres}" autocomplete="off" />
|
||||
<div class="fieldDescription">${XmlTvSportsGenresHelp}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<br />
|
||||
<paper-checkbox class="chkAllTuners">${OptionEnableForAllTuners}</paper-checkbox>
|
||||
<div class="selectTunersSection hide">
|
||||
<br /><br />
|
||||
<div class="paperListLabel">${HeaderTuners}</div>
|
||||
<div class="paperCheckboxList paperList tunerList">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br /><br />
|
||||
<div>
|
||||
<button type="submit" data-role="none" class="clearButton btnSubmitListingsContainer">
|
||||
<paper-button raised class="submit block btnSubmitListings hide"><iron-icon icon="check"></iron-icon><span>${ButtonSave}</span></paper-button>
|
||||
</button>
|
||||
<paper-button raised class="cancel block btnCancel hide" onclick="history.back();"><iron-icon icon="close"></iron-icon><span>${ButtonCancel}</span></paper-button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue