Skip to content

Commit

Permalink
Fix Setup menu handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian C. Lane committed Nov 25, 2017
1 parent 04e457a commit 691d64b
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions HMS/source/appMediaServer.brs
Expand Up @@ -28,7 +28,7 @@ Function mediaServer( url As String, has_keystore As Boolean ) As Object
end function)
titles = catTitles(categories)
screen.SetListNames(titles)
max_titles = titles.Count()
max_titles = titles.Count()-1

screen.SetFocusToFilterBanner(true)
last_title = getFocusedItem(url, has_keystore, "filter_pos", max_titles)
Expand All @@ -40,19 +40,24 @@ Function mediaServer( url As String, has_keystore As Boolean ) As Object

' Load the selected title
metadata = getCategoryMetadata(url, categories[last_title][0])
cache.AddReplace(tostr(last_title), metadata)
screen.SetContentList(metadata)
screen.SetFocusedListItem(getFocusedItem(url, has_keystore, titles[last_title], metadata.Count()))
if metadata.Count() > 0 then
cache.AddReplace(tostr(last_title), metadata)
screen.SetContentList(metadata)
screen.SetFocusedListItem(getFocusedItem(url, has_keystore, titles[last_title], metadata.Count()))
end if

setup_selected = false
while true
msg = wait(30000, port)
if type(msg) = "roPosterScreenEvent" then
if msg.isScreenClosed() then
return -1
elseif msg.isListSelected()
if msg.GetIndex() = max_titles then
checkServerUrl(true)
screen.SetContentList(getSetupRow(url))
setup_selected = true
else
setup_selected = false
last_title = msg.GetIndex()
print "selected "; titles[last_title]

Expand All @@ -72,6 +77,9 @@ Function mediaServer( url As String, has_keystore As Boolean ) As Object
screen.SetContentList(metadata)
screen.SetFocusedListItem(getFocusedItem(url, has_keystore, titles[last_title], metadata.Count()))
end if
elseif msg.isListItemSelected() and setup_selected = true then
checkServerUrl(true)
screen.SetFocusToFilterBanner(true)
elseif msg.isListItemSelected()
if has_keystore = true then
setKeyValue(url, titles[last_title], tostr(msg.GetIndex()))
Expand All @@ -98,26 +106,18 @@ End Function


'*************************************
'** Get the utility row (Setup, Search)
'** Get the Setup row
'*************************************
Function getUtilRow(url As String) As Object
' Setup the Search/Setup entries for first row
search = CreateObject("roArray", 2, true)
Function getSetupRow(url As String) As Object
' Setup the Search
setup = CreateObject("roArray", 1, true)
o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = "Setup"
o.SDPosterUrl = url+"/Setup-SD.png"
o.HDPosterUrl = url+"/Setup-HD.png"
search.Push(o)

o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = "Search"
o.SDPosterUrl = url+"/Search-SD.png"
o.HDPosterUrl = url+"/Search-HD.png"
search.Push(o)

return search
setup.Push(o)
return setup
End Function

'**********************************
Expand Down

0 comments on commit 691d64b

Please sign in to comment.