HMS

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

commit 0df0df5d875d192f940ef96b0a58274201a941d7
parent bdd1715efc48ce0309df27181de0d31578f032f3
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sun, 31 Oct 2010 12:10:50 -0700

Add episode playback and description text

Episode directories now show a flat-episode display
Video files now check for a basename.txt file and read the description
from it. Currently this is only displayed in the episode display.

Diffstat:
MHMS/source/appDisplayDirectory.brs | 39+++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/HMS/source/appDisplayDirectory.brs b/HMS/source/appDisplayDirectory.brs @@ -70,8 +70,10 @@ Function displayDirectory( url As String ) As Object else return invalid end if + else if dirType = 3 then + ret = showVideos( screen, displayList, dir, url, true) else if dirType = 4 then - ret = showMovies( screen, displayList, dir, url ) + ret = showVideos( screen, displayList, dir, url, false ) else return invalid end if @@ -172,11 +174,16 @@ Function showCategories( screen As Object, files As Object, dir as Object, url a End Function '****************************************************** -'** Display a arced-portrait poster screen of items -'** return the one selected by the user or nil? +'** Display a arced-portrait or flat-episodic poster +'** screen of items +'** Handle playback of selected video '****************************************************** -Function showMovies( screen As Object, files As Object, dir as Object, url as String ) As Object - screen.SetListStyle("arced-portrait") +Function showVideos( screen As Object, files As Object, dir as Object, url as String, episodes As Boolean ) As Object + if episodes then + screen.SetListStyle("flat-episodic") + else + screen.SetListStyle("arced-portrait") + end if sdImageTypes = [] sdImageTypes.Push("-SD.jpg") @@ -224,7 +231,7 @@ Function showMovies( screen As Object, files As Object, dir as Object, url as St o.IsHD = false o.HDBranded = false - o.Description = "Should try reading this from a file" + o.Description = getDescription(f[1]["basename"], url, dir) o.Rating = "NR" o.StarRating = 100 o.Title = f[1]["basename"] @@ -301,3 +308,23 @@ Sub playMovie( movie as Object) End Sub +'****************************************************** +'** Check to see if a description file (.txt) exists +'** and read it into a string. +'** And if it is missing return "" +'****************************************************** +Function getDescription( file As Object, url As String, dir As Object ) + desc = "" + if dir.DoesExist(file + ".txt") then + print "Retrieving description from ";url+file+".txt" + http = CreateObject("roUrlTransfer") + http.SetUrl(url+file+".txt") + resp = http.GetToString() + + if resp <> invalid then + desc = resp + end if + end if + return desc +End Function +