commit 4fc2d8be36be7f84fc6d9b08f253a4b104560a7a
parent aebe692707149086f2fc08206bdd81538e0f5549
Author: Brian C. Lane <bcl@brianlane.com>
Date: Tue, 26 Oct 2010 07:34:04 -0700
Add skeleton movie view with arced portrait display
Diffstat:
2 files changed, 67 insertions(+), 11 deletions(-)
diff --git a/HMS/source/appDisplayDirectory.brs b/HMS/source/appDisplayDirectory.brs
@@ -12,7 +12,6 @@ Function displayDirectory( url As String ) As Object
port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
- screen.SetListStyle("flat-category")
screen.SetListDisplayMode("zoom-to-fill")
' Get last element of URL to use as a breadcrumb
@@ -71,6 +70,8 @@ Function displayDirectory( url As String ) As Object
else
return invalid
end if
+ else if dirType = 4 then
+ ret = showMovies( screen, displayList, dir, url )
else
return invalid
end if
@@ -104,6 +105,8 @@ End Function
'** return the one selected by the user or nil?
'******************************************************
Function showCategories( screen As Object, files As Object, dir as Object, url as String ) As Object
+ screen.SetListStyle("flat-category")
+
sdImageTypes = []
sdImageTypes.Push("-SD.jpg")
sdImageTypes.Push("-SD.png")
@@ -154,3 +157,65 @@ Function showCategories( screen As Object, files As Object, dir as Object, url a
end while
End Function
+'******************************************************
+'** Display a arced-portrait poster screen of items
+'** return the one selected by the user or nil?
+'******************************************************
+Function showMovies( screen As Object, files As Object, dir as Object, url as String ) As Object
+ screen.SetListStyle("arced-portrait")
+
+ sdImageTypes = []
+ sdImageTypes.Push("-SD.jpg")
+ sdImageTypes.Push("-SD.png")
+ hdImageTypes = []
+ hdImageTypes.Push("-HD.jpg")
+ hdImageTypes.Push("-HD.png")
+
+ list = CreateObject("roArray", files.Count(), true)
+ for each f in files
+ print f[0]
+ o = CreateObject("roAssociativeArray")
+ o.ContentType = "movie"
+ o.ShortDescriptionLine1 = f[1]["basename"]
+
+ o.SDPosterUrl = "pkg:/dir-SD.png"
+ o.HDPosterUrl = "pkg:/dir-HD.png"
+ ' poster images in the dir?
+ for each i in sdImageTypes
+ if dir.DoesExist(f[1]["basename"]+i) then
+ o.SDPosterUrl = url + f[1]["basename"] + i
+ exit for
+ end if
+ end for
+
+ for each i in hdImageTypes
+ if dir.DoesExist(f[1]["basename"]+i) then
+ o.HDPosterUrl = url + f[1]["basename"] + i
+ exit for
+ end if
+ end for
+
+ list.Push(o)
+ end for
+
+ screen.SetContentList(list)
+ screen.Show()
+
+ while true
+ msg = wait(0, screen.GetMessagePort())
+ print msg
+ if msg = invalid or msg.isScreenClosed() then
+ ' UP appears to close the screen, so we get here
+ print "screen closed"
+ return invalid
+ else if msg.isListItemSelected() then
+ print "msg: ";msg.GetMessage();" idx: ";msg.GetIndex()
+ ' If the selected entry is a directory, return it
+ ' If it is a movie, play it
+
+
+ return files[msg.GetIndex()]
+ end if
+ end while
+End Function
+
diff --git a/HMS/source/getDirectoryListing.brs b/HMS/source/getDirectoryListing.brs
@@ -3,8 +3,6 @@
' ** Copyright (c) 2010 Brian C. Lane All Rights Reserved.
' ********************************************************************
Function getDirectoryListing(url As String) As Object
- print "dir url: ";url
-
http = CreateObject("roUrlTransfer")
http.SetUrl(url)
dir = http.GetToString()
@@ -21,22 +19,15 @@ Function getDirectoryListing(url As String) As Object
return invalid
end if
- print "got xml"
-
' grab all the <a href /> elements
urls = getUrls({}, xml)
- print urls
-
return urls
End Function
Function getUrls(array as Object, element as Object) As Object
if element.GetName() = "a" and element.HasAttribute("href") then
-' array.AddReplace(element.GetAttributes()["href"], "")
- href = element.GetAttributes()["href"]
- print "href: ";href
- array.AddReplace(href, "")
+ array.AddReplace(element.GetAttributes()["href"], "")
end if
if element.GetChildElements()<>invalid then
for each e in element.GetChildElements()