diff --git a/dashboard-ui/livetvstatus.html b/dashboard-ui/livetvstatus.html index 4907343784..d3d4e82c99 100644 --- a/dashboard-ui/livetvstatus.html +++ b/dashboard-ui/livetvstatus.html @@ -58,40 +58,6 @@
- - - - -

${HeaderAddDevice}

- -
-
-
- - -
${MessageTunerDeviceNotListed}
- -
-
-
- - -
-
-
- ${ButtonCancel} - -
-
-
diff --git a/dashboard-ui/livetvtunerprovider-hdhomerun.html b/dashboard-ui/livetvtunerprovider-hdhomerun.html new file mode 100644 index 0000000000..6e90d2986a --- /dev/null +++ b/dashboard-ui/livetvtunerprovider-hdhomerun.html @@ -0,0 +1,49 @@ + + + + ${TitleLiveTV} + + +
+ +
+
+ + + +
+ +

HD Homerun Setup

+ +
+
+
+
+ + +
+
+
+ + +
${ImportFavoriteChannelsHelp}
+
+
+
+ + ${ButtonCancel} +
+
+
+
+
+
+
+ + diff --git a/dashboard-ui/livetvtunerprovider-m3u.html b/dashboard-ui/livetvtunerprovider-m3u.html new file mode 100644 index 0000000000..caa023d621 --- /dev/null +++ b/dashboard-ui/livetvtunerprovider-m3u.html @@ -0,0 +1,43 @@ + + + + ${TitleLiveTV} + + +
+ +
+
+ + + +
+ +

M3U Setup

+ +
+
+
+
+ + +
+
+
+ + ${ButtonCancel} +
+
+
+
+
+
+
+ + diff --git a/dashboard-ui/scripts/livetvstatus.js b/dashboard-ui/scripts/livetvstatus.js index 97d1b480aa..e1b0f2fabd 100644 --- a/dashboard-ui/scripts/livetvstatus.js +++ b/dashboard-ui/scripts/livetvstatus.js @@ -143,11 +143,9 @@ if (liveTvInfo.IsEnabled) { $('.liveTvStatusContent', page).show(); - $('.noLiveTvServices', page).hide(); } else { $('.liveTvStatusContent', page).hide(); - $('.noLiveTvServices', page).show(); } var servicesToDisplay = liveTvInfo.Services.filter(function (s) { @@ -192,18 +190,14 @@ for (var i = 0, length = devices.length; i < length; i++) { var device = devices[i]; + + var href = 'livetvtunerprovider-' + device.Type + '.html?id=' + device.Id; + html += '
  • '; - html += ''; + html += ''; html += '

    '; - if (device.Type == 'm3u') { - html += "M3U"; - } - else if (device.Type == 'hdhomerun') { - html += "HD Homerun"; - } else { - html += device.Type; - } + html += device.Type; html += '

    '; html += '

    '; @@ -396,13 +390,40 @@ }); } + function addDevice(button) { + + var menuItems = []; + + menuItems.push({ + name: 'HD Homerun', + id: 'hdhomerun' + }); + + menuItems.push({ + name: 'M3U', + id: 'm3u' + }); + + require(['actionsheet'], function () { + + ActionSheetElement.show({ + items: menuItems, + positionTo: button, + callback: function (id) { + + Dashboard.navigate('livetvtunerprovider-' + id + '.html'); + } + }); + + }); + } + $(document).on('pageinitdepends', "#liveTvStatusPage", function () { var page = this; $('.btnAddDevice', page).on('click', function () { - $('#txtDevicePath', page).val(''); - page.querySelector('.dlgAddDevice').open(); + addDevice(this); }); $('.formAddDevice', page).on('submit', function () { diff --git a/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js b/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js new file mode 100644 index 0000000000..4614094883 --- /dev/null +++ b/dashboard-ui/scripts/livetvtunerprovider-hdhomerun.js @@ -0,0 +1,73 @@ +(function ($, document, window) { + + function reload(page, providerId) { + + $('#txtDevicePath', page).val(''); + $('#chkFavorite', page).checked(false).checkboxradio('refresh'); + + if (providerId) { + ApiClient.getNamedConfiguration("livetv").done(function (config) { + + var info = config.TunerHosts.filter(function (i) { + return i.Id == providerId; + })[0]; + + $('#txtDevicePath', page).val(info.Url || ''); + $('#chkFavorite', page).checked(info.ImportFavoritesOnly).checkboxradio('refresh'); + + }); + } + } + + function submitForm(page) { + + Dashboard.showLoadingMsg(); + + var info = { + Type: 'hdhomerun', + Url: $('#txtDevicePath', page).val(), + ImportFavoritesOnly: $('#chkFavorite', page).checked() + }; + + var id = getParameterByName('id'); + + if (id) { + info.Id = id; + } + + ApiClient.ajax({ + type: "POST", + url: ApiClient.getUrl('LiveTv/TunerHosts'), + data: JSON.stringify(info), + contentType: "application/json" + + }).done(function (result) { + + Dashboard.processServerConfigurationUpdateResult(); + Dashboard.navigate('livetvstatus.html'); + + }).fail(function () { + Dashboard.alert({ + message: Globalize.translate('ErrorSavingTvProvider') + }); + }); + + } + + $(document).on('pageinitdepends', "#liveTvTunerProviderHdHomerunPage", function () { + + var page = this; + + $('form', page).on('submit', function () { + submitForm(page); + return false; + }); + + }).on('pageshowready', "#liveTvTunerProviderHdHomerunPage", function () { + + var providerId = getParameterByName('id'); + var page = this; + reload(page, providerId); + }); + +})(jQuery, document, window); diff --git a/dashboard-ui/scripts/livetvtunerprovider-m3u.js b/dashboard-ui/scripts/livetvtunerprovider-m3u.js new file mode 100644 index 0000000000..390634bb45 --- /dev/null +++ b/dashboard-ui/scripts/livetvtunerprovider-m3u.js @@ -0,0 +1,70 @@ +(function ($, document, window) { + + function reload(page, providerId) { + + $('#txtDevicePath', page).val(''); + + if (providerId) { + ApiClient.getNamedConfiguration("livetv").done(function (config) { + + var info = config.TunerHosts.filter(function (i) { + return i.Id == providerId; + })[0]; + + $('#txtDevicePath', page).val(info.Url || ''); + }); + } + } + + function submitForm(page) { + + Dashboard.showLoadingMsg(); + + var info = { + Type: 'm3u', + Url: $('#txtDevicePath', page).val(), + ImportFavoritesOnly: $('#chkFavorite', page).checked() + }; + + var id = getParameterByName('id'); + + if (id) { + info.Id = id; + } + + ApiClient.ajax({ + type: "POST", + url: ApiClient.getUrl('LiveTv/TunerHosts'), + data: JSON.stringify(info), + contentType: "application/json" + + }).done(function (result) { + + Dashboard.processServerConfigurationUpdateResult(); + Dashboard.navigate('livetvstatus.html'); + + }).fail(function () { + Dashboard.alert({ + message: Globalize.translate('ErrorSavingTvProvider') + }); + }); + + } + + $(document).on('pageinitdepends', "#liveTvTunerProviderM3UPage", function () { + + var page = this; + + $('form', page).on('submit', function () { + submitForm(page); + return false; + }); + + }).on('pageshowready', "#liveTvTunerProviderM3UPage", function () { + + var providerId = getParameterByName('id'); + var page = this; + reload(page, providerId); + }); + +})(jQuery, document, window);