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

add tuner device selection to listings

This commit is contained in:
Luke Pulverenti 2016-03-14 14:46:52 -04:00
parent 7e84d5786e
commit fdf99303a1
4 changed files with 92 additions and 3 deletions

View file

@ -1,4 +1,4 @@
define(['paper-checkbox', 'paper-input'], function () {
define(['paper-checkbox', 'paper-input', 'paper-item-body', 'paper-icon-item'], function () {
return function (page, providerId, options) {
@ -29,7 +29,16 @@
page.querySelector('.listingsSection').classList.add('hide');
}
page.querySelector('.chkAllTuners').checked = info.EnableAllTuners;
if (page.querySelector('.chkAllTuners').checked) {
page.querySelector('.selectTunersSection').classList.add('hide');
} else {
page.querySelector('.selectTunersSection').classList.remove('hide');
}
setCountry(info);
refreshTunerDevices(page, info, config.TunerHosts);
});
}
@ -91,6 +100,7 @@
var info = {
Type: 'SchedulesDirect',
Username: page.querySelector('.txtUser').value,
EnableAllTuners: true,
Password: CryptoJS.SHA1(page.querySelector('.txtPass').value).toString()
};
@ -147,6 +157,12 @@
info.ZipCode = page.querySelector('.txtZipCode').value;
info.Country = $('#selectCountry', page).val();
info.ListingsId = selectedListingsId;
info.EnableAllTuners = page.querySelector('.chkAllTuners').checked;
info.EnabledTuners = info.EnableAllTuners ? [] : $('.chkTuner', page).get().filter(function (i) {
return i.checked;
}).map(function (i) {
return i.getAttribute('data-id');
});
ApiClient.ajax({
type: "POST",
@ -216,6 +232,53 @@
});
}
function getTunerName(providerId) {
providerId = providerId.toLowerCase();
switch (providerId) {
case 'm3u':
return 'M3U Playlist';
case 'hdhomerun':
return 'HDHomerun';
case 'satip':
return 'DVB';
default:
return 'Unknown';
}
}
function refreshTunerDevices(page, providerInfo, devices) {
var html = '';
for (var i = 0, length = devices.length; i < length; i++) {
var device = devices[i];
html += '<paper-icon-item>';
var isChecked = providerInfo.EnableAllTuners || providerInfo.EnabledTuners.indexOf(device.Id) != -1;
var checkedAttribute = isChecked ? ' checked' : '';
html += '<paper-checkbox data-id="' + device.Id + '" class="chkTuner" item-icon ' + checkedAttribute + '></paper-checkbox>';
html += '<paper-item-body two-line>';
html += '<div>';
html += device.FriendlyName || getTunerName(device.Type);
html += '</div>';
html += '<div secondary>';
html += device.Url;
html += '</div>';
html += '</paper-item-body>';
html += '</paper-icon-item>';
}
page.querySelector('.tunerList').innerHTML = html;
}
self.submit = function () {
page.querySelector('.btnSubmitListingsContainer').click();
};
@ -250,6 +313,14 @@
refreshListings(this.value);
});
page.querySelector('.chkAllTuners').addEventListener('change', function (e) {
if (e.target.checked) {
page.querySelector('.selectTunersSection').classList.add('hide');
} else {
page.querySelector('.selectTunersSection').classList.remove('hide');
}
});
$('.createAccountHelp', page).html(Globalize.translate('MessageCreateAccountAt', '<a href="http://www.schedulesdirect.org" target="_blank">http://www.schedulesdirect.org</a>'));
reload();

View file

@ -10,6 +10,8 @@
</div>
<form class="formLogin">
<!-- Terrible, but this hidden field prevents the yellow background in chrome -->
<div style="height:0; overflow: hidden;"><input type="text" name="fakeusernameremembered" tabindex="-1" /><input type="password" name="fakepasswordremembered" tabindex="-1" /></div>
<div>
<div>
<paper-input class="txtUser" label="${LabelUsername}" required="required" autocomplete="off"></paper-input>
@ -52,6 +54,17 @@
<label for="selectListing" class="selectLabel">${LabelLineup}</label>
<select id="selectListing" data-mini="true" required="required"></select>
</div>
<div>
<br /><br />
<paper-checkbox class="chkAllTuners">${OptionEnableForAllTuners}</paper-checkbox>
<div class="selectTunersSection hide">
<br /><br />
<div class="paperCheckboxListLabel">${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>

View file

@ -2427,5 +2427,8 @@
"ValueExample": "1:00 PM",
"ButtonGotIt": "Got It",
"OptionEnableAnonymousUsageReporting": "Enable anonymous usage reporting",
"OptionEnableAnonymousUsageReportingHelp": "Allow Emby to collect anonymous data such as installed plugins, the version numbers of your Emby apps, etc. This information is only used for the purpose of improving the software."
"OptionEnableAnonymousUsageReportingHelp": "Allow Emby to collect anonymous data such as installed plugins, the version numbers of your Emby apps, etc. This information is only used for the purpose of improving the software.",
"LabelFileOrUrl": "File or url:",
"OptionEnableForAllTuners": "Enable for all tuners",
"HeaderTuners": "Tuners"
}

View file

@ -2428,5 +2428,7 @@
"ButtonGotIt": "Got It",
"OptionEnableAnonymousUsageReporting": "Enable anonymous usage reporting",
"OptionEnableAnonymousUsageReportingHelp": "Allow Emby to collect anonymous data such as installed plugins, the version numbers of your Emby apps, etc. This information is only used for the purpose of improving the software.",
"LabelFileOrUrl": "File or url:"
"LabelFileOrUrl": "File or url:",
"OptionEnableForAllTuners": "Enable for all tuner devices",
"HeaderTuners": "Tuners"
}