From e10cf817c5d07a9208098af4c410fa62992ba61f Mon Sep 17 00:00:00 2001 From: Neil Burrows Date: Sun, 1 Aug 2021 09:49:08 +0100 Subject: [PATCH] Enable favourite filtering on TV Guide --- components/ItemGrid/ItemGrid.brs | 1 + components/ItemGrid/LoadItemsTask2.brs | 2 +- components/liveTv/LoadChannelsTask.brs | 8 +++++--- components/liveTv/LoadChannelsTask.xml | 1 + components/liveTv/schedule.brs | 11 +++++++++++ components/liveTv/schedule.xml | 1 + 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/components/ItemGrid/ItemGrid.brs b/components/ItemGrid/ItemGrid.brs index aab2bb93..1ebd0ace 100644 --- a/components/ItemGrid/ItemGrid.brs +++ b/components/ItemGrid/ItemGrid.brs @@ -328,6 +328,7 @@ sub showTVGuide() m.top.signalBeacon("EPGLaunchInitiate") ' Required Roku Performance monitoring end if m.tvGuide.observeField("watchChannel", "onChannelSelected") + m.tvGuide.filter = m.options.filter m.top.appendChild(m.tvGuide) m.tvGuide.lastFocus.setFocus(true) end sub diff --git a/components/ItemGrid/LoadItemsTask2.brs b/components/ItemGrid/LoadItemsTask2.brs index 188b43f7..575cfc42 100644 --- a/components/ItemGrid/LoadItemsTask2.brs +++ b/components/ItemGrid/LoadItemsTask2.brs @@ -30,7 +30,7 @@ sub loadItems() ' do nothing else if filter = "Favorites" params.append({ Filters: "IsFavorite" }) - params.append({ isFavorite: true}) + params.append({ isFavorite: true }) end if if m.top.ItemType <> "" diff --git a/components/liveTv/LoadChannelsTask.brs b/components/liveTv/LoadChannelsTask.brs index e1405ad0..e678b580 100644 --- a/components/liveTv/LoadChannelsTask.brs +++ b/components/liveTv/LoadChannelsTask.brs @@ -7,11 +7,13 @@ sub loadChannels() results = [] params = { - UserId: get_setting("active_user") - 'limit: m.top.limit, - 'StartIndex: m.top.startIndex + UserId: get_setting("active_user"), } + if m.top.filter = "Favorites" + params.append({ isFavorite: true }) + end if + url = "LiveTv/Channels" resp = APIRequest(url, params) diff --git a/components/liveTv/LoadChannelsTask.xml b/components/liveTv/LoadChannelsTask.xml index 5ae58a00..b0318bcd 100644 --- a/components/liveTv/LoadChannelsTask.xml +++ b/components/liveTv/LoadChannelsTask.xml @@ -4,6 +4,7 @@ + diff --git a/components/liveTv/schedule.brs b/components/liveTv/schedule.brs index cf5e8b25..2faea86d 100644 --- a/components/liveTv/schedule.brs +++ b/components/liveTv/schedule.brs @@ -28,6 +28,17 @@ sub init() m.channelIndex = {} end sub +sub channelFilterSet() + print "Channel Filter set" + if m.top.filter <> invalid and m.LoadChannelsTask.filter <> m.top.filter + if m.LoadChannelsTask.state = "run" then m.LoadChannelsTask.control = "stop" + + m.LoadChannelsTask.filter = m.top.filter + m.LoadChannelsTask.control = "RUN" + end if + +end sub + ' Initial list of channels loaded sub onChannelsLoaded() gridData = createObject("roSGNode", "ContentNode") diff --git a/components/liveTv/schedule.xml b/components/liveTv/schedule.xml index 1facea61..561dd535 100644 --- a/components/liveTv/schedule.xml +++ b/components/liveTv/schedule.xml @@ -18,6 +18,7 @@ +