';
html += getProviderName(provider.Type);
@@ -390,9 +390,9 @@
switch (providerId) {
case 'schedulesdirect':
- return 'livetvguideprovider-scd.html';
+ return 'livetvguideprovider.html?type=schedulesdirect';
case 'emby':
- return 'livetvguideprovider.html';
+ return 'livetvguideprovider.html?type=emby';
default:
break;
}
diff --git a/dashboard-ui/scripts/wizardlivetvguide.js b/dashboard-ui/scripts/wizardlivetvguide.js
new file mode 100644
index 0000000000..7b7dfe0dfd
--- /dev/null
+++ b/dashboard-ui/scripts/wizardlivetvguide.js
@@ -0,0 +1,77 @@
+(function ($, document) {
+
+ var guideController;
+
+ function init(page, type, providerId) {
+
+ var url = 'tvproviders/' + type + '.js';
+
+ require([url], function (factory) {
+
+ var instance = new factory(page, providerId, {
+ showCancelButton: false,
+ showSubmitButton: false
+ });
+
+ instance.init();
+ guideController = instance;
+ });
+ }
+
+ function loadTemplate(page, type, providerId) {
+
+ guideController = null;
+
+ ApiClient.ajax({
+
+ type: 'GET',
+ url: 'tvproviders/' + type + '.template.html'
+
+ }).done(function (html) {
+
+ var elem = page.querySelector('.providerTemplate');
+ elem.innerHTML = Globalize.translateDocument(html);
+ $(elem).trigger('create');
+
+ init(page, type, providerId);
+ });
+ }
+
+ function skip() {
+ var apiClient = ApiClient;
+
+ apiClient.getJSON(apiClient.getUrl('Startup/Info')).done(function (info) {
+
+ if (info.SupportsRunningAsService) {
+ Dashboard.navigate('wizardservice.html');
+
+ } else {
+ Dashboard.navigate('wizardagreement.html');
+ }
+ });
+ }
+
+ function next() {
+ guideController.submit();
+ }
+
+ $(document).on('pageinitdepends', "#wizardGuidePage", function () {
+
+ var page = this;
+
+ $('#selectType', page).on('change', function () {
+
+ loadTemplate(page, this.value);
+ });
+
+ $('.btnSkip', page).on('click', skip);
+ $('.btnNext', page).on('click', next);
+
+ }).on('pageshowready', "#wizardGuidePage", function () {
+
+ var page = this;
+
+ $('#selectType', page).trigger('change');
+ });
+
+})(jQuery, document, window);
diff --git a/dashboard-ui/scripts/wizardlivetvtuner.js b/dashboard-ui/scripts/wizardlivetvtuner.js
index e6e4b78f99..bc2dadd156 100644
--- a/dashboard-ui/scripts/wizardlivetvtuner.js
+++ b/dashboard-ui/scripts/wizardlivetvtuner.js
@@ -21,7 +21,7 @@
}).done(function () {
Dashboard.hideLoadingMsg();
- navigateToNextPage();
+ navigateToNextPage(config);
});
});
@@ -42,8 +42,13 @@
});
}
- function navigateToNextPage() {
- skip();
+ function navigateToNextPage(config) {
+
+ if (config.LiveTvTunerPath && config.LiveTvTunerType) {
+ Dashboard.navigate('wizardlivetvguide.html');
+ } else {
+ skip();
+ }
}
function skip() {
diff --git a/dashboard-ui/strings/html/server.json b/dashboard-ui/strings/html/server.json
index e13852bc42..957ed93dac 100644
--- a/dashboard-ui/strings/html/server.json
+++ b/dashboard-ui/strings/html/server.json
@@ -1527,6 +1527,8 @@
"HeaderUpcomingForKids": "Upcoming for Kids",
"HeaderSetupLiveTV": "Setup Live TV",
"LabelTunerType": "Tuner type:",
- "HelpMoreTunersCanBeAdded": "More tuners can be added later within the Live TV section.",
- "MessageActiveSupporterMembershipRequiredSeriesRecordings": "An active Emby Supporter membership is required in order to create automated series recordings."
+ "HelpMoreTunersCanBeAdded": "Additional tuners can be added later within the Live TV section.",
+ "MessageActiveSupporterMembershipRequiredSeriesRecordings": "An active Emby Supporter membership is required in order to create automated series recordings.",
+ "HeaderSetupTVGuide": "Setup TV Guide",
+ "LabelDataProvider": "Data provider:"
}
diff --git a/dashboard-ui/thirdparty/paper-button-style.css b/dashboard-ui/thirdparty/paper-button-style.css
index 7f2d07f9ad..e09c3fc29a 100644
--- a/dashboard-ui/thirdparty/paper-button-style.css
+++ b/dashboard-ui/thirdparty/paper-button-style.css
@@ -173,6 +173,13 @@ paper-button.mini {
}
+
+ paper-button.mini iron-icon {
+ height: 20px;
+ width: 20px;
+ }
+
+
paper-toast {
z-index: 9999999;
}
diff --git a/dashboard-ui/tvproviders/schedulesdirect.js b/dashboard-ui/tvproviders/schedulesdirect.js
new file mode 100644
index 0000000000..a7d9214c5b
--- /dev/null
+++ b/dashboard-ui/tvproviders/schedulesdirect.js
@@ -0,0 +1,244 @@
+define([], function () {
+
+ return function (page, providerId, options) {
+
+ var self = this;
+
+ var listingsId;
+
+ function reload() {
+
+ Dashboard.showLoadingMsg();
+
+ ApiClient.getNamedConfiguration("livetv").done(function (config) {
+
+ var info = config.ListingProviders.filter(function (i) {
+ return i.Id == providerId;
+ })[0] || {};
+
+ listingsId = info.ListingsId;
+ $('#selectListing', page).val(info.ListingsId || '').selectmenu('refresh');
+ page.querySelector('.txtUser').value = info.Username || '';
+ page.querySelector('.txtPass').value = info.Username || '';
+
+ page.querySelector('.txtZipCode').value = info.ZipCode || '';
+
+ setCountry(info);
+ });
+ }
+
+ function setCountry(info) {
+
+ ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).done(function (result) {
+
+ var countryList = [];
+ var i, length;
+
+ for (var region in result) {
+ var countries = result[region];
+
+ if (countries.length && region !== 'ZZZ') {
+ for (i = 0, length = countries.length; i < length; i++) {
+ countryList.push({
+ name: countries[i].fullName,
+ value: countries[i].shortName
+ });
+ }
+ }
+ }
+
+ countryList.sort(function (a, b) {
+ if (a.name > b.name) {
+ return 1;
+ }
+ if (a.name < b.name) {
+ return -1;
+ }
+ // a must be equal to b
+ return 0;
+ });
+
+ $('#selectCountry', page).html(countryList.map(function (c) {
+
+ return '
';
+
+ }).join('')).val(info.Country || '').selectmenu('refresh');
+
+ $(page.querySelector('.txtZipCode')).trigger('change');
+
+ }).fail(function () {
+
+ Dashboard.alert({
+ message: Globalize.translate('ErrorGettingTvLineups')
+ });
+ });
+
+ Dashboard.hideLoadingMsg();
+ }
+
+ function submitLoginForm() {
+
+ Dashboard.showLoadingMsg();
+
+ var info = {
+ Type: 'SchedulesDirect',
+ Username: page.querySelector('.txtUser').value,
+ Password: CryptoJS.SHA1(page.querySelector('.txtPass').value).toString()
+ };
+
+ var id = providerId;
+
+ if (id) {
+ info.Id = id;
+ }
+
+ ApiClient.ajax({
+ type: "POST",
+ url: ApiClient.getUrl('LiveTv/ListingProviders', {
+ ValidateLogin: true
+ }),
+ data: JSON.stringify(info),
+ contentType: "application/json"
+
+ }).done(function (result) {
+
+ Dashboard.processServerConfigurationUpdateResult();
+ providerId = result.Id;
+ reload();
+
+ }).fail(function () {
+ Dashboard.alert({
+ message: Globalize.translate('ErrorSavingTvProvider')
+ });
+ });
+
+ }
+
+ function submitListingsForm() {
+
+ var selectedListingsId = $('#selectListing', page).val();
+
+ if (!selectedListingsId) {
+ Dashboard.alert({
+ message: Globalize.translate('ErrorPleaseSelectLineup')
+ });
+ return;
+ }
+
+ Dashboard.showLoadingMsg();
+
+ var id = providerId;
+
+ ApiClient.getNamedConfiguration("livetv").done(function (config) {
+
+ var info = config.ListingProviders.filter(function (i) {
+ return i.Id == id;
+ })[0];
+
+ info.ZipCode = page.querySelector('.txtZipCode').value;
+ info.Country = $('#selectCountry', page).val();
+ info.ListingsId = selectedListingsId;
+
+ ApiClient.ajax({
+ type: "POST",
+ url: ApiClient.getUrl('LiveTv/ListingProviders', {
+ ValidateListings: true
+ }),
+ data: JSON.stringify(info),
+ contentType: "application/json"
+
+ }).done(function (result) {
+
+ Dashboard.processServerConfigurationUpdateResult();
+
+ }).fail(function () {
+ Dashboard.alert({
+ message: Globalize.translate('ErrorSavingTvProvider')
+ });
+ });
+
+ });
+ }
+
+ function refreshListings(value) {
+
+ if (!value) {
+ $('#selectListing', page).html('').selectmenu('refresh');
+ return;
+ }
+
+ Dashboard.showModalLoadingMsg();
+
+ ApiClient.ajax({
+ type: "GET",
+ url: ApiClient.getUrl('LiveTv/ListingProviders/Lineups', {
+ Id: providerId,
+ Location: value,
+ Country: $('#selectCountry', page).val()
+ }),
+ dataType: 'json'
+
+ }).done(function (result) {
+
+ $('#selectListing', page).html(result.map(function (o) {
+
+ return '
';
+
+ })).selectmenu('refresh');
+
+ if (listingsId) {
+ $('#selectListing', page).val(listingsId).selectmenu('refresh');
+ }
+
+ Dashboard.hideModalLoadingMsg();
+
+ }).fail(function (result) {
+
+ Dashboard.alert({
+ message: Globalize.translate('ErrorGettingTvLineups')
+ });
+ refreshListings('');
+ Dashboard.hideModalLoadingMsg();
+ });
+ }
+
+ self.submit = function () {
+ page.querySelector('.btnSubmitListingsContainer').click();
+ };
+
+ self.init = function () {
+
+ options = options || {};
+
+ if (options.showCancelButton !== false) {
+ page.querySelector('.btnCancel').classList.remove('hide');
+ } else {
+ page.querySelector('.btnCancel').classList.add('hide');
+ }
+
+ if (options.showSubmitButton !== false) {
+ page.querySelector('.btnSubmitListings').classList.remove('hide');
+ } else {
+ page.querySelector('.btnSubmitListings').classList.add('hide');
+ }
+
+ $('.formLogin', page).on('submit', function () {
+ submitLoginForm();
+ return false;
+ });
+
+ $('.formListings', page).on('submit', function () {
+ submitListingsForm();
+ return false;
+ });
+
+ $('.txtZipCode', page).on('change', function () {
+ refreshListings(this.value);
+ });
+
+ $('.createAccountHelp', page).html(Globalize.translate('MessageCreateAccountAt', '
http://www.schedulesdirect.org'));
+
+ reload();
+ };
+ }
+});
\ No newline at end of file
diff --git a/dashboard-ui/tvproviders/schedulesdirect.template.html b/dashboard-ui/tvproviders/schedulesdirect.template.html
new file mode 100644
index 0000000000..2177f4f6a4
--- /dev/null
+++ b/dashboard-ui/tvproviders/schedulesdirect.template.html
@@ -0,0 +1,61 @@
+
Schedules Direct
+
+
+
+ 1
+
+
+ ${GuideProviderLogin}
+
+
+
+
+
+
+
+
+
+ 2
+
+
+ ${GuideProviderSelectListings}
+
+
+
\ No newline at end of file
diff --git a/dashboard-ui/wizardlivetvguide.html b/dashboard-ui/wizardlivetvguide.html
new file mode 100644
index 0000000000..88b80e3baf
--- /dev/null
+++ b/dashboard-ui/wizardlivetvguide.html
@@ -0,0 +1,43 @@
+
+
+
+
Emby
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dashboard-ui/wizardlivetvtuner.html b/dashboard-ui/wizardlivetvtuner.html
index e9d99760a6..6aacefb172 100644
--- a/dashboard-ui/wizardlivetvtuner.html
+++ b/dashboard-ui/wizardlivetvtuner.html
@@ -35,7 +35,7 @@
-
+