HMS

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

commit 9e980a8ad539412e0013a1254d17fdb09500e547
parent 64285b2201eadca80e9eb284b3094d556386cf04
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Thu, 14 Oct 2010 21:27:17 -0700

Cleaning up subroutine names

Moved checkServerUrl to its own module.

Diffstat:
MHMS/source/DirParser.brs | 25+------------------------
AHMS/source/appDisplayDirectory.brs | 22++++++++++++++++++++++
MHMS/source/appHomeScreen.brs | 3+--
MHMS/source/appMain.brs | 16+++++++---------
MHMS/source/checkServerUrl.brs | 14+++++++-------
5 files changed, 38 insertions(+), 42 deletions(-)

diff --git a/HMS/source/DirParser.brs b/HMS/source/DirParser.brs @@ -3,7 +3,7 @@ ' ** Copyright (c) 2010 Brian C. Lane All Rights Reserved. ' ******************************************************************** -Sub Main() +Sub MainTest() http = CreateObject("roUrlTransfer") http.SetUrl("http://wyatt.brianlane.com/") dir = http.GetToString() @@ -31,26 +31,3 @@ Sub GetUrls(array as Object, element as Object) As Object return array End Sub -Sub PrintXML(element As Object, depth As Integer) - print tab(depth*3);"Name: ";element.GetName() - if not element.GetAttributes().IsEmpty() then - print tab(depth*3);"Attributes: "; - for each a in element.GetAttributes() - print a;"=";left(element.GetAttributes()[a], 20); - if element.GetAttributes().IsNext() then print ", "; - end for - print - end if - if element.GetText()<>invalid then - print tab(depth*3);"Contains Text: ";left(element.GetText(), 40) - end if - if element.GetChildElements()<>invalid - print tab(depth*3);"Contains roXMLList:" - for each e in element.GetChildElements() - PrintXML(e, depth+1) - end for - end if - print -end sub - - diff --git a/HMS/source/appDisplayDirectory.brs b/HMS/source/appDisplayDirectory.brs @@ -0,0 +1,22 @@ +'******************************************************************** +'** Home Media Server Application - Main +'** Copyright (c) 2010 Brian C. Lane All Rights Reserved. +'******************************************************************** + +'****************************************************** +'** Show the contents of url +'****************************************************** +Sub displayDirectory( url ) As Void + + ' Get the directory listing + + ' If there is an error, show a dialog to the user + + ' What kind of directory display should be shown? + + ' + + + +End Sub + diff --git a/HMS/source/appHomeScreen.brs b/HMS/source/appHomeScreen.brs @@ -1,6 +1,5 @@ '***************************************************************** '** Home Media Server Application -- Home Screen -'** November 2010 '** Copyright (c) 2010 Brian C. Lane All Rights Reserved. '***************************************************************** @@ -36,7 +35,7 @@ Function showHomeScreen(screen) As Integer if validateParam(screen, "roPosterScreen", "showHomeScreen") = false return -1 - checkServerUrl() ' Check Registry for server URL + checkServerUrl(false) ' Check Registry for server URL ' @TODO This needs to show something while it is loading the category list diff --git a/HMS/source/appMain.brs b/HMS/source/appMain.brs @@ -1,24 +1,22 @@ '******************************************************************** '** Home Media Server Application - Main -'** November 2010 '** Copyright (c) 2010 Brian C. Lane All Rights Reserved. '******************************************************************** Sub Main() + m.port = CreateObject("roMessagePort") + 'initialize theme attributes like titles, logos and overhang color initTheme() - 'prepare the screen for display and get ready to begin - screen=preShowHomeScreen("", "") - if screen=invalid then - print "unexpected error in preShowHomeScreen" + if not checkServerUrl() then + ' Need to show an error to the user here and exit when they click done + print "Server URL is invalid" return - end if - - 'set to go, time to get started - showHomeScreen(screen) + endif + displayDirectory("http://"+RegRead("ServerURL") ) End Sub diff --git a/HMS/source/checkServerUrl.brs b/HMS/source/checkServerUrl.brs @@ -9,14 +9,14 @@ ' ** Prompt the user to enter the URL or IP if it is not ' ** found and write it to the registry. '************************************************************ -Function checkServerUrl(forceEdit as Boolean) as Void +Function checkServerUrl(forceEdit As Boolean) As Boolean serverURL = RegRead("ServerURL") if (serverURL = invalid) then print "ServerURL not found in the registry" serverURL = "video.local" - else if !forceEdit then - print "Server set to ";serverURL - return + else if not forceEdit then + print "Server set to "; serverURL + return true endif screen = CreateObject("roKeyboardScreen") @@ -34,14 +34,14 @@ Function checkServerUrl(forceEdit as Boolean) as Void print "message received" if type(msg) = "roKeyboardScreenEvent" if msg.isScreenClosed() - return + return false else if msg.isButtonPressed() then print "Evt: ";msg.GetMessage();" idx:"; msg.GetIndex() if msg.GetIndex() = 1 then searchText = screen.GetText() - print "search text: "; searchText + print "Server set to "; searchText RegWrite("ServerURL", searchText) - return + return true endif endif endif