HMS

Home Media Server for Roku Players
git clone https://www.brianlane.com/git/HMS
Log | Files | Refs | README | LICENSE

commit 534ac02eab3c293bda5b68271ec77e7c3ab0a0e2
parent d18c167600cd4772c556b464d4dd60ffa5eb9c05
Author: Brian C. Lane <bcl@ibrianlane.com>
Date:   Wed, 14 Nov 2018 11:47:18 -0800

Add support for starting playback with Play instead of OK

Diffstat:
MHMS/source/appMediaServer.brs | 27++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/HMS/source/appMediaServer.brs b/HMS/source/appMediaServer.brs @@ -46,13 +46,19 @@ Function mediaServer( url As String, has_keystore As Boolean ) As Object screen.SetFocusedListItem(getFocusedItem(url, has_keystore, titles[last_title], metadata.Count())) end if + play_focus = -1 setup_selected = false while true msg = wait(30000, port) if type(msg) = "roPosterScreenEvent" then + if msg.isRemoteKeyPressed() and msg.getIndex() = 13 then + wasPlayPressed = true + else + wasPlayPressed = false + end if if msg.isScreenClosed() then return -1 - elseif msg.isListSelected() + elseif msg.isListSelected() then if msg.GetIndex() = max_titles then screen.SetContentList(getSetupRow(url)) setup_selected = true @@ -80,19 +86,22 @@ Function mediaServer( url As String, has_keystore As Boolean ) As Object elseif msg.isListItemSelected() and setup_selected = true then checkServerUrl(true) screen.SetFocusToFilterBanner(true) - elseif msg.isListItemSelected() + elseif msg.isListItemFocused() then + play_focus = msg.getIndex() + elseif msg.isListItemSelected() or wasPlayPressed then + print "Focus is on"; play_focus if has_keystore = true then - setKeyValue(url, titles[last_title], tostr(msg.GetIndex())) + setKeyValue(url, titles[last_title], tostr(play_focus)) end if movies = screen.GetContentList() - print movies[msg.GetIndex()] - result = playMovie(movies[msg.GetIndex()], url, has_keystore) - if result = true and msg.GetIndex() < movies.Count() then + print movies[play_focus] + result = playMovie(movies[play_focus], url, has_keystore) + if result = true and play_focus < movies.Count() then ' Advance to the next video and save it - screen.SetFocusedListItem(msg.GetIndex()+1) + screen.SetFocusedListItem(play_focus+1) if has_keystore = true then - if msg.GetIndex() < movies.Count() then - setKeyValue(url, titles[last_title], tostr(msg.GetIndex()+1)) + if play_focus < movies.Count() then + setKeyValue(url, titles[last_title], tostr(play_focus+1)) end if end if end if