From f94d56ffd3c3bb9587319e62cd456d196b20dcde Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Mon, 23 Nov 2020 17:13:57 +0000 Subject: [PATCH 01/11] Live TV Schedule / Guide --- components/ItemGrid2/ItemGrid2.brs | 36 ++- components/ItemGrid2/ItemGrid2.xml | 1 + components/ItemGrid2/ItemGridOptions.brs | 8 +- components/data/ChannelData.brs | 4 +- components/data/ChannelData.xml | 1 - components/data/ScheduleProgramData.brs | 66 ++++++ components/data/ScheduleProgramData.xml | 22 ++ components/liveTv/LoadChannelsTask.brs | 34 +++ components/liveTv/LoadChannelsTask.xml | 15 ++ components/liveTv/LoadProgramDetailsTask.brs | 32 +++ components/liveTv/LoadProgramDetailsTask.xml | 13 ++ components/liveTv/LoadSheduleTask.brs | 41 ++++ components/liveTv/LoadSheduleTask.xml | 13 ++ components/liveTv/ProgramDetails.brs | 217 +++++++++++++++++++ components/liveTv/ProgramDetails.xml | 58 +++++ components/liveTv/schedule.brs | 181 ++++++++++++++++ components/liveTv/schedule.xml | 22 ++ images/backgroundmask.png | Bin 0 -> 829725 bytes images/white.9.png | Bin 0 -> 447 bytes locale/default/translations.ts | 105 +++++++++ locale/en_GB/translations.ts | 105 +++++++++ locale/en_US/translations.ts | 109 +++++++++- source/Main.brs | 36 +-- source/VideoPlayer.brs | 1 - source/utils/misc.brs | 4 +- 25 files changed, 1095 insertions(+), 29 deletions(-) create mode 100644 components/data/ScheduleProgramData.brs create mode 100644 components/data/ScheduleProgramData.xml create mode 100644 components/liveTv/LoadChannelsTask.brs create mode 100644 components/liveTv/LoadChannelsTask.xml create mode 100644 components/liveTv/LoadProgramDetailsTask.brs create mode 100644 components/liveTv/LoadProgramDetailsTask.xml create mode 100644 components/liveTv/LoadSheduleTask.brs create mode 100644 components/liveTv/LoadSheduleTask.xml create mode 100644 components/liveTv/ProgramDetails.brs create mode 100644 components/liveTv/ProgramDetails.xml create mode 100644 components/liveTv/schedule.brs create mode 100644 components/liveTv/schedule.xml create mode 100644 images/backgroundmask.png create mode 100644 images/white.9.png diff --git a/components/ItemGrid2/ItemGrid2.brs b/components/ItemGrid2/ItemGrid2.brs index 2e653e25..b12418f3 100644 --- a/components/ItemGrid2/ItemGrid2.brs +++ b/components/ItemGrid2/ItemGrid2.brs @@ -1,6 +1,7 @@ sub init() m.options = m.top.findNode("options") + m.tvGuide = invalid m.itemGrid = m.top.findNode("itemGrid") m.backdrop = m.top.findNode("backdrop") @@ -78,6 +79,7 @@ end sub sub SetUpOptions() options = {} + options.filter = [] 'Movies if m.top.parentItem.collectionType = "movies" then @@ -113,13 +115,18 @@ sub SetUpOptions() options.filter = [] 'Live TV else if m.top.parentItem.collectionType = "livetv" then - options.views = [{"Title": tr("Live TV"), "Name": "livetv" }] + options.views = [ + {"Title": tr("Channels"), "Name": "livetv" }, + {"Title": tr("TV Guide"), "Name": "tvGuide" } + ] options.sort = [ { "Title": tr("TITLE"), "Name": "SortName" } ] options.filter = [] else - options.views = [{ "Title": tr("Default"), "Name": "default" }] + options.views = [ + {"Title": tr("Default"), "Name": "default" } + ] options.sort = [ { "Title": tr("TITLE"), "Name": "SortName" } ] @@ -259,6 +266,20 @@ end sub ' 'Check if options updated and any reloading required sub optionsClosed() + + if (m.options.view = "tvGuide") then + if m.tvGuide = invalid then + m.tvGuide = createObject("roSGNode", "Schedule") + endif + m.tvGuide.observeField("watchChannel", "onChannelSelected") + m.top.appendChild(m.tvGuide) + m.tvGuide.lastFocus.setFocus(true) + return + else if m.tvGuide <> invalid then + ' Try to hide the TV Guide + m.top.removeChild(m.tvGuide) + end if + reload = false if m.options.sortField <> m.sortField or m.options.sortAscending <> m.sortAscending then m.sortField = m.options.sortField @@ -280,6 +301,15 @@ sub optionsClosed() end sub +sub onChannelSelected(msg) + node = msg.getRoSGNode() + m.top.lastFocus = lastFocusedChild(node) + if node.watchChannel <> invalid then + ' Clone the node when it's reused/update in the TimeGrid it doesn't automatically start playing + m.top.selectedItem = node.watchChannel.clone(false) + end if +end sub + function onKeyEvent(key as string, press as boolean) as boolean if not press then return false @@ -287,9 +317,11 @@ function onKeyEvent(key as string, press as boolean) as boolean if key = "options" if m.options.visible = true then m.options.visible = false + m.top.removeChild(m.options) optionsClosed() else m.options.visible = true + m.top.appendChild(m.options) m.options.setFocus(true) end if return true diff --git a/components/ItemGrid2/ItemGrid2.xml b/components/ItemGrid2/ItemGrid2.xml index bde386d4..88d9d45e 100644 --- a/components/ItemGrid2/ItemGrid2.xml +++ b/components/ItemGrid2/ItemGrid2.xml @@ -35,5 +35,6 @@ +