For LiveTV Library, respect default view if set to "TV Guide"

This commit is contained in:
Neil Burrows 2020-11-29 11:18:23 +00:00
parent a9516597fc
commit 86987e8590
4 changed files with 35 additions and 8 deletions

View File

@ -60,6 +60,11 @@ sub loadInitialItems()
'For LiveTV, we want to "Fit" the item images, not zoom 'For LiveTV, we want to "Fit" the item images, not zoom
m.top.imageDisplayMode = "scaleToFit" m.top.imageDisplayMode = "scaleToFit"
if get_user_setting("display.livetv.landing") = "guide" then
showTvGuid()
end if
else if m.top.parentItem.collectionType = "CollectionFolder" then else if m.top.parentItem.collectionType = "CollectionFolder" then
' Non-recursive, to not show subfolder contents ' Non-recursive, to not show subfolder contents
m.loadItemsTask.recursive = false m.loadItemsTask.recursive = false
@ -117,7 +122,7 @@ sub SetUpOptions()
else if m.top.parentItem.collectionType = "livetv" then else if m.top.parentItem.collectionType = "livetv" then
options.views = [ options.views = [
{"Title": tr("Channels"), "Name": "livetv" }, {"Title": tr("Channels"), "Name": "livetv" },
{"Title": tr("TV Guide"), "Name": "tvGuide" } {"Title": tr("TV Guide"), "Name": "tvGuide", "Selected": get_user_setting("display.livetv.landing") = "guide" }
] ]
options.sort = [ options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" } { "Title": tr("TITLE"), "Name": "SortName" }
@ -268,13 +273,7 @@ end sub
sub optionsClosed() sub optionsClosed()
if (m.options.view = "tvGuide") then if (m.options.view = "tvGuide") then
m.top.signalBeacon("EPGLaunchInitiate") ' Required Roku Performance monitoring showTVGuid()
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 return
else if m.tvGuide <> invalid then else if m.tvGuide <> invalid then
' Try to hide the TV Guide ' Try to hide the TV Guide
@ -301,6 +300,15 @@ sub optionsClosed()
m.itemGrid.setFocus(true) m.itemGrid.setFocus(true)
end sub end sub
sub showTVGuid()
m.top.signalBeacon("EPGLaunchInitiate") ' Required Roku Performance monitoring
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)
end sub
sub onChannelSelected(msg) sub onChannelSelected(msg)
node = msg.getRoSGNode() node = msg.getRoSGNode()

View File

@ -36,5 +36,6 @@
<field id="imageDisplayMode" type="string" value="scaleToZoom" /> <field id="imageDisplayMode" type="string" value="scaleToZoom" />
</interface> </interface>
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" /> <script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
<script type="text/brightscript" uri="ItemGrid2.brs" /> <script type="text/brightscript" uri="ItemGrid2.brs" />
</component> </component>

View File

@ -486,6 +486,7 @@ function LoginFlow(startOver = false as boolean)
get_token(userSelected, "") get_token(userSelected, "")
if get_setting("active_user") <> invalid then if get_setting("active_user") <> invalid then
m.user = AboutMe() m.user = AboutMe()
LoadUserPreferences()
SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed SendPerformanceBeacon("AppDialogComplete") ' Roku Performance monitoring - Dialog Closed
return true return true
end if end if
@ -508,6 +509,7 @@ function LoginFlow(startOver = false as boolean)
goto start_login goto start_login
end if end if
LoadUserPreferences()
wipe_groups() wipe_groups()
'Send Device Profile information to server 'Send Device Profile information to server

View File

@ -67,3 +67,19 @@ function GetPublicUsers()
resp = APIRequest(url) resp = APIRequest(url)
return getJson(resp) return getJson(resp)
end function end function
' Load and parse Display Settings from server
sub LoadUserPreferences()
id = get_setting("active_user")
' Currently using client "emby", which is what website uses so we get same Display prefs as web.
' May want to change to specific Roku display settings
url = Substitute("DisplayPreferences/usersettings?userId={0}&client=emby", id)
resp = APIRequest(url)
jsonResponse = getJson(resp)
if jsonResponse <> invalid and jsonResponse.CustomPrefs <> invalid and jsonResponse.CustomPrefs["landing-livetv"] <> invalid then
set_user_setting("display.livetv.landing", jsonResponse.CustomPrefs["landing-livetv"])
else
unset_user_setting("display.livetv.landing")
end if
end sub