HMS

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

commit b7a4d48a1fce410ac534067761e998bfd0b586b2
parent c176a0034892aaa95145c19d1618a6673ba6d39f
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Fri, 29 Oct 2010 21:46:51 -0700

Set StreamFormat from the file extension or default to mp4

Diffstat:
MHMS/source/appDisplayDirectory.brs | 17+++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/HMS/source/appDisplayDirectory.brs b/HMS/source/appDisplayDirectory.brs @@ -173,9 +173,15 @@ Function showMovies( screen As Object, files As Object, dir as Object, url as St hdImageTypes.Push("-HD.jpg") hdImageTypes.Push("-HD.png") + streamFormat = { mp4 : "mp4", m4v : "mp4", mov : "mp4", + wmv : "wmv", hls : "hls" + } + list = CreateObject("roArray", files.Count(), true) for each f in files print f[0] + print f[1] + o = CreateObject("roAssociativeArray") o.ContentType = "movie" o.ShortDescriptionLine1 = f[1]["basename"] @@ -210,15 +216,18 @@ Function showMovies( screen As Object, files As Object, dir as Object, url as St o.Rating = "NR" o.StarRating = 100 o.Title = f[1]["basename"] - - ' Is there a generic number? - o.Length = 60 + o.Length = 0 ' Video related stuff (can I put this all in the same object?) o.StreamBitrates = [0] o.StreamUrls = [url + f[0]] o.StreamQualities = ["SD"] - o.StreamFormat = ["mp4"] + if streamFormat.DoesExist(f[1]["extension"].Mid(1)) then + o.StreamFormat = streamFormat[f[1]["extension"].Mid(1)] + print o.StreamFormat + else + o.StreamFormat = ["mp4"] + end if list.Push(o) end for