{"commit":"925ab9783a467031f893f72146e9e93592b47c67","subject":"Optimized MRSS thumbnailing to improve performance","message":"Optimized MRSS thumbnailing to improve performance\n\n--HG--\nextra : convert_revision : svn%3A1a989651-ce6e-ed51-1896-c0ee68ac2431\/trunk%4017\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/lib\/NWM_MRSS.brs","new_file":"source\/lib\/NWM_MRSS.brs","new_contents":"''\n''\tNWM_MRSS\n''\tchagedorn@roku.com\n''\n''\tA BrightScript class for parsing standard MRSS files\n''\thttp:\/\/video.search.yahoo.com\/mrss\n''\n''\tUsage:\n''\t\tmrss = NWM_MRSS(\"http:\/\/www.example.com\/mrss_feed.xml\")\t' iniitialize a NWM_MRSS object\n''\t\tepisodes = mrss.GetEpisodes(10) ' get the first 10 episodes found in the MRSS feed\n''\t\tepisodes = mrss.GetEpisodes() \t' get all episodes found in the MRSS feed\n''\n\nfunction NWM_MRSS(url)\n\tthis = {\n\t\turl:\turl\n\t\t\n\t\tGetEpisodes:\tNWM_MRSS_GetEpisodes\n\t}\n\t\n\treturn this\nend function\n\n' Build an array of content-meta-data objects suitable for passing to roPosterScreen::SetContentList()\nfunction NWM_MRSS_GetEpisodes(limit = 0)\n\tresult = []\n\tutil = NWM_Utilities()\n\t\n\tif InStr(1, m.url, \"http:\/\/\") = 1\n\t\traw = NWM_GetStringFromURL(m.url)\n\telse\n\t\traw = ReadASCIIFile(m.url)\n\tend if\n\n\txml = CreateObject(\"roXMLElement\")\n\tif xml.Parse(raw)\n\t\t' Channel thumbnail\n\t\tchannelthumb = \"\"\n\t\tif xml.channel.image.url.Count() > 0 ' rss standard image tag\n\t\t\tchannelthumb = ValidStr(xml.channel.image.url.GetText())\n\t\telse\n\t\t\ttmp = xml.channel.GetNamedElements(\"media:thumbnail\") ' mrss media tag\n\t\t\tif tmp.Count() > 0\n\t\t\t\tchannelthumb = ValidStr(tmp[0]@url)\n\t\t\telse\n\t\t\t\ttmp = xml.channel.GetNamedElements(\"itunes:image\") ' less-than-standard itunes image tag\n\t\t\t\tif tmp.Count() > 0\n\t\t\t\t\tchannelthumb = ValidStr(tmp[0]@href)\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\n\t\tfor each item in xml.channel.item\n\t\t\tnewItem = {\n\t\t\t\tstreams:\t[]\n\t\t\t\tstreamFormat:\t\"mp4\"\n\t\t\t\tactors:\t\t[]\n\t\t\t\tcategories:\t[]\n\t\t\t\tcontentType:\t\"episode\"\n\t\t\t}\n\t\t\t\n\t\t\t' title\n\t\t\ttmp = item.GetNamedElements(\"media:title\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tnewItem.title = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))\n\t\t\t\tnewItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))\n\t\t\telse\n\t\t\t\tnewItem.title = util.HTMLEntityDecode(ValidStr(item.title.GetText()))\n\t\t\t\tnewItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(item.title.GetText()))\n\t\t\tend if\n\t\t\t\t\n\t\t\t' description\n\t\t\ttmp = item.GetNamedElements(\"media:description\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tdescription = util.HTMLEntityDecode(util.HTMLStripTags(ValidStr(tmp[0].GetText())))\n\t\t\t\tnewItem.description = description\n\t\t\t\tnewItem.synopsis = description\n\t\t\telse\n\t\t\t\tdescription = util.HTMLEntityDecode(util.HTMLStripTags(ValidStr(item.description.GetText())))\n\t\t\t\tnewItem.description = description\n\t\t\t\tnewItem.synopsis = description\n\t\t\tend if\n\n\t\t\t' hq thumbnail\n\t\t\ttmp = item.GetNamedElements(\"media:thumbnail\") \n\t\t\tif tmp.Count() > 0\n\t\t\t\tnewItem.sdPosterURL_hq = ValidStr(tmp[0]@url)\n\t\t\t\tnewItem.hdPosterURL_hq = ValidStr(tmp[0]@url)\n\t\t\tend if\n\n\t\t\t' thumbnail (from channel)\n\t\t\tnewItem.sdPosterURL = ValidStr(channelthumb)\n\t\t\tnewItem.hdPosterURL = ValidStr(channelthumb)\n\t\t\t\t\n\t\t\t' categories\n\t\t\ttmp = item.GetNamedElements(\"media:category\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tfor each category in tmp\n\t\t\t\t\tnewItem.categories.Push(ValidStr(category.GetText()))\n\t\t\t\tnext\n\t\t\tend if\n\t\t\t\t\n\t\t\t' acrtors and director\n\t\t\ttmp = item.GetNamedElements(\"media:credit\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tfor each credit in tmp\n\t\t\t\t\tif ValidStr(credit@role) = \"actor\"\n\t\t\t\t\t\tnewItem.actors.Push(ValidStr(credit.GetText()))\n\t\t\t\t\telse if ValidStr(credit@role) = \"director\"\n\t\t\t\t\t\tnewItem.director = ValidStr(credit.GetText())\n\t\t\t\t\tend if\n\t\t\t\tnext\n\t\t\tend if\n\t\t\t\t\n\t\t\t' rating\n\t\t\ttmp = item.GetNamedElements(\"media:rating\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tnewItem.rating = ValidStr(tmp[0].GetText())\n\t\t\tend if\n\n\t\t\t' release date\n\t\t\tnewItem.releaseDate = ValidStr(item.pubdate.GetText())\n\t\t\t\n\t\t\t' media:content can be a child of or of \n\t\t\tcontentItems = item.GetNamedElements(\"media:content\")\n\t\t\tif contentItems.Count() = 0\n\t\t\t\ttmp = item.GetNamedElements(\"media:group\")\n\t\t\t\tif tmp.Count() > 0\n\t\t\t\t\tcontentItems = tmp.GetNamedElements(\"media:content\")\n\t\t\t\tend if\n\t\t\tend if\n\t\t\t\n\t\t\tif contentItems.Count() > 0\n\t\t\t\tfor each content in contentItems\n\t\t\t\t\tif ValidStr(content@url) <> \"\"\n\t\t\t\t\t\tnewStream = {\n\t\t\t\t\t\t\turl:\t\t\tValidStr(content@url)\n\t\t\t\t\t\t\tbitrate:\tStrToI(ValidStr(content@bitrate))\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t' use the content's height attribute to determine HD-ness\n\t\t\t\t\t\tif StrToI(ValidStr(content@height)) > 720\n\t\t\t\t\t\t\tnewStream.quality = true\n\t\t\t\t\t\t\tnewItem.HDBranded = true\n\t\t\t\t\t\t\tnewItem.isHD = true\n\t\t\t\t\t\t\tnewItem.fullHD = true\n\t\t\t\t\t\telse if StrToI(ValidStr(content@height)) > 480\n\t\t\t\t\t\t\tnewStream.quality = true\n\t\t\t\t\t\t\tnewItem.HDBranded = true\n\t\t\t\t\t\t\tnewItem.isHD = true\n\t\t\t\t\t\tend if\n\n\t\t\t\t\t\tnewItem.streams.push(newStream)\n\t\t\t\t\tend if\n\t\t\t\tnext\n\t\t\t\t\n\t\t\t\tlength = StrToI(ValidStr(contentItems[0]@duration))\n\t\t\t\tif newItem.length = invalid and length > 0\n\t\t\t\t\tnewItem.length = length\n\t\t\t\tend if\n\n\t\t\t\t'PrintAA(newItem)\n\t\t\t\tresult.Push(newItem)\n\t\t\telse if item.enclosure.Count() > 0\n\t\t\t\t' we didn't find any media:content tags, try the enclosure tag\n\t\t\t\tnewStream = {\n\t\t\t\t\turl:\tValidStr(item.enclosure@url)\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnewItem.streams.Push(newStream)\n\n\t\t\t\t'PrintAA(newItem)\n\t\t\t\tresult.Push(newItem)\n\t\t\tend if\n\t\tnext\n\tend if\n\t\n\treturn result\nend function\n","old_contents":"''\n''\tNWM_MRSS\n''\tchagedorn@roku.com\n''\n''\tA BrightScript class for parsing standard MRSS files\n''\thttp:\/\/video.search.yahoo.com\/mrss\n''\n''\tUsage:\n''\t\tmrss = NWM_MRSS(\"http:\/\/www.example.com\/mrss_feed.xml\")\t' iniitialize a NWM_MRSS object\n''\t\tepisodes = mrss.GetEpisodes(10) ' get the first 10 episodes found in the MRSS feed\n''\t\tepisodes = mrss.GetEpisodes() \t' get all episodes found in the MRSS feed\n''\n\nfunction NWM_MRSS(url)\n\tthis = {\n\t\turl:\turl\n\t\t\n\t\tGetEpisodes:\tNWM_MRSS_GetEpisodes\n\t}\n\t\n\treturn this\nend function\n\n' Build an array of content-meta-data objects suitable for passing to roPosterScreen::SetContentList()\nfunction NWM_MRSS_GetEpisodes(limit = 0)\n\tresult = []\n\tutil = NWM_Utilities()\n\t\n\tif InStr(1, m.url, \"http:\/\/\") = 1\n\t\traw = NWM_GetStringFromURL(m.url)\n\telse\n\t\traw = ReadASCIIFile(m.url)\n\tend if\n\t'print raw\n\n\txml = CreateObject(\"roXMLElement\")\n\tif xml.Parse(raw)\n\t\tfor each item in xml.channel.item\n\t\t\tnewItem = {\n\t\t\t\tstreams:\t[]\n\t\t\t\tstreamFormat:\t\"mp4\"\n\t\t\t\tactors:\t\t[]\n\t\t\t\tcategories:\t[]\n\t\t\t\tcontentType:\t\"episode\"\n\t\t\t}\n\t\t\t\n\t\t\t' title\n\t\t\ttmp = item.GetNamedElements(\"media:title\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tnewItem.title = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))\n\t\t\t\tnewItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(tmp[0].GetText()))\n\t\t\telse\n\t\t\t\tnewItem.title = util.HTMLEntityDecode(ValidStr(item.title.GetText()))\n\t\t\t\tnewItem.shortDescriptionLine1 = util.HTMLEntityDecode(ValidStr(item.title.GetText()))\n\t\t\tend if\n\t\t\t\t\n\t\t\t' description\n\t\t\ttmp = item.GetNamedElements(\"media:description\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tdescription = util.HTMLEntityDecode(util.HTMLStripTags(ValidStr(tmp[0].GetText())))\n\t\t\t\tnewItem.description = description\n\t\t\t\tnewItem.synopsis = description\n\t\t\telse\n\t\t\t\tdescription = util.HTMLEntityDecode(util.HTMLStripTags(ValidStr(item.description.GetText())))\n\t\t\t\tnewItem.description = description\n\t\t\t\tnewItem.synopsis = description\n\t\t\tend if\n\n\t\t\t' hq thumbnail\n\t\t\ttmp = item.GetNamedElements(\"media:thumbnail\") \n\t\t\tif tmp.Count() > 0\n\t\t\t\tnewItem.sdPosterURL_hq = ValidStr(tmp[0]@url)\n\t\t\t\tnewItem.hdPosterURL_hq = ValidStr(tmp[0]@url)\n\t\t\tend if\n\n\t\t\t' thumbnail\n\t\t\tif xml.channel.image.url.Count() > 0 ' rss standard image tag\n\t\t\t\tnewItem.sdPosterURL = ValidStr(xml.channel.image.url.GetText())\n\t\t\t\tnewItem.hdPosterURL = ValidStr(xml.channel.image.url.GetText())\n\t\t\telse\n\t\t\t\ttmp = xml.channel.GetNamedElements(\"media:thumbnail\") ' mrss media tag\n\t\t\t\tif tmp.Count() > 0\n\t\t\t\t\tnewItem.sdPosterURL = ValidStr(tmp[0]@url)\n\t\t\t\t\tnewItem.hdPosterURL = ValidStr(tmp[0]@url)\n\t\t\t\telse\n\t\t\t\t\ttmp = xml.channel.GetNamedElements(\"itunes:image\") ' less-than-standard itunes image tag\n\t\t\t\t\tif tmp.Count() > 0\n\t\t\t\t\t\tnewItem.sdPosterURL = ValidStr(tmp[0]@href)\n\t\t\t\t\t\tnewItem.hdPosterURL = ValidStr(tmp[0]@href)\n\t\t\t\t\tend if\n\t\t\t\tend if\n\t\t\tend if\n\t\t\t\t\n\t\t\t' categories\n\t\t\ttmp = item.GetNamedElements(\"media:category\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tfor each category in tmp\n\t\t\t\t\tnewItem.categories.Push(ValidStr(category.GetText()))\n\t\t\t\tnext\n\t\t\tend if\n\t\t\t\t\n\t\t\t' acrtors and director\n\t\t\ttmp = item.GetNamedElements(\"media:credit\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tfor each credit in tmp\n\t\t\t\t\tif ValidStr(credit@role) = \"actor\"\n\t\t\t\t\t\tnewItem.actors.Push(ValidStr(credit.GetText()))\n\t\t\t\t\telse if ValidStr(credit@role) = \"director\"\n\t\t\t\t\t\tnewItem.director = ValidStr(credit.GetText())\n\t\t\t\t\tend if\n\t\t\t\tnext\n\t\t\tend if\n\t\t\t\t\n\t\t\t' rating\n\t\t\ttmp = item.GetNamedElements(\"media:rating\")\n\t\t\tif tmp.Count() > 0\n\t\t\t\tnewItem.rating = ValidStr(tmp[0].GetText())\n\t\t\tend if\n\n\t\t\t' release date\n\t\t\tnewItem.releaseDate = ValidStr(item.pubdate.GetText())\n\t\t\t\n\t\t\t' media:content can be a child of or of \n\t\t\tcontentItems = item.GetNamedElements(\"media:content\")\n\t\t\tif contentItems.Count() = 0\n\t\t\t\ttmp = item.GetNamedElements(\"media:group\")\n\t\t\t\tif tmp.Count() > 0\n\t\t\t\t\tcontentItems = tmp.GetNamedElements(\"media:content\")\n\t\t\t\tend if\n\t\t\tend if\n\t\t\t\n\t\t\tif contentItems.Count() > 0\n\t\t\t\tfor each content in contentItems\n\t\t\t\t\tif ValidStr(content@url) <> \"\"\n\t\t\t\t\t\tnewStream = {\n\t\t\t\t\t\t\turl:\t\t\tValidStr(content@url)\n\t\t\t\t\t\t\tbitrate:\tStrToI(ValidStr(content@bitrate))\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t' use the content's height attribute to determine HD-ness\n\t\t\t\t\t\tif StrToI(ValidStr(content@height)) > 720\n\t\t\t\t\t\t\tnewStream.quality = true\n\t\t\t\t\t\t\tnewItem.HDBranded = true\n\t\t\t\t\t\t\tnewItem.isHD = true\n\t\t\t\t\t\t\tnewItem.fullHD = true\n\t\t\t\t\t\telse if StrToI(ValidStr(content@height)) > 480\n\t\t\t\t\t\t\tnewStream.quality = true\n\t\t\t\t\t\t\tnewItem.HDBranded = true\n\t\t\t\t\t\t\tnewItem.isHD = true\n\t\t\t\t\t\tend if\n\n\t\t\t\t\t\tnewItem.streams.push(newStream)\n\t\t\t\t\tend if\n\t\t\t\tnext\n\t\t\t\t\n\t\t\t\tlength = StrToI(ValidStr(contentItems[0]@duration))\n\t\t\t\tif newItem.length = invalid and length > 0\n\t\t\t\t\tnewItem.length = length\n\t\t\t\tend if\n\n\t\t\t\t'PrintAA(newItem)\n\t\t\t\tresult.Push(newItem)\n\t\t\telse if item.enclosure.Count() > 0\n\t\t\t\t' we didn't find any media:content tags, try the enclosure tag\n\t\t\t\tnewStream = {\n\t\t\t\t\turl:\tValidStr(item.enclosure@url)\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnewItem.streams.Push(newStream)\n\n\t\t\t\t'PrintAA(newItem)\n\t\t\t\tresult.Push(newItem)\n\t\t\tend if\n\t\tnext\n\tend if\n\t\n\treturn result\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"72bd14d1311da575b51bb9e193445b152228458a","subject":"Update stream url","message":"Update stream url\n\nUse the new stream url","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/Main.brs","new_file":"source\/Main.brs","new_contents":"sub Main()\n\tapp = CreateObject( \"roAppManager\" )\n\tapp.setTheme( LoadTheme() )\n\tcategories = LoadConfig()\n\n\tCreatePosterScreen(categories).showScreen()\nend sub\n\nfunction LoadTheme()\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Background_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Background_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"20\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"40\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"20\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( backgroundColor )\n\ttheme.breadcrumbDelimiter = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextRight = ValidStr( backgroundColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\treturn theme\nend function\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\t\tShowMessageDialog( \"Cannot Connect\", \"Cannot connect to server. Please check your connection and try again.\" )\n\tend if\n\n\tresult.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.png\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/jblive.videocdn.scaleengine.net\/jb-live\/play\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"SD\"]\n\t\tstreambitrates:\t[0]\n\t\tcategories:\t\t[]\n\t}\n\t\n\tresult.audio = {\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Audio Stream\"\n\t\tshortDescriptionLine1:\t\"Audio Stream\"\n\t\tshortDescriptionLine2:\t\"Listen To JB Radio Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/jbradio.out.airtime.pro:8000\/jbradio_a\"]\n\t\tstreamformat:\t\t\"mp3\"\n\t\tstreambitrates:\t[0]\n\t\tstreamqualities:\t[\"SD\"]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/settings.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/settings.png\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","old_contents":"sub Main()\n\tapp = CreateObject( \"roAppManager\" )\n\tapp.setTheme( LoadTheme() )\n\tcategories = LoadConfig()\n\n\tCreatePosterScreen(categories).showScreen()\nend sub\n\nfunction LoadTheme()\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Background_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Background_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"20\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"40\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"20\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( backgroundColor )\n\ttheme.breadcrumbDelimiter = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextRight = ValidStr( backgroundColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\treturn theme\nend function\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\t\tShowMessageDialog( \"Cannot Connect\", \"Cannot connect to server. Please check your connection and try again.\" )\n\tend if\n\n\tresult.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.png\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"SD\"]\n\t\tstreambitrates:\t[0]\n\t\tcategories:\t\t[]\n\t}\n\t\n\tresult.audio = {\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Audio Stream\"\n\t\tshortDescriptionLine1:\t\"Audio Stream\"\n\t\tshortDescriptionLine2:\t\"Listen To JB Radio Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/jbradio.out.airtime.pro:8000\/jbradio_a\"]\n\t\tstreamformat:\t\t\"mp3\"\n\t\tstreambitrates:\t[0]\n\t\tstreamqualities:\t[\"SD\"]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/settings.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/settings.png\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"fb8fade89ba6529668f62e821a5efd3e02a33f43","subject":"Removed deliberately broken test. Travis CI should be fully working now.","message":"Removed deliberately broken test. Travis CI should be fully working now.\n","repos":"imbenjamin\/brsHamcrest","old_file":"tests\/source\/brsHamcrest\/Test_brsHamcrest_Helpers.brs","new_file":"tests\/source\/brsHamcrest\/Test_brsHamcrest_Helpers.brs","new_contents":"' #################################################################\n' ### brsHamcrest ### github.com\/imbenjamin\/brsHamcrest ###\n' #################################################################\n' Copyright (c) 2016 Benjamin Hill\n\n' SETUP \/ TEARDOWN\n\n'Set up the unit tests\n'\n'@return {Object} The test helper\nfunction setup_brsHamcrest_Helpers () as Object\n test = {\n knownArray: []\n knownString: \"foo\"\n ifEnum: \"ifEnum\"\n unknownInterface: \"ifFoo\"\n }\n return test\nend function\n\n'Clean up after running a unit test\nfunction teardown_brsHamcrest_Helpers () as Void\n\nend function\n\n' UNIT TESTS\n\n' HasInterface()\nsub test_HasInterface_true (t as Object)\n test = setup_brsHamcrest_Helpers()\n\n 'GIVEN'\n testObj = test.knownArray\n testInterface = test.ifEnum\n\n 'WHEN'\n result = HasInterface(testObj, testInterface)\n\n 'THEN'\n t.assertTrue(result)\n\n teardown_brsHamcrest_Helpers()\nend sub\n\n\nsub test_HasInterface_false (t as Object)\n test = setup_brsHamcrest_Helpers()\n\n 'GIVEN'\n testObj = test.knownString\n testInterface = test.ifEnum\n\n 'WHEN'\n result = HasInterface(testObj, testInterface)\n\n 'THEN'\n t.assertFalse(result)\n\n teardown_brsHamcrest_Helpers()\nend sub\n\n\nsub test_HasInterface_false_unknownInterface (t as Object)\n test = setup_brsHamcrest_Helpers()\n\n 'GIVEN'\n testObj = test.knownString\n testInterface = test.unknownInterface\n\n 'WHEN'\n result = HasInterface(testObj, testInterface)\n\n 'THEN'\n t.assertFalse(result)\n\n teardown_brsHamcrest_Helpers()\nend sub\n","old_contents":"sub test_broken (t as Object)\n t.assertTrue(False)\nend sub\n\n' #################################################################\n' ### brsHamcrest ### github.com\/imbenjamin\/brsHamcrest ###\n' #################################################################\n' Copyright (c) 2016 Benjamin Hill\n\n' SETUP \/ TEARDOWN\n\n'Set up the unit tests\n'\n'@return {Object} The test helper\nfunction setup_brsHamcrest_Helpers () as Object\n test = {\n knownArray: []\n knownString: \"foo\"\n ifEnum: \"ifEnum\"\n unknownInterface: \"ifFoo\"\n }\n return test\nend function\n\n'Clean up after running a unit test\nfunction teardown_brsHamcrest_Helpers () as Void\n\nend function\n\n' UNIT TESTS\n\n' HasInterface()\nsub test_HasInterface_true (t as Object)\n test = setup_brsHamcrest_Helpers()\n\n 'GIVEN'\n testObj = test.knownArray\n testInterface = test.ifEnum\n\n 'WHEN'\n result = HasInterface(testObj, testInterface)\n\n 'THEN'\n t.assertTrue(result)\n\n teardown_brsHamcrest_Helpers()\nend sub\n\n\nsub test_HasInterface_false (t as Object)\n test = setup_brsHamcrest_Helpers()\n\n 'GIVEN'\n testObj = test.knownString\n testInterface = test.ifEnum\n\n 'WHEN'\n result = HasInterface(testObj, testInterface)\n\n 'THEN'\n t.assertFalse(result)\n\n teardown_brsHamcrest_Helpers()\nend sub\n\n\nsub test_HasInterface_false_unknownInterface (t as Object)\n test = setup_brsHamcrest_Helpers()\n\n 'GIVEN'\n testObj = test.knownString\n testInterface = test.unknownInterface\n\n 'WHEN'\n result = HasInterface(testObj, testInterface)\n\n 'THEN'\n t.assertFalse(result)\n\n teardown_brsHamcrest_Helpers()\nend sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"1b0e1dd630fe3e4d5d27d34386af329ba1adb2c1","subject":"Fixed crash for associative arrays that contain properties with n\u2026 (#49)","message":"Fixed crash for associative arrays that contain properties with n\u2026 (#49)\n\nCo-authored-by: Gareth Jones ","repos":"imbenjamin\/brsHamcrest","old_file":"source\/brsHamcrest_Matchers\/brsHamcrest_CoreMatchers.brs","new_file":"source\/brsHamcrest_Matchers\/brsHamcrest_CoreMatchers.brs","new_contents":"' #################################################################\n' ### brsHamcrest ### github.com\/imbenjamin\/brsHamcrest ###\n' #################################################################\n\n\n'Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.\n'If passed an array, then is() acts as a shortcut to allOf()\n'\n'Example:\n'assertThat(foo, is(aString()))\n'assertThat(foo, is([aString(), endsWithString(\"bar\")]))\n'\n'@param matcher {Object} A Matcher\n'@return {Object} A Matcher\nfunction is (matcher as Object) as Object\n if type(matcher) = \"roArray\" then return allOf(matcher)\n return matcher\nend function\n\n\n'A matcher that has the correct structure, but returns true to anything, for the purposes of integration with frameworks\n'\n'Example:\n'assertThat(foo, anything())\n'\n'@return {Object} A Matcher\nfunction anything () as Object\n matcher = BaseMatcher()\n\n matcher.append({\n doMatch: function (target as Dynamic) as Boolean\n return true\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.\n'If passed an array, isNot() acts as a shortcut to noneOf()\n'\n'Example:\n'assertThat(foo, isNot(aString()))\n'assertThat(foo, isNot([aString(), aNumber()]))\n'\n'@param matcher {Object} A Matcher\n'@return {Object} A Matcher\nfunction isNot (matcher as Object) as Object\n if type(matcher) = \"roArray\" then return noneOf(matcher)\n\n retVal = Invalid\n if (matcher.CLASS_TYPE = \"Matcher\")\n newMatcher = matcher\n\n newMatcher.doMatchOrig = newMatcher.doMatch\n newMatcher.doMatch = function (target as Dynamic) as Boolean\n return (NOT m.doMatchOrig(target))\n end function\n\n retVal = newMatcher\n else\n HamcrestError(\"Type Mismatch: Expected a Matcher and encountered a \"+type(matcher))\n end if\n return retVal\nend function\n\n\n'Creates a matcher that checks against array of matchers, only passing if all matchers are positive.\n'\n'Example:\n'assertThat(foo, is(allOf([aString(), inCollection(bar)])))\n'\n'@param arrayOfMatchers {Array} An array of Matchers\n'@return {Object} A Matcher\nfunction allOf (arrayOfMatchers as Object) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n arrayOfMatchers: arrayOfMatchers\n\n doMatch: function (target as Dynamic) as Boolean\n failure = false\n if (type(m.arrayOfMatchers) = \"roArray\")\n for each matcherObj in m.arrayOfMatchers\n if (matcherObj.CLASS_TYPE = \"Matcher\")\n failure = (NOT matcherObj.doMatch(target))\n else\n HamcrestError(\"Type Mismatch: Expected a Matcher and encountered a \"+type(matcherObj))\n end if\n end for\n else\n HamcrestError(\"Type Mismatch: Expected an Array and encountered a \"+type(m.arrayOfMatchers))\n end if\n return (NOT failure)\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that checks against array of matchers, passing if any of the matchers are positive.\n'\n'Example:\n'assertThat(foo, is(anyOf([aString(), inCollection(bar)])))\n'\n'@param arrayOfMatchers {Array} An array of Matchers\n'@return {Object} A Matcher\nfunction anyOf (arrayOfMatchers as Object) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n arrayOfMatchers: arrayOfMatchers\n\n doMatch: function (target as Dynamic) as Boolean\n if (type(m.arrayOfMatchers) = \"roArray\")\n for each matcherObj in m.arrayOfMatchers\n if (matcherObj.doMatch(target))\n return true\n end if\n end for\n else\n HamcrestError(\"Type Mismatch: Expected an Array and encountered a \"+type(m.arrayOfMatchers))\n end if\n\n return false\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that checks against array of matchers, only passing if none of the matchers are positive.\n'\n'Example:\n'assertThat(foo, is(noneOf([aString(), inCollection(bar)])))\n'\n'@param arrayOfMatchers {Array} An array of Matchers\n'@return {Object} A Matcher\nfunction noneOf(arrayOfMatchers as Object) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n arrayOfMatchers: arrayOfMatchers\n\n doMatch: function (target as Dynamic) as Boolean\n if (type(m.arrayOfMatchers) = \"roArray\")\n for each matcherObj in m.arrayOfMatchers\n if (matcherObj.doMatch(target))\n return false\n end if\n end for\n else\n HamcrestError(\"Type Mismatch: Expected an Array and encountered a \"+type(m.arrayOfMatchers))\n end if\n\n return true\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that does an exact match, only passing if an exact match of both value and type are made.\n'\n'Example:\n'assertThat(foo, is(equalTo(bar)))\n'\n'@param comparison - any value\n'@return {Object} A Matcher\nfunction equalTo(comparison as Dynamic) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n comparison: comparison\n\n doMatch: function (target as Dynamic) as Boolean\n targetType = m._normaliseType(type(target))\n comparisonType = m._normaliseType(type(m.comparison))\n\n if (targetType = comparisonType)\n if (targetType = \"roArray\")\n if (target.count() = m.comparison.count())\n for i=0 to target.count()-1 Step 1\n if (equalTo(m.comparison[i]).doMatch(target[i]) = false) return false\n end for\n else\n return false\n end if\n else if (targetType = \"roAssociativeArray\")\n if (m._getAssocArrayPropertyCount(target) = m._getAssocArrayPropertyCount(m.comparison))\n for each key in target\n if (equalTo(m.comparison.LookupCI(key)).doMatch(target.LookupCI(key)) = false) return false\n end for\n else\n return false\n end if\n\n else if (targetType = \"roBoolean\" OR targetType = \"roDouble\" OR targetType = \"roFloat\" OR targetType = \"roInteger\" OR targetType = \"roLongInteger\" OR targetType = \"roString\" OR targetType = \"roInvalid\")\n return (target = m.comparison)\n\n else if (targetType = \"roFunction\")\n return (target.toStr() = m.comparison.toStr())\n\n else\n return (targetType = comparisonType)\n end if\n else\n return false\n end if\n\n return true\n end function\n\n ' a limitation of BS is that an object can sometimes contain properties with names that happen to match the getters that are used\n ' to deduce the size of those objects (i.e. count, items, keys), and BS can't tell them apart which causes an exception.\n ' so here we avoid that issue by brute-force manually counting each property instead.\n _getAssocArrayPropertyCount: function (obj as Object) as Integer\n i = 0\n for each key in obj\n i++\n end for\n return i\n end function\n\n _normaliseType: function (typeIn as String) as String\n\n types = {\n \"roArray\": \"roArray\"\n \"roAssociativeArray\": \"roAssociativeArray\"\n \"roBoolean\": \"roBoolean\"\n \"Boolean\": \"roBoolean\"\n \"roDouble\": \"roDouble\"\n \"Double\": \"roDouble\"\n \"roIntrinsicDouble\": \"roDouble\"\n \"roFloat\": \"roFloat\"\n \"Float\": \"roFloat\"\n \"roFunction\": \"roFunction\"\n \"Function\": \"roFunction\"\n \"roInteger\": \"roInteger\"\n \"roInt\": \"roInteger\"\n \"Integer\": \"roInteger\"\n \"roLongInteger\": \"roLongInteger\"\n \"LongInteger\": \"roLongInteger\"\n \"roString\": \"roString\"\n \"String\": \"roString\"\n \"roInvalid\": \"roInvalid\"\n \"Invalid\": \"roInvalid\"\n }\n\n if (types.DoesExist(typeIn))\n typeOut = types[typeIn]\n else\n HamcrestError(\"Unsupported type cannot be normalised\")\n typeOut = \"\"\n end if\n\n return typeOut\n end function\n })\n\n return matcher\nend function\n","old_contents":"' #################################################################\n' ### brsHamcrest ### github.com\/imbenjamin\/brsHamcrest ###\n' #################################################################\n\n\n'Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.\n'If passed an array, then is() acts as a shortcut to allOf()\n'\n'Example:\n'assertThat(foo, is(aString()))\n'assertThat(foo, is([aString(), endsWithString(\"bar\")]))\n'\n'@param matcher {Object} A Matcher\n'@return {Object} A Matcher\nfunction is (matcher as Object) as Object\n if type(matcher) = \"roArray\" then return allOf(matcher)\n return matcher\nend function\n\n\n'A matcher that has the correct structure, but returns true to anything, for the purposes of integration with frameworks\n'\n'Example:\n'assertThat(foo, anything())\n'\n'@return {Object} A Matcher\nfunction anything () as Object\n matcher = BaseMatcher()\n\n matcher.append({\n doMatch: function (target as Dynamic) as Boolean\n return true\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.\n'If passed an array, isNot() acts as a shortcut to noneOf()\n'\n'Example:\n'assertThat(foo, isNot(aString()))\n'assertThat(foo, isNot([aString(), aNumber()]))\n'\n'@param matcher {Object} A Matcher\n'@return {Object} A Matcher\nfunction isNot (matcher as Object) as Object\n if type(matcher) = \"roArray\" then return noneOf(matcher)\n\n retVal = Invalid\n if (matcher.CLASS_TYPE = \"Matcher\")\n newMatcher = matcher\n\n newMatcher.doMatchOrig = newMatcher.doMatch\n newMatcher.doMatch = function (target as Dynamic) as Boolean\n return (NOT m.doMatchOrig(target))\n end function\n\n retVal = newMatcher\n else\n HamcrestError(\"Type Mismatch: Expected a Matcher and encountered a \"+type(matcher))\n end if\n return retVal\nend function\n\n\n'Creates a matcher that checks against array of matchers, only passing if all matchers are positive.\n'\n'Example:\n'assertThat(foo, is(allOf([aString(), inCollection(bar)])))\n'\n'@param arrayOfMatchers {Array} An array of Matchers\n'@return {Object} A Matcher\nfunction allOf (arrayOfMatchers as Object) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n arrayOfMatchers: arrayOfMatchers\n\n doMatch: function (target as Dynamic) as Boolean\n failure = false\n if (type(m.arrayOfMatchers) = \"roArray\")\n for each matcherObj in m.arrayOfMatchers\n if (matcherObj.CLASS_TYPE = \"Matcher\")\n failure = (NOT matcherObj.doMatch(target))\n else\n HamcrestError(\"Type Mismatch: Expected a Matcher and encountered a \"+type(matcherObj))\n end if\n end for\n else\n HamcrestError(\"Type Mismatch: Expected an Array and encountered a \"+type(m.arrayOfMatchers))\n end if\n return (NOT failure)\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that checks against array of matchers, passing if any of the matchers are positive.\n'\n'Example:\n'assertThat(foo, is(anyOf([aString(), inCollection(bar)])))\n'\n'@param arrayOfMatchers {Array} An array of Matchers\n'@return {Object} A Matcher\nfunction anyOf (arrayOfMatchers as Object) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n arrayOfMatchers: arrayOfMatchers\n\n doMatch: function (target as Dynamic) as Boolean\n if (type(m.arrayOfMatchers) = \"roArray\")\n for each matcherObj in m.arrayOfMatchers\n if (matcherObj.doMatch(target))\n return true\n end if\n end for\n else\n HamcrestError(\"Type Mismatch: Expected an Array and encountered a \"+type(m.arrayOfMatchers))\n end if\n\n return false\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that checks against array of matchers, only passing if none of the matchers are positive.\n'\n'Example:\n'assertThat(foo, is(noneOf([aString(), inCollection(bar)])))\n'\n'@param arrayOfMatchers {Array} An array of Matchers\n'@return {Object} A Matcher\nfunction noneOf(arrayOfMatchers as Object) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n arrayOfMatchers: arrayOfMatchers\n\n doMatch: function (target as Dynamic) as Boolean\n if (type(m.arrayOfMatchers) = \"roArray\")\n for each matcherObj in m.arrayOfMatchers\n if (matcherObj.doMatch(target))\n return false\n end if\n end for\n else\n HamcrestError(\"Type Mismatch: Expected an Array and encountered a \"+type(m.arrayOfMatchers))\n end if\n\n return true\n end function\n })\n\n return matcher\nend function\n\n\n'Creates a matcher that does an exact match, only passing if an exact match of both value and type are made.\n'\n'Example:\n'assertThat(foo, is(equalTo(bar)))\n'\n'@param comparison - any value\n'@return {Object} A Matcher\nfunction equalTo(comparison as Dynamic) as Object\n matcher = BaseMatcher()\n\n matcher.append({\n comparison: comparison\n\n doMatch: function (target as Dynamic) as Boolean\n targetType = m._normaliseType(type(target))\n comparisonType = m._normaliseType(type(m.comparison))\n\n if (targetType = comparisonType)\n if (targetType = \"roArray\")\n if (target.count() = m.comparison.count())\n for i=0 to target.count()-1 Step 1\n if (equalTo(m.comparison[i]).doMatch(target[i]) = false) return false\n end for\n else\n return false\n end if\n else if (targetType = \"roAssociativeArray\")\n if (target.Count() = m.comparison.Count())\n for each key in target\n if (equalTo(m.comparison.LookupCI(key)).doMatch(target.LookupCI(key)) = false) return false\n end for\n else\n return false\n end if\n\n else if (targetType = \"roBoolean\" OR targetType = \"roDouble\" OR targetType = \"roFloat\" OR targetType = \"roInteger\" OR targetType = \"roLongInteger\" OR targetType = \"roString\" OR targetType = \"roInvalid\")\n return (target = m.comparison)\n\n else if (targetType = \"roFunction\")\n return (target.toStr() = m.comparison.toStr())\n\n else\n return (targetType = comparisonType)\n end if\n else\n return false\n end if\n\n return true\n end function\n\n _normaliseType: function (typeIn as String) as String\n\n types = {\n \"roArray\": \"roArray\"\n \"roAssociativeArray\": \"roAssociativeArray\"\n \"roBoolean\": \"roBoolean\"\n \"Boolean\": \"roBoolean\"\n \"roDouble\": \"roDouble\"\n \"Double\": \"roDouble\"\n \"roIntrinsicDouble\": \"roDouble\"\n \"roFloat\": \"roFloat\"\n \"Float\": \"roFloat\"\n \"roFunction\": \"roFunction\"\n \"Function\": \"roFunction\"\n \"roInteger\": \"roInteger\"\n \"roInt\": \"roInteger\"\n \"Integer\": \"roInteger\"\n \"roLongInteger\": \"roLongInteger\"\n \"LongInteger\": \"roLongInteger\"\n \"roString\": \"roString\"\n \"String\": \"roString\"\n \"roInvalid\": \"roInvalid\"\n \"Invalid\": \"roInvalid\"\n }\n\n if (types.DoesExist(typeIn))\n typeOut = types[typeIn]\n else\n HamcrestError(\"Unsupported type cannot be normalised\")\n typeOut = \"\"\n end if\n\n return typeOut\n end function\n })\n\n return matcher\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"109fa0187c7c095b7ccf97a2ea4fce824ad6f681","subject":"EE-633 Live only shows play, other screens have resume and start from beginning","message":"EE-633 Live only shows play, other screens have resume and start from beginning\n","repos":"NewSpring\/Public-Roku","old_file":"apps\/source\/newspring-public\/source\/appDetailScreen.brs","new_file":"apps\/source\/newspring-public\/source\/appDetailScreen.brs","new_contents":"'**********************************************************\n'** Video Player Example Application - Detail Screen\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'**********************************************************\n\nFunction preShowDetailScreen(breadA=invalid, breadB=invalid) As Object\n port=CreateObject(\"roMessagePort\")\n screen = CreateObject(\"roSpringboardScreen\")\n screen.SetDescriptionStyle(\"movie\")\n screen.SetMessagePort(port)\n if breadA<>invalid and breadB<>invalid then\n screen.SetBreadcrumbText(breadA, breadB)\n end if\n\n screen.setAdDisplayMode(\"flat-square\")\n screen.SetStaticRatingEnabled(FALSE)\n \n return screen\n\nEnd Function\n\n'***************************************************************\n'** The show detail screen (springboard) is where the user sees\n'** the details for a show and is allowed to select a show to\n'** begin playback. This is the main event loop for that screen\n'** and where we spend our time waiting until the user presses a\n'** button and then we decide how best to handle the event.\n'***************************************************************\nFunction showDetailScreen(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n print \"showDetailScreen\"\n\n if validateParam(screen, \"roSpringboardScreen\", \"showDetailScreen\") = false return -1\n if validateParam(showList, \"roArray\", \"showDetailScreen\") = false return -1\n\n refreshShowDetail(screen, showList, showIndex)\n\n 'remote key id's for left\/right navigation\n remoteKeyLeft = 4\n remoteKeyRight = 5\n\n while true\n msg = wait(0, screen.GetMessagePort())\n\n if type(msg) = \"roSpringboardScreenEvent\" then\n if msg.isScreenClosed()\n print \"Screen closed\"\n exit while\n else if msg.isRemoteKeyPressed()\n print \"Remote key pressed\"\n if msg.GetIndex() = remoteKeyLeft then\n showIndex = getPrevShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n else if msg.GetIndex() = remoteKeyRight\n showIndex = getNextShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n endif\n else if msg.isButtonPressed()\n print \"ButtonPressed\"\n print \"ButtonPressed\"\n if msg.GetIndex() = 1\n PlayStart = RegRead(showList[showIndex].ContentId)\n if PlayStart <> invalid then\n showList[showIndex].PlayStart = PlayStart.ToInt()\n endif\n if showList[showIndex].LiveStream = \"true\" then\n showList[showIndex].PlayStart = 1800\n else\n showList[showIndex].PlayStart = 0\n endif\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 2\n if showList[showIndex].LiveStream = \"true\" then\n showList[showIndex].PlayStart = 1800\n else\n showList[showIndex].PlayStart = 0\n endif\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 3\n endif\n print \"Button pressed: \"; msg.GetIndex(); \" \" msg.GetData()\n end if\n else\n print \"Unexpected message class: \"; type(msg)\n end if\n end while\n\n return showIndex\n\nEnd Function\n\n'**************************************************************\n'** Refresh the contents of the show detail screen. This may be\n'** required on initial entry to the screen or as the user moves\n'** left\/right on the springboard. When the user is on the\n'** springboard, we generally let them press left\/right arrow keys\n'** to navigate to the previous\/next show in a circular manner.\n'** When leaving the screen, the should be positioned on the\n'** corresponding item in the poster screen matching the current show\n'**************************************************************\nFunction refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n if validateParam(screen, \"roSpringboardScreen\", \"refreshShowDetail\") = false return -1\n if validateParam(showList, \"roArray\", \"refreshShowDetail\") = false return -1\n\n show = showList[showIndex]\n\n 'Uncomment this statement to dump the details for each show\n 'PrintAA(show)\n\n screen.ClearButtons()\n \n if showList[showIndex].LiveStream = \"true\" then\n screen.AddButton(1, \"Play\")\n else\n if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then\n screen.AddButton(1, \"Resume playing\")\n screen.AddButton(2, \"Play from beginning\")\n else\n screen.addbutton(2,\"Play\")\n end if\n endif\n \n screen.SetContent(show)\n\n globals = getGlobalAA()\n\n ' set some analytics\n globals.analytics = Analytics()\n\n showTitle = show.Series + \" - \" + show.Title\n\n globals.analytics.trackEvent(\"pageview\", show.ItemUrl, showTitle, \"\", \"\", \"\")\n\n screen.Show()\n\nEnd Function\n\n'********************************************************\n'** Get the next item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getNextShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getNextShow\") = false return -1\n\n nextIndex = showIndex + 1\n if nextIndex >= showList.Count() or nextIndex < 0 then\n nextIndex = 0\n end if\n\n show = showList[nextIndex]\n if validateParam(show, \"roAssociativeArray\", \"getNextShow\") = false return -1\n\n return nextIndex\nEnd Function\n\n\n'********************************************************\n'** Get the previous item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getPrevShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getPrevShow\") = false return -1\n\n prevIndex = showIndex - 1\n if prevIndex < 0 or prevIndex >= showList.Count() then\n if showList.Count() > 0 then\n prevIndex = showList.Count() - 1\n else\n return -1\n end if\n end if\n\n show = showList[prevIndex]\n if validateParam(show, \"roAssociativeArray\", \"getPrevShow\") = false return -1\n\n return prevIndex\nEnd Function\n","old_contents":"'**********************************************************\n'** Video Player Example Application - Detail Screen\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'**********************************************************\n\nFunction preShowDetailScreen(breadA=invalid, breadB=invalid) As Object\n port=CreateObject(\"roMessagePort\")\n screen = CreateObject(\"roSpringboardScreen\")\n screen.SetDescriptionStyle(\"movie\")\n screen.SetMessagePort(port)\n if breadA<>invalid and breadB<>invalid then\n screen.SetBreadcrumbText(breadA, breadB)\n end if\n\n screen.setAdDisplayMode(\"flat-square\")\n screen.SetStaticRatingEnabled(FALSE)\n \n return screen\n\nEnd Function\n\n'***************************************************************\n'** The show detail screen (springboard) is where the user sees\n'** the details for a show and is allowed to select a show to\n'** begin playback. This is the main event loop for that screen\n'** and where we spend our time waiting until the user presses a\n'** button and then we decide how best to handle the event.\n'***************************************************************\nFunction showDetailScreen(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n print \"showDetailScreen\"\n\n if validateParam(screen, \"roSpringboardScreen\", \"showDetailScreen\") = false return -1\n if validateParam(showList, \"roArray\", \"showDetailScreen\") = false return -1\n\n refreshShowDetail(screen, showList, showIndex)\n\n 'remote key id's for left\/right navigation\n remoteKeyLeft = 4\n remoteKeyRight = 5\n\n while true\n msg = wait(0, screen.GetMessagePort())\n\n if type(msg) = \"roSpringboardScreenEvent\" then\n if msg.isScreenClosed()\n print \"Screen closed\"\n exit while\n else if msg.isRemoteKeyPressed()\n print \"Remote key pressed\"\n if msg.GetIndex() = remoteKeyLeft then\n showIndex = getPrevShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n else if msg.GetIndex() = remoteKeyRight\n showIndex = getNextShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n endif\n else if msg.isButtonPressed()\n print \"ButtonPressed\"\n print \"ButtonPressed\"\n if msg.GetIndex() = 1\n PlayStart = RegRead(showList[showIndex].ContentId)\n if PlayStart <> invalid then\n showList[showIndex].PlayStart = PlayStart.ToInt()\n endif\n if showList[showIndex].LiveStream = \"true\" then\n showList[showIndex].PlayStart = 1800\n else\n showList[showIndex].PlayStart = 0\n endif\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 2\n if showList[showIndex].LiveStream = \"true\" then\n showList[showIndex].PlayStart = 1800\n else\n showList[showIndex].PlayStart = 0\n endif\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 3\n endif\n print \"Button pressed: \"; msg.GetIndex(); \" \" msg.GetData()\n end if\n else\n print \"Unexpected message class: \"; type(msg)\n end if\n end while\n\n return showIndex\n\nEnd Function\n\n'**************************************************************\n'** Refresh the contents of the show detail screen. This may be\n'** required on initial entry to the screen or as the user moves\n'** left\/right on the springboard. When the user is on the\n'** springboard, we generally let them press left\/right arrow keys\n'** to navigate to the previous\/next show in a circular manner.\n'** When leaving the screen, the should be positioned on the\n'** corresponding item in the poster screen matching the current show\n'**************************************************************\nFunction refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n if validateParam(screen, \"roSpringboardScreen\", \"refreshShowDetail\") = false return -1\n if validateParam(showList, \"roArray\", \"refreshShowDetail\") = false return -1\n\n show = showList[showIndex]\n\n 'Uncomment this statement to dump the details for each show\n 'PrintAA(show)\n\n screen.ClearButtons()\n screen.AddButton(1, \"Play\")\n \n screen.SetContent(show)\n\n globals = getGlobalAA()\n\n ' set some analytics\n globals.analytics = Analytics()\n\n showTitle = show.Series + \" - \" + show.Title\n\n globals.analytics.trackEvent(\"pageview\", show.ItemUrl, showTitle, \"\", \"\", \"\")\n\n screen.Show()\n\nEnd Function\n\n'********************************************************\n'** Get the next item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getNextShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getNextShow\") = false return -1\n\n nextIndex = showIndex + 1\n if nextIndex >= showList.Count() or nextIndex < 0 then\n nextIndex = 0\n end if\n\n show = showList[nextIndex]\n if validateParam(show, \"roAssociativeArray\", \"getNextShow\") = false return -1\n\n return nextIndex\nEnd Function\n\n\n'********************************************************\n'** Get the previous item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getPrevShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getPrevShow\") = false return -1\n\n prevIndex = showIndex - 1\n if prevIndex < 0 or prevIndex >= showList.Count() then\n if showList.Count() > 0 then\n prevIndex = showList.Count() - 1\n else\n return -1\n end if\n end if\n\n show = showList[prevIndex]\n if validateParam(show, \"roAssociativeArray\", \"getPrevShow\") = false return -1\n\n return prevIndex\nEnd Function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"5d5143f6e44df3156ec36d6c26c84c71840065fe","subject":"Convert SpringboardScreen to use WatchedStatusTracker.","message":"Convert SpringboardScreen to use WatchedStatusTracker.\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/screens\/SpringboardScreen.brs","new_file":"source\/screens\/SpringboardScreen.brs","new_contents":"function CreateSpringboardScreen(episodes, selectedEpisodeIndex)\n\tinstance = CreateObject(\"roAssociativeArray\")\n\t\n\tinstance.screen = CreateObject(\"roSpringboardScreen\")\n\tinstance.messagePort = CreateObject(\"roMessagePort\")\n\tinstance.screen.SetMessagePort(instance.messagePort)\n\tinstance.watchedStatusTracker = WatchedStatusTracker()\n\tinstance.lastMessage = invalid\n\tinstance.screen.SetStaticRatingEnabled(false)\n\n\tinstance.episodes = episodes\n\tinstance.selectedEpisodeIndex = selectedEpisodeIndex\n\n\tinstance.getSelectedEpisode = function()\n\t\treturn m.episodes[m.selectedEpisodeIndex]\n\tend function\n\n\tinstance.showScreen = function()\n\t\tm.showAds()\n\t\tm.showEpisode()\n\t\tm.waitForInput()\n\t\t\n\t\treturn m.selectedEpisodeIndex\n\tend function\n\n\tinstance.showAds = function()\n\t\t'Don't show ads, really\n\t\t'm.screen.setAdURL(sdAd, hdAd)\n\t\t'm.screen.setAdSelectable(false)\n\t\tx = 0 'Don't break the editor\n\tend function\n\n\tinstance.showEpisode = function()\n\t\tepisode = m.getSelectedEpisode()\n\t m.setButtons()\n\n\t m.swapPoster()\n\t m.screen.SetContent(episode)\n\t m.screen.Show()\n\t m.swapPoster()\n\tend function\n\n\tinstance.swapPoster = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\ttmp = episode.sdPosterURL\n\t\tif episode.sdPosterURL_hq <> invalid and episode.sdPosterURL_hq <> \"\"\n\t\t\tepisode.sdPosterURL = episode.sdPosterURL_hq\n\t\t\tepisode.sdPosterURL_hq = tmp\n\t\tend if\n\t\ttmp = episode.hdPosterURL\n\t\tif episode.hdPosterURL_hq <> invalid and episode.hdPosterURL_hq <> \"\"\n\t\t\tepisode.hdPosterURL = episode.hdPosterURL_hq\n\t\t\tepisode.hdPosterURL_hq = tmp\n\t\tend if\n\tend function\n\n\tinstance.setButtons = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\tm.screen.ClearButtons()\n\t\tif m.isPartiallyWatched() then\n\t\t\tm.screen.AddButton(1, \"Resume Playing\")\n\t\t\tm.screen.AddButton(2, \"Play from Beginning\")\n\t\telse\n\t\t\tm.screen.AddButton(2, \"Play\")\n\t\tend if\n\tend function\n\n\tinstance.isPartiallyWatched = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\treturn m.watchedStatusTracker.hasProgress(episode.title)\n\tend function\n\n\tinstance.waitForInput = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\twhile m.hasNonExitMessage()\n\t\t\tm.processMessage()\n\t\tend while\n\tend function\n\n\tinstance.processMessage = function()\n\t\tmsg = m.getLastMessage()\n\t\tif msg = invalid then\n\t\t\treturn invalid\n\t\tend if\n\t\t\n\t\tif msg.isButtonPressed()\n\t\t\tm.processButtonPress()\n\t\telse if msg.isRemoteKeyPressed()\n\t\t\tm.processRemoteKeyPress()\n\t\tend if\n\tend function\n\n\tinstance.getLastMessage = function()\n\t\treturn m.lastMessage\n\tend function\n\n\tinstance.processButtonPress = function()\n\t\tmsg = m.getLastMessage()\n\t\tepisode = m.getSelectedEpisode()\n\t\tif msg.GetIndex() = 1\n\t\t\tPlayStart = m.watchedStatusTracker.getProgress(episode.title)\n\t\t\tif PlayStart > 0 then\n\t\t\t\tepisode.PlayStart = PlayStart\n\t\t\tend if\n\t\telse if msg.GetIndex() = 2\n\t\t\tm.watchedStatusTracker.removeProgress(episode.title)\n\t\t\tepisode.PlayStart = 0\n\t\tend if\n\t\tShowVideoScreen(episode)\n\t\tm.setButtons()\n\t\tm.screen.Show()\n\tend function\n\n\tinstance.processRemoteKeyPress = function()\n\t\tmsg = m.getLastMessage()\n\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\tm.movePreviousEpisode()\n\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\tm.moveNextEpisode()\n\t\tend if\n\t\tm.showEpisode()\n\tend function\n\n\tinstance.hasNonExitMessage = function()\n\t\tm.lastMessage = wait(0, m.messagePort)\n\t\treturn m.lastMessage = invalid or not m.lastMessage.isScreenClosed()\n\tend function\n\n\tinstance.moveNextEpisode = function()\n\t\tif m.selectedEpisodeIndex = m.episodes.Count() - 1\n\t\t\tm.selectedEpisodeIndex = 0\n\t\telse\n\t\t\tm.selectedEpisodeIndex = m.selectedEpisodeIndex + 1\n\t\tend if\n\t\t\n\t\treturn m.selectedEpisodeIndex\n\tend function\n\t\n\tinstance.movePreviousEpisode = function()\n\t\tif m.selectedEpisodeIndex = 0\n\t\t\tm.selectedEpisodeIndex = m.episodes.Count() - 1\n\t\telse\n\t\t\tm.selectedEpisodeIndex = m.selectedEpisodeIndex - 1\n\t\tend if\n\t\t\n\t\treturn m.selectedEpisodeIndex\n\tend function\n\t\n\treturn instance\nend function\n","old_contents":"function CreateSpringboardScreen(episodes, selectedEpisodeIndex)\n\tinstance = CreateObject(\"roAssociativeArray\")\n\t\n\tinstance.screen = CreateObject(\"roSpringboardScreen\")\n\tinstance.messagePort = CreateObject(\"roMessagePort\")\n\tinstance.screen.SetMessagePort(instance.messagePort)\n\tinstance.lastMessage = invalid\n\tinstance.screen.SetStaticRatingEnabled(false)\n\n\tinstance.episodes = episodes\n\tinstance.selectedEpisodeIndex = selectedEpisodeIndex\n\n\tinstance.getSelectedEpisode = function()\n\t\treturn m.episodes[m.selectedEpisodeIndex]\n\tend function\n\n\tinstance.showScreen = function()\n\t\tm.showAds()\n\t\tm.showEpisode()\n\t\tm.waitForInput()\n\t\t\n\t\treturn m.selectedEpisodeIndex\n\tend function\n\n\tinstance.showAds = function()\n\t\t'Don't show ads, really\n\t\t'm.screen.setAdURL(sdAd, hdAd)\n\t\t'm.screen.setAdSelectable(false)\n\t\tx = 0 'Don't break the editor\n\tend function\n\n\tinstance.showEpisode = function()\n\t\tepisode = m.getSelectedEpisode()\n\t m.setButtons()\n\n\t m.swapPoster()\n\t m.screen.SetContent(episode)\n\t m.screen.Show()\n\t m.swapPoster()\n\tend function\n\n\tinstance.swapPoster = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\ttmp = episode.sdPosterURL\n\t\tif episode.sdPosterURL_hq <> invalid and episode.sdPosterURL_hq <> \"\"\n\t\t\tepisode.sdPosterURL = episode.sdPosterURL_hq\n\t\t\tepisode.sdPosterURL_hq = tmp\n\t\tend if\n\t\ttmp = episode.hdPosterURL\n\t\tif episode.hdPosterURL_hq <> invalid and episode.hdPosterURL_hq <> \"\"\n\t\t\tepisode.hdPosterURL = episode.hdPosterURL_hq\n\t\t\tepisode.hdPosterURL_hq = tmp\n\t\tend if\n\tend function\n\n\tinstance.setButtons = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\tm.screen.ClearButtons()\n\t\tif m.isPartiallyWatched() then\n\t\t\tm.screen.AddButton(1, \"Resume Playing\")\n\t\t\tm.screen.AddButton(2, \"Play from Beginning\")\n\t\telse\n\t\t\tm.screen.AddButton(2, \"Play\")\n\t\tend if\n\tend function\n\n\tinstance.isPartiallyWatched = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\treturn RegRead(episode.title) <> invalid and RegRead(episode.title).ToInt() >= 30\n\tend function\n\n\tinstance.waitForInput = function()\n\t\tepisode = m.getSelectedEpisode()\n\t\twhile m.hasNonExitMessage()\n\t\t\tm.processMessage()\n\t\tend while\n\tend function\n\n\tinstance.processMessage = function()\n\t\tmsg = m.getLastMessage()\n\t\tif msg = invalid then\n\t\t\treturn invalid\n\t\tend if\n\t\t\n\t\tif msg.isButtonPressed()\n\t\t\tm.processButtonPress()\n\t\telse if msg.isRemoteKeyPressed()\n\t\t\tm.processRemoteKeyPress()\n\t\tend if\n\tend function\n\n\tinstance.getLastMessage = function()\n\t\treturn m.lastMessage\n\tend function\n\n\tinstance.processButtonPress = function()\n\t\tmsg = m.getLastMessage()\n\t\tepisode = m.getSelectedEpisode()\n\t\tif msg.GetIndex() = 1\n\t\t\tPlayStart = RegRead(episode.title)\n\t\t\tif PlayStart <> invalid then\n\t\t\t\tepisode.PlayStart = PlayStart.ToInt()\n\t\t\tend if\n\t\telse if msg.GetIndex() = 2\n\t\t\tepisode.PlayStart = 0\n\t\tend if\n\t\tShowVideoScreen(episode)\n\t\tm.setButtons()\n\t\tm.screen.Show()\n\tend function\n\n\tinstance.processRemoteKeyPress = function()\n\t\tmsg = m.getLastMessage()\n\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\tm.movePreviousEpisode()\n\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\tm.moveNextEpisode()\n\t\tend if\n\t\tm.showEpisode()\n\tend function\n\n\tinstance.hasNonExitMessage = function()\n\t\tm.lastMessage = wait(0, m.messagePort)\n\t\treturn m.lastMessage = invalid or not m.lastMessage.isScreenClosed()\n\tend function\n\n\tinstance.moveNextEpisode = function()\n\t\tif m.selectedEpisodeIndex = m.episodes.Count() - 1\n\t\t\tm.selectedEpisodeIndex = 0\n\t\telse\n\t\t\tm.selectedEpisodeIndex = m.selectedEpisodeIndex + 1\n\t\tend if\n\t\t\n\t\treturn m.selectedEpisodeIndex\n\tend function\n\t\n\tinstance.movePreviousEpisode = function()\n\t\tif m.selectedEpisodeIndex = 0\n\t\t\tm.selectedEpisodeIndex = m.episodes.Count() - 1\n\t\telse\n\t\t\tm.selectedEpisodeIndex = m.selectedEpisodeIndex - 1\n\t\tend if\n\t\t\n\t\treturn m.selectedEpisodeIndex\n\tend function\n\t\n\treturn instance\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"1a96cf53fcd668d9bf391ea3d2cb3d140c1f6acc","subject":"Added information for live audio stream.","message":"Added information for live audio stream.\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/Main.brs","new_file":"source\/Main.brs","new_contents":"sub Main()\n\tLoadTheme()\n\tcategories = LoadConfig()\n\n\tif categories.Count() > 1\n\t\tShowPosterScreen( categories )\n\telse\n\t\tShowEpisodeScreen( categories[0] )\n\tend if\nend sub\n\nsub LoadTheme()\n\tapp = CreateObject( \"roAppManager\" )\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Slice_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Slice_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"40\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"40\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( primaryTextColor )\n\ttheme.breadcrumbDelimiter = ValidStr( primaryTextColor )\n\ttheme.breadcrumbTextRight = ValidStr( primaryTextColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\tapp.SetTheme( theme )\nend sub\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\tend if\n\n\t'result.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"SD\"]\n\t\tstreambitrates:\t[0]\n\t\tcategories:\t\t[]\n\t}\n\t\n\tresult.audio = {\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Audio Stream\"\n\t\tshortDescriptionLine1:\t\"Audio Stream\"\n\t\tshortDescriptionLine2:\t\"Listen To JB Radio Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/jbradio.out.airtime.pro:8000\/jbradio_a\"]\n\t\tstreamformat:\t\t\"mp3\"\n\t\tstreambitrates:\t[0]\n\t\tstreamqualities:\t[\"SD\"]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","old_contents":"sub Main()\n\tLoadTheme()\n\tcategories = LoadConfig()\n\n\tif categories.Count() > 1\n\t\tShowPosterScreen( categories )\n\telse\n\t\tShowEpisodeScreen( categories[0] )\n\tend if\nend sub\n\nsub LoadTheme()\n\tapp = CreateObject( \"roAppManager\" )\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Slice_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Slice_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"40\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"40\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( primaryTextColor )\n\ttheme.breadcrumbDelimiter = ValidStr( primaryTextColor )\n\ttheme.breadcrumbTextRight = ValidStr( primaryTextColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\tapp.SetTheme( theme )\nend sub\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\tend if\n\n\t'result.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"SD\"]\n\t\tstreambitrates:\t\t[0]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"85211f055d356f4cd2eda3cc77d124177fbe2428","subject":"Encapsulate show functionality, and fix problem where navigating between episodes via directional buttons did not properly refresh everything.","message":"Encapsulate show functionality, and fix problem where navigating between episodes via directional buttons did not properly refresh everything.\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/screens\/SpringboardScreen.brs","new_file":"source\/screens\/SpringboardScreen.brs","new_contents":"function ShowSpringboardScreen( episodes, selectedEpisode )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t \tif msg.GetIndex() = 1\n\t\t\t\t\tPlayStart = RegRead( episodes[selectedEpisode].title )\n\t\t\t\t\tif PlayStart <> invalid then\n\t\t\t\t\t\tepisodes[selectedEpisode].PlayStart = PlayStart.ToInt()\n\t\t\t\t\tend if\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tsetButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\t\tif msg.GetIndex() = 2\n\t\t\t\t\tepisodes[selectedEpisode].PlayStart = 0\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tsetButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\telse if msg.isRemoteKeyPressed()\n\t\t\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\t\t\tif selectedEpisode = 0\n\t\t\t\t\t\tselectedEpisode = episodes.Count() - 1\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode - 1\n\t\t\t\t\tend if\n\t\t\t\t\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\t\t\tif selectedEpisode = episodes.Count() - 1\n\t\t\t\t\t\tselectedEpisode = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode + 1\n\t\t\t\t\tend if\n SpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\tend while\n\treturn selectedEpisode\nend function\n\nsub SpringBoardScreen_showContent( screen, episode )\n SpringBoardScreen_setButtons( screen, episode )\n screen.Show()\n\n SpringBoardScreen_swapPoster( episode )\n screen.SetContent( episode )\n screen.Show()\n SpringBoardScreen_swapPoster( episode )\nend sub\n\nsub SpringBoardScreen_swapPoster( show )\n\ttmp = show.sdPosterURL\n\tif show.sdPosterURL_hq <> invalid and show.sdPosterURL_hq <> \"\"\n\t\tshow.sdPosterURL = show.sdPosterURL_hq\n\t\tshow.sdPosterURL_hq = tmp\n\tend if\n\ttmp = show.hdPosterURL\n\tif show.hdPosterURL_hq <> invalid and show.hdPosterURL_hq <> \"\"\n\t\tshow.hdPosterURL = show.hdPosterURL_hq\n\t\tshow.hdPosterURL_hq = tmp\n\tend if\nend sub\n\nsub SpringBoardScreen_setButtons( screen, episode )\n\tscreen.ClearButtons()\n\tif RegRead( episode.title ) <> invalid and RegRead( episode.title ).toint() >=30 then\n\t\tscreen.AddButton( 1, \"Resume Playing\" ) \n\t\tscreen.AddButton( 2, \"Play from Beginning\" ) \n\telse\n\t\tscreen.addbutton( 2,\"Play\" )\n\tend if\nend sub\n","old_contents":"function ShowSpringboardScreen( episodes, selectedEpisode )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tsetButtons( screen, episodes[selectedEpisode] )\n\tscreen.Show()\n\n\tSpringBoardScreen_swapPoster( episodes[selectedEpisode] )\n\tscreen.SetContent( episodes[selectedEpisode] )\n\tscreen.Show()\n\tSpringBoardScreen_swapPoster( episodes[selectedEpisode] )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t \tif msg.GetIndex() = 1\n\t\t\t\t\tPlayStart = RegRead( episodes[selectedEpisode].title )\n\t\t\t\t\tif PlayStart <> invalid then\n\t\t\t\t\t\tepisodes[selectedEpisode].PlayStart = PlayStart.ToInt()\n\t\t\t\t\tend if\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tsetButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\t\tif msg.GetIndex() = 2\n\t\t\t\t\tepisodes[selectedEpisode].PlayStart = 0\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tsetButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\telse if msg.isRemoteKeyPressed()\n\t\t\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\t\t\tif selectedEpisode = 0\n\t\t\t\t\t\tselectedEpisode = episodes.Count() - 1\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode - 1\n\t\t\t\t\tend if\n\t\t\t\t\tscreen.SetContent( episodes[selectedEpisode] )\n\t\t\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\t\t\tif selectedEpisode = episodes.Count() - 1\n\t\t\t\t\t\tselectedEpisode = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode + 1\n\t\t\t\t\tend if\n\t\t\t\t\tscreen.SetContent( episodes[selectedEpisode] )\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\tend while\n\treturn selectedEpisode\nend function\n\nsub SpringBoardScreen_swapPoster( show )\n\ttmp = show.sdPosterURL\n\tif show.sdPosterURL_hq <> invalid and show.sdPosterURL_hq <> \"\"\n\t\tshow.sdPosterURL = show.sdPosterURL_hq\n\t\tshow.sdPosterURL_hq = tmp\n\tend if\n\ttmp = show.hdPosterURL\n\tif show.hdPosterURL_hq <> invalid and show.hdPosterURL_hq <> \"\"\n\t\tshow.hdPosterURL = show.hdPosterURL_hq\n\t\tshow.hdPosterURL_hq = tmp\n\tend if\nend sub\n\nsub setButtons( screen, episode )\n\tscreen.ClearButtons()\n\tif RegRead( episode.title ) <> invalid and RegRead( episode.title ).toint() >=30 then\n\t\tscreen.AddButton( 1, \"Resume Playing\" ) \n\t\tscreen.AddButton( 2, \"Play from Beginning\" ) \n\telse\n\t\tscreen.addbutton( 2,\"Play\" )\n\tend if\nend sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"68ade959999339d85cd6cce5faa6f28d6efcd107","subject":"Added audio live stream to live stream screen.","message":"Added audio live stream to live stream screen.\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/screens\/LivestreamScreen.brs","new_file":"source\/screens\/LivestreamScreen.brs","new_contents":"function ShowLivestreamScreen( livestream )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\t\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\t' Disable star ratings\n\tscreen.SetStaticRatingEnabled( false )\n\t' Add \"Play\" button\n\tLivestream_SetButtons( screen, false )\n\t' Set content to live stream (automatically parses array)\n\tscreen.SetContent( livestream )\n\t' Show screen\n\tscreen.Show()\n\n\t' Fetch calendar feed\n\traw = NWM_UT_GetStringFromURL( livestream.calendar )\n\t' Parse calendar feed\n\tcalendar = CreateObject( \"roXMLElement\" )\n\tif calendar.Parse( raw )\n\t\tislive = false\n\t\tnextevent = invalid\n\t\tnow = CreateObject( \"roDateTime\" )\n\t\tnow.mark()\n\t\tnow_s = now.asSeconds()\n\n\t\tfor each event in calendar.Event\n\t\t\t' Parse start and end times into ints\n\t\t\testart = strtoi( ValidStr( event.start.GetText() ) )\n\t\t\tefinish = strtoi( ValidStr( event.finish.GetText() ) )\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextevent = invalid\n\t\t\t\tnextevent = event\n\t\t\telse\n\t\t\t\t' Parse event's start time\n\t\t\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif estart < nestart AND efinish > now_s\n\t\t\t\t\tnextevent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\tnefinish = strtoi( ValidStr( nextevent.finish.GetText() ) )\n\n\t\tislive = ( nestart < now_s AND nefinish > now_s ) ' If event starts before now and ends after now, it is live\n\t\tdesc = strReplace( nextevent.summary.GetText(), \"LIVE: \", \"\" ) ' Remove \"Live:\" portions from description\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\tnextlive = CreateObject( \"roDateTime\" )\n\t\t\tnextlive.fromSeconds( nestart )\n\t\t\tnextlive.toLocalTime()\n\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + nextlive.asDateString( \"long-date\" ) + \" \"\n\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() )\n\n\t\t\t' Show next live show time (12hr)\n\t\t\tispm = nextlive.getHours() > 11 ' If hours is more than 11, is PM\n\t\t\tdesc = desc + \" (\"\n\t\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\t\tif nextlive.getHours() = 12 ' If is PM and is 12, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() - 12 ) + \":\"\n\t\t\t\tend if\n\t\t\telse ' If is AM show hours\n\t\t\t\tif nextlive.getHours() = 0 ' If is AM and is 0, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\t\tend if\t\t\t\n\t\t\tend if\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() ) + \" \"\n\t\t\tif ispm ' If is PM, show PM\n\t\t\t\tdesc = desc + \"PM\"\n\t\t\telse ' If is AM, show AM\n\t\t\t\tdesc = desc + \"AM\"\n\t\t\tend if\n\t\t\tdesc = desc + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\tlivestream.shortDescriptionLine2 = desc\n\t\tlivestream.description = desc\t\t\n\t\tscreen.SetContent( livestream )\n\t\tscreen.Show()\n\tend if\n\t\n\tAudioStream = CreateAudioPlayer( screen.GetMessagePort() )\n\tAudioStream.SetStream( livestream.audio )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\tAudioStream.Stop()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\tAudioStream.Stop()\n\t\t\t\t\tShowVideoScreen( livestream )\n\t\t\t\telse if msg.GetIndex() = 2\n\t\t\t\t\tAudioStream.Play()\n\t\t\t\telse if msg.GetIndex() = 3\n\t\t\t\t\tAudioStream.Stop()\n\t\t\t\tendif\n\t\t\t\tLivestream_SetButtons( screen, AudioStream.IsPlaying() )\n\t\t\tendif\n\t\tend if\n\tend while\n\n\treturn selectedEpisode\nend function\n\nsub Livestream_SetButtons( screen, isPlaying )\n\tscreen.ClearButtons()\n\tif isPlaying\n\t\tscreen.AddButton( 3, \"Stop Listening\" )\n\telse\n\t\tscreen.AddButton( 1, \"Play\" )\n\t\tscreen.AddButton( 2, \"Listen\" )\n\tend if\nend sub\n","old_contents":"function ShowLivestreamScreen( livestream )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\t\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\t' Disable star ratings\n\tscreen.SetStaticRatingEnabled( false )\n\t' Add \"Play\" button\n\tscreen.AddButton( 1, \"Play\" )\n\t' Set content to live stream (automatically parses array)\n\tscreen.SetContent( livestream )\n\t' Show screen\n\tscreen.Show()\n\n\t' Fetch calendar feed\n\traw = NWM_UT_GetStringFromURL( livestream.calendar )\n\t' Parse calendar feed\n\tcalendar = CreateObject( \"roXMLElement\" )\n\tif calendar.Parse( raw )\n\t\tislive = false\n\t\tnextevent = invalid\n\t\tnow = CreateObject( \"roDateTime\" )\n\t\tnow.mark()\n\t\tnow_s = now.asSeconds()\n\n\t\tfor each event in calendar.Event\n\t\t\t' Parse start and end times into ints\n\t\t\testart = strtoi( ValidStr( event.start.GetText() ) )\n\t\t\tefinish = strtoi( ValidStr( event.finish.GetText() ) )\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextevent = invalid\n\t\t\t\tnextevent = event\n\t\t\telse\n\t\t\t\t' Parse event's start time\n\t\t\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif estart < nestart AND efinish > now_s\n\t\t\t\t\tnextevent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\tnefinish = strtoi( ValidStr( nextevent.finish.GetText() ) )\n\n\t\tislive = ( nestart < now_s AND nefinish > now_s ) ' If event starts before now and ends after now, it is live\n\t\tdesc = strReplace( nextevent.summary.GetText(), \"LIVE: \", \"\" ) ' Remove \"Live:\" portions from description\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\tnextlive = CreateObject( \"roDateTime\" )\n\t\t\tnextlive.fromSeconds( nestart )\n\t\t\tnextlive.toLocalTime()\n\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + nextlive.asDateString( \"long-date\" ) + \" \"\n\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() )\n\n\t\t\t' Show next live show time (12hr)\n\t\t\tispm = nextlive.getHours() > 11 ' If hours is more than 11, is PM\n\t\t\tdesc = desc + \" (\"\n\t\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\t\tif nextlive.getHours() = 12 ' If is PM and is 12, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() - 12 ) + \":\"\n\t\t\t\tend if\n\t\t\telse ' If is AM show hours\n\t\t\t\tif nextlive.getHours() = 0 ' If is AM and is 0, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\t\tend if\t\t\t\n\t\t\tend if\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() ) + \" \"\n\t\t\tif ispm ' If is PM, show PM\n\t\t\t\tdesc = desc + \"PM\"\n\t\t\telse ' If is AM, show AM\n\t\t\t\tdesc = desc + \"AM\"\n\t\t\tend if\n\t\t\tdesc = desc + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\tlivestream.shortDescriptionLine2 = desc\n\t\tlivestream.description = desc\t\t\n\t\tscreen.SetContent( livestream )\n\t\tscreen.Show()\n\tend if\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tShowVideoScreen( livestream )\n\t\t\tendif\n\t\tend if\n\tend while\n\n\treturn selectedEpisode\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"a09717541826c216c19bdd31f461db9bab7eb929","subject":"Clean up VideoScreen a bit, and increase interval between progress save marker.","message":"Clean up VideoScreen a bit, and increase interval between progress save marker.\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/screens\/VideoScreen.brs","new_file":"source\/screens\/VideoScreen.brs","new_contents":"'**********************************************************\n' Video Player Example Application - Video Playback \n' November 2009\n' Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'**********************************************************\n\n'***********************************************************\n' Create and show the video screen. The video screen is\n' a special full screen video playback component. It \n' handles most of the keypresses automatically and our\n' job is primarily to make sure it has the correct data \n' at startup. We will receive event back on progress and\n' error conditions so it's important to monitor these to\n' understand what's going on, especially in the case of errors\n'*********************************************************** \nFunction showVideoScreen(episode As Object)\n\tif type(episode) <> \"roAssociativeArray\" then\n\t\tprint \"invalid data passed to showVideoScreen\"\n\t\treturn -1\n\tendif\n\n\tport = CreateObject(\"roMessagePort\")\n\tscreen = CreateObject(\"roVideoScreen\")\n\tscreen.SetMessagePort(port)\n\n\tscreen.SetContent( episode )\n\tscreen.SetPositionNotificationPeriod( 15 )\n\tscreen.Show()\n\n\twhile true\n\t\tmsg = wait(0, port)\n\t\tif type(msg) = \"roVideoScreenEvent\" then\n\t\t\tif msg.isScreenClosed()\n\t\t\t\tprint \"Screen closed\"\n\t\t\t\texit while\n\t\t\telse if msg.isRequestFailed()\n\t\t\t\tprint \"Video request failure: \"; msg.GetIndex(); \" \" msg.GetData() \n\t\t\telse if msg.isStatusMessage()\n\t\t\t\tprint \"Video status: \"; msg.GetIndex(); \" \" msg.GetData() \n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tprint \"Button pressed: \"; msg.GetIndex(); \" \" msg.GetData()\n\t\t\telse if msg.isPlaybackPosition() then\n\t\t\t\tnowpos = msg.GetIndex()\n\t\t\t\tRegWrite( episode.title, nowpos.toStr() )\n\t\t\t\tprint \"Marked progress: \"; msg.GetIndex()\n\t\t\telse if msg.isFullResult() then\n\t\t\t\tRegDelete( episode.title )\n\t\t\telse\n\t\t\t\tprint \"Unexpected event type: \"; msg.GetType()\n\t\t\tend if\n\t\telse\n\t\t\tprint \"Unexpected message class: \"; type(msg)\n\t\tend if\n\tend while\nEnd Function\n","old_contents":"'**********************************************************\n' Video Player Example Application - Video Playback \n' November 2009\n' Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'**********************************************************\n\n'***********************************************************\n' Create and show the video screen. The video screen is\n' a special full screen video playback component. It \n' handles most of the keypresses automatically and our\n' job is primarily to make sure it has the correct data \n' at startup. We will receive event back on progress and\n' error conditions so it's important to monitor these to\n' understand what's going on, especially in the case of errors\n'*********************************************************** \nFunction showVideoScreen(episode As Object)\n\tif type(episode) <> \"roAssociativeArray\" then\n\t\tprint \"invalid data passed to showVideoScreen\"\n\t\treturn -1\n\tendif\n\n\tport = CreateObject(\"roMessagePort\")\n\tscreen = CreateObject(\"roVideoScreen\")\n\tscreen.SetMessagePort(port)\n\n\tscreen.SetContent( episode )\n\tscreen.SetPositionNotificationPeriod( 3 ) 'Fire isPlaybackPosition every 3 seconds\n\tscreen.Show()\n\n\t'Uncomment his line to dump the contents of the episode to be played\n\t'PrintAA(episode)\n\n\twhile true\n\t\tmsg = wait(0, port)\n\t\tif type(msg) = \"roVideoScreenEvent\" then\n\t\t\tprint \"showHomeScreen | msg = \"; msg.getMessage() \" | index = \"; msg.GetIndex()\n\t\t\tif msg.isScreenClosed()\n\t\t\t\tprint \"Screen closed\"\n\t\t\t\texit while\n\t\t\telse if msg.isRequestFailed()\n\t\t\t\tprint \"Video request failure: \"; msg.GetIndex(); \" \" msg.GetData() \n\t\t\telse if msg.isStatusMessage()\n\t\t\t\tprint \"Video status: \"; msg.GetIndex(); \" \" msg.GetData() \n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tprint \"Button pressed: \"; msg.GetIndex(); \" \" msg.GetData()\n\t\t\telse if msg.isPlaybackPosition() then\n\t\t nowpos = msg.GetIndex()\n\t\t RegWrite( episode.title, nowpos.toStr() )\n\t\t\t\tprint \"Marked progress: \"; msg.GetIndex()\n\t\t\telse if msg.isFullResult() then\n\t\t RegDelete( episode.title )\n\t\t\telse\n\t\t\t\tprint \"Unexpected event type: \"; msg.GetType()\n\t\t\tend if\n\t\telse\n\t\t\tprint \"Unexpected message class: \"; type(msg)\n\t\tend if\n\tend while\nEnd Function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"57ec19062042b6b7f3e8c56f24b603fe95ed583b","subject":"Function setButtons has been renamed.","message":"Function setButtons has been renamed.\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/screens\/SpringboardScreen.brs","new_file":"source\/screens\/SpringboardScreen.brs","new_contents":"function ShowSpringboardScreen( episodes, selectedEpisode )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\tPlayStart = RegRead( episodes[selectedEpisode].title )\n\t\t\t\t\tif PlayStart <> invalid then\n\t\t\t\t\t\tepisodes[selectedEpisode].PlayStart = PlayStart.ToInt()\n\t\t\t\t\tend if\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tSpringBoardScreen_setButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\t\tif msg.GetIndex() = 2\n\t\t\t\t\tepisodes[selectedEpisode].PlayStart = 0\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tSpringBoardScreen_setButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\telse if msg.isRemoteKeyPressed()\n\t\t\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\t\t\tif selectedEpisode = 0\n\t\t\t\t\t\tselectedEpisode = episodes.Count() - 1\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode - 1\n\t\t\t\t\tend if\n\t\t\t\t\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\t\t\tif selectedEpisode = episodes.Count() - 1\n\t\t\t\t\t\tselectedEpisode = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode + 1\n\t\t\t\t\tend if\n SpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\tend while\n\treturn selectedEpisode\nend function\n\nsub SpringBoardScreen_showContent( screen, episode )\n SpringBoardScreen_setButtons( screen, episode )\n screen.Show()\n\n SpringBoardScreen_swapPoster( episode )\n screen.SetContent( episode )\n screen.Show()\n SpringBoardScreen_swapPoster( episode )\nend sub\n\nsub SpringBoardScreen_swapPoster( show )\n\ttmp = show.sdPosterURL\n\tif show.sdPosterURL_hq <> invalid and show.sdPosterURL_hq <> \"\"\n\t\tshow.sdPosterURL = show.sdPosterURL_hq\n\t\tshow.sdPosterURL_hq = tmp\n\tend if\n\ttmp = show.hdPosterURL\n\tif show.hdPosterURL_hq <> invalid and show.hdPosterURL_hq <> \"\"\n\t\tshow.hdPosterURL = show.hdPosterURL_hq\n\t\tshow.hdPosterURL_hq = tmp\n\tend if\nend sub\n\nsub SpringBoardScreen_setButtons( screen, episode )\n\tscreen.ClearButtons()\n\tif RegRead( episode.title ) <> invalid and RegRead( episode.title ).toint() >=30 then\n\t\tscreen.AddButton( 1, \"Resume Playing\" ) \n\t\tscreen.AddButton( 2, \"Play from Beginning\" ) \n\telse\n\t\tscreen.addbutton( 2,\"Play\" )\n\tend if\nend sub\n","old_contents":"function ShowSpringboardScreen( episodes, selectedEpisode )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t \tif msg.GetIndex() = 1\n\t\t\t\t\tPlayStart = RegRead( episodes[selectedEpisode].title )\n\t\t\t\t\tif PlayStart <> invalid then\n\t\t\t\t\t\tepisodes[selectedEpisode].PlayStart = PlayStart.ToInt()\n\t\t\t\t\tend if\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tsetButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\t\tif msg.GetIndex() = 2\n\t\t\t\t\tepisodes[selectedEpisode].PlayStart = 0\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tsetButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\telse if msg.isRemoteKeyPressed()\n\t\t\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\t\t\tif selectedEpisode = 0\n\t\t\t\t\t\tselectedEpisode = episodes.Count() - 1\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode - 1\n\t\t\t\t\tend if\n\t\t\t\t\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\t\t\tif selectedEpisode = episodes.Count() - 1\n\t\t\t\t\t\tselectedEpisode = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode + 1\n\t\t\t\t\tend if\n SpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\tend while\n\treturn selectedEpisode\nend function\n\nsub SpringBoardScreen_showContent( screen, episode )\n SpringBoardScreen_setButtons( screen, episode )\n screen.Show()\n\n SpringBoardScreen_swapPoster( episode )\n screen.SetContent( episode )\n screen.Show()\n SpringBoardScreen_swapPoster( episode )\nend sub\n\nsub SpringBoardScreen_swapPoster( show )\n\ttmp = show.sdPosterURL\n\tif show.sdPosterURL_hq <> invalid and show.sdPosterURL_hq <> \"\"\n\t\tshow.sdPosterURL = show.sdPosterURL_hq\n\t\tshow.sdPosterURL_hq = tmp\n\tend if\n\ttmp = show.hdPosterURL\n\tif show.hdPosterURL_hq <> invalid and show.hdPosterURL_hq <> \"\"\n\t\tshow.hdPosterURL = show.hdPosterURL_hq\n\t\tshow.hdPosterURL_hq = tmp\n\tend if\nend sub\n\nsub SpringBoardScreen_setButtons( screen, episode )\n\tscreen.ClearButtons()\n\tif RegRead( episode.title ) <> invalid and RegRead( episode.title ).toint() >=30 then\n\t\tscreen.AddButton( 1, \"Resume Playing\" ) \n\t\tscreen.AddButton( 2, \"Play from Beginning\" ) \n\telse\n\t\tscreen.addbutton( 2,\"Play\" )\n\tend if\nend sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"1b976db9fcaa712a92b55bb5e941fffcbc1fd751","subject":"All files must end with a newline for concatenation (again).","message":"All files must end with a newline for concatenation (again).\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/lib\/AudioPlayer.brs","new_file":"source\/lib\/AudioPlayer.brs","new_contents":"Function CreateAudioPlayer( port As Object ) As Object\n\taudioPlayer = CreateObject(\"roAssociativeArray\")\n\taudioPlayer.player = CreateObject(\"roAudioPlayer\")\n\taudioPlayer.playing = false\n\t\n\taudioPlayer.IsPlaying = AudioPlayer_IsPlaying\n\taudioPlayer.Stop = AudioPlayer_Stop\n\taudioPlayer.Play = AudioPlayer_Play\n\taudioPlayer.SetStream = AudioPlayer_SetStream\n\t\n\treturn audioPlayer\nend Function\n\nFunction AudioPlayer_IsPlaying()\n\treturn m.playing\nend Function\n\nFunction AudioPlayer_Stop()\n\tm.player.Stop()\n\tm.playing = false\nend Function\n\nFunction AudioPlayer_Play()\n\tm.player.Play()\n\tm.playing = true\nend Function\n\nFunction AudioPlayer_SetStream( audioStream As Object )\n\tm.player.AddContent( audioStream )\n\tm.player.SetLoop( false )\nend Function\n","old_contents":"Function CreateAudioPlayer( port As Object ) As Object\n\taudioPlayer = CreateObject(\"roAssociativeArray\")\n\taudioPlayer.player = CreateObject(\"roAudioPlayer\")\n\taudioPlayer.playing = false\n\t\n\taudioPlayer.IsPlaying = AudioPlayer_IsPlaying\n\taudioPlayer.Stop = AudioPlayer_Stop\n\taudioPlayer.Play = AudioPlayer_Play\n\taudioPlayer.SetStream = AudioPlayer_SetStream\n\t\n\treturn audioPlayer\nend Function\n\nFunction AudioPlayer_IsPlaying()\n\treturn m.playing\nend Function\n\nFunction AudioPlayer_Stop()\n\tm.player.Stop()\n\tm.playing = false\nend Function\n\nFunction AudioPlayer_Play()\n\tm.player.Play()\n\tm.playing = true\nend Function\n\nFunction AudioPlayer_SetStream( audioStream As Object )\n\tm.player.AddContent( audioStream )\n\tm.player.SetLoop( false )\nend Function","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"9e5c2f0e5b578bb8d8571a1f67e3c5ae37803807","subject":"Set live stream quality to SD for compatibility with SD users. This also appears to work the same for HD users as before.","message":"Set live stream quality to SD for compatibility with SD users. This also appears to work the same for HD users as before.\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/Main.brs","new_file":"source\/Main.brs","new_contents":"sub Main()\n\tLoadTheme()\n\tcategories = LoadConfig()\n\n\tif categories.Count() > 1\n\t\tShowPosterScreen( categories )\n\telse\n\t\tShowEpisodeScreen( categories[0] )\n\tend if\nend sub\n\nsub LoadTheme()\n\tapp = CreateObject( \"roAppManager\" )\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Slice_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Slice_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"40\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"40\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( primaryTextColor )\n\ttheme.breadcrumbDelimiter = ValidStr( primaryTextColor )\n\ttheme.breadcrumbTextRight = ValidStr( primaryTextColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\tapp.SetTheme( theme )\nend sub\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\tend if\n\n\t'result.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"SD\"]\n\t\tstreambitrates:\t\t[0]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","old_contents":"sub Main()\n\tLoadTheme()\n\tcategories = LoadConfig()\n\n\tif categories.Count() > 1\n\t\tShowPosterScreen( categories )\n\telse\n\t\tShowEpisodeScreen( categories[0] )\n\tend if\nend sub\n\nsub LoadTheme()\n\tapp = CreateObject( \"roAppManager\" )\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Slice_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Slice_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"40\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"40\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( primaryTextColor )\n\ttheme.breadcrumbDelimiter = ValidStr( primaryTextColor )\n\ttheme.breadcrumbTextRight = ValidStr( primaryTextColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\tapp.SetTheme( theme )\nend sub\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\tend if\n\n\t'result.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"HD\"]\n\t\tstreambitrates:\t\t[0]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.jpg\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"c2cbf703cfa8603ba8cb88b45d2a1a8f5fb48e18","subject":"Check for upcoming events to prevent crash. Fixes #5.","message":"Check for upcoming events to prevent crash. Fixes #5.\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/screens\/LivestreamScreen.brs","new_file":"source\/screens\/LivestreamScreen.brs","new_contents":"function CreateLivestreamScreen(livestream)\n\tinstance = CreateObject(\"roAssociativeArray\")\n\n\tinstance.screen = CreateObject(\"roSpringboardScreen\")\n\tinstance.messagePort = CreateObject(\"roMessagePort\")\n\tinstance.screen.SetMessagePort(instance.messagePort)\n\tinstance.audioStream = CreateAudioPlayer(instance.messagePort)\n\tinstance.audioStream.SetStream(livestream.audio)\n\n\tinstance.livestream = livestream\n\n\tinstance.showScreen = function()\n\t\tm.showStars()\n\t\tm.showAds()\n\t\tm.setButtons(false)\n\t\tm.showEpisode() ' Show data so far\n\t\tm.fetchCalendar()\n\t\tm.showEpisode()\n\t\tm.waitForInput()\n\tend function\n\n\tinstance.showStars = function()\n\t\t' Disable star ratings\n\t\tm.screen.SetStaticRatingEnabled(false)\n\tend function\n\t\n\tinstance.showAds = function()\n\t\t'Don't show ads, really\n\t\t'm.screen.setAdURL(sdAd, hdAd)\n\t\t'm.screen.setAdSelectable(false)\n\t\tx = 0 'Don't break the editor\n\tend function\n\t\n\tinstance.setButtons = function(isAudioPlaying)\n\t\tm.screen.ClearButtons()\n\t\tif isAudioPlaying\n\t\t\tm.screen.AddButton(3, \"Stop Listening\")\n\t\telse\n\t\t\tm.screen.AddButton(1, \"Watch\")\n\t\t\tm.screen.AddButton(2, \"Listen\")\n\t\tend if\n\tend function\n\n\tinstance.showEpisode = function()\n\t\t' Set content to live stream (automatically parses array)\n\t\tm.screen.SetContent(m.livestream)\n\t\tm.screen.Show()\n\tend function\n\n\tinstance.fetchCalendar = function()\n\t\tcalendarRaw = m.getRawCalendar()\n\t\tcalendar = m.parseRawCalendar(calendarRaw)\n\t\tdesc = m.getDescriptionWithCalendar(calendar)\n\t\tm.updateDescriptionWithCalendar(desc)\n\tend function\n\t\n\tinstance.getRawCalendar = function()\n\t\treturn NWM_UT_GetStringFromURL(m.livestream.calendar)\n\tend function\n\n\tinstance.parseRawCalendar = function(calendarRaw)\n\t\tcalendar = CreateObject(\"roXMLElement\")\n\t\tif not calendar.Parse(calendarRaw)\n\t\t\treturn invalid\n\t\tend if\n\t\treturn calendar\n\tend function\n\n\tinstance.getDescriptionWithCalendar = function(calendar)\n\t\tif calendar = invalid\n\t\t\treturn \"Calendar could not be loaded.\"\n\t\tend if\n\n\t\tif calendar.getChildElements() = invalid\n\t\t\treturn \"No upcoming events found.\"\n\t\tend if\n\n\t\tnextEvent = m.getNextEvent(calendar)\n\t\tisLive = m.isEventLive(nextEvent)\n\t\tdesc = m.getEventDescription(nextEvent, isLive)\n\t\t\n\t\treturn desc\n\tend function\n\t\n\tinstance.getNowInSeconds = function()\n\t\tnow = CreateObject(\"roDateTime\")\n\t\tnow.mark()\n\t\treturn now.asSeconds()\n\tend function\n\n\tinstance.getNextEvent = function(calendar)\n\t\tnow = m.getNowInSeconds()\n\t\tnextEvent = invalid\n\n\t\tfor each event in calendar.Event\n\t\t\teventStart = m.parseXMLTime(event.start.GetText())\n\t\t\teventFinish = m.parseXMLTime(event.finish.GetText())\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextEvent = invalid\n\t\t\t\tnextEvent = event\n\t\t\telse\n\t\t\t\tnextEventStart = m.parseXMLTime(nextEvent.start.GetText())\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif eventStart < nextEventStart AND eventFinish > now\n\t\t\t\t\tnextEvent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\t\n\t\treturn {\n\t\t\tstart: m.parseXMLTime(nextEvent.start.getText())\n\t\t\tfinish: m.parseXMLTime(nextEvent.finish.getText())\n\t\t\tsummary: strReplace(nextevent.summary.GetText(), \"LIVE: \", \"\") ' Remove \"Live:\" portions from description\n\t\t}\n\tend function\n\n\tinstance.parseXMLTime = function(xmlTime)\n\t\treturn strtoi(ValidStr(xmlTime))\n\tend function\n\n\tinstance.isEventLive = function(event)\n\t\tnow = m.getNowInSeconds()\n\n\t\t' If event starts before now and ends after now, it is live\n\t\treturn (event.start < now AND event.finish > now)\n\tend function\n\n\tinstance.getEventDescription = function(event, isLive)\n\t\tdesc = event.summary\n\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\twhenLive = CreateObject(\"roDateTime\")\n\t\t\twhenLive.fromSeconds(event.start)\n\t\t\twhenLive.toLocalTime()\n\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + whenLive.asDateString(\"long-date\") + \" \"\n\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + m.get24HourTimeString(whenLive.getHours(), whenLive.getMinutes())\n\n\t\t\t' Show next live show time (12hr)\n\t\t\tdesc = desc + \" (\" + m.get12HourTimeString(whenLive.getHours(), whenLive.getMinutes()) + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\treturn desc\n\tend function\n\n\tinstance.get24HourTimeString = function(hours, minutes)\n\t\ttimestr = itostr(hours) + \":\"\n\t\tif minutes < 10 ' If less than 10 minutes, add leading zero\n\t\t\ttimestr = timestr + \"0\"\n\t\tend if\n\t\ttimestr = timestr + itostr(minutes)\n\t\t\n\t\treturn timestr\n\tend function\n\t\n\tinstance.get12HourTimeString = function(hours, minutes)\n\t\ttimestr = \"\"\n\t\t\n\t\tispm = hours > 11 ' If hours is more than 11, is PM\n\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\tif hours = 12 ' If is PM and is 12, show 12\n\t\t\t\ttimestr = timestr + \"12:\"\n\t\t\telse\n\t\t\t\ttimestr = timestr + itostr(hours - 12) + \":\"\n\t\t\tend if\n\t\telse ' If is AM show hours\n\t\t\tif hours = 0 ' If is AM and is 0, show 12\n\t\t\t\ttimestr = timestr + \"12:\"\n\t\t\telse\n\t\t\t\ttimestr = timestr + itostr(hours) + \":\"\n\t\t\tend if\t\t\t\n\t\tend if\n\n\t\tif minutes < 10 ' If less than 10 minutes, add leading zero\n\t\t\ttimestr = timestr + \"0\"\n\t\tend if\n\t\ttimestr = timestr + itostr(minutes) + \" \"\n\n\t\tif ispm\n\t\t\ttimestr = timestr + \"PM\"\n\t\telse\n\t\t\ttimestr = timestr + \"AM\"\n\t\tend if\n\t\t\n\t\treturn timestr\n\tend function\n\n\tinstance.updateDescriptionWithCalendar = function(desc)\n\t\tm.livestream.shortDescriptionLine2 = desc\n\t\tm.livestream.description = desc\t\n\tend function\n\t\n\tinstance.waitForInput = function()\n\t\twhile true\n\t\t\tmsg = wait(0, m.messagePort)\n\t\t\tif msg <> invalid\n\t\t\t\tif msg.isScreenClosed()\n\t\t\t\t\tm.audioStream.Stop()\n\t\t\t\t\texit while\n\t\t\t\telse if msg.isButtonPressed()\n\t\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\t\tm.audioStream.Stop()\n\t\t\t\t\t\tCreateVideoScreen(m.livestream).showScreen()\n\t\t\t\t\telse if msg.GetIndex() = 2\n\t\t\t\t\t\tm.audioStream.Play()\n\t\t\t\t\telse if msg.GetIndex() = 3\n\t\t\t\t\t\tm.audioStream.Stop()\n\t\t\t\t\tendif\n\t\t\t\t\tm.setButtons(m.audioStream.IsPlaying())\n\t\t\t\tendif\n\t\t\tend if\n\t\tend while\n\tend function\n\n\treturn instance\nend function\n","old_contents":"function CreateLivestreamScreen(livestream)\n\tinstance = CreateObject(\"roAssociativeArray\")\n\n\tinstance.screen = CreateObject(\"roSpringboardScreen\")\n\tinstance.messagePort = CreateObject(\"roMessagePort\")\n\tinstance.screen.SetMessagePort(instance.messagePort)\n\tinstance.audioStream = CreateAudioPlayer(instance.messagePort)\n\tinstance.audioStream.SetStream(livestream.audio)\n\n\tinstance.livestream = livestream\n\n\tinstance.showScreen = function()\n\t\tm.showStars()\n\t\tm.showAds()\n\t\tm.setButtons(false)\n\t\tm.showEpisode() ' Show data so far\n\t\tm.fetchCalendar()\n\t\tm.showEpisode()\n\t\tm.waitForInput()\n\tend function\n\n\tinstance.showStars = function()\n\t\t' Disable star ratings\n\t\tm.screen.SetStaticRatingEnabled(false)\n\tend function\n\t\n\tinstance.showAds = function()\n\t\t'Don't show ads, really\n\t\t'm.screen.setAdURL(sdAd, hdAd)\n\t\t'm.screen.setAdSelectable(false)\n\t\tx = 0 'Don't break the editor\n\tend function\n\t\n\tinstance.setButtons = function(isAudioPlaying)\n\t\tm.screen.ClearButtons()\n\t\tif isAudioPlaying\n\t\t\tm.screen.AddButton(3, \"Stop Listening\")\n\t\telse\n\t\t\tm.screen.AddButton(1, \"Watch\")\n\t\t\tm.screen.AddButton(2, \"Listen\")\n\t\tend if\n\tend function\n\n\tinstance.showEpisode = function()\n\t\t' Set content to live stream (automatically parses array)\n\t\tm.screen.SetContent(m.livestream)\n\t\tm.screen.Show()\n\tend function\n\n\tinstance.fetchCalendar = function()\n\t\tcalendarRaw = m.getRawCalendar()\n\t\tcalendar = m.parseRawCalendar(calendarRaw)\n\t\tdesc = m.getDescriptionWithCalendar(calendar)\n\t\tm.updateDescriptionWithCalendar(desc)\n\tend function\n\t\n\tinstance.getRawCalendar = function()\n\t\treturn NWM_UT_GetStringFromURL(m.livestream.calendar)\n\tend function\n\n\tinstance.parseRawCalendar = function(calendarRaw)\n\t\tcalendar = CreateObject(\"roXMLElement\")\n\t\tif not calendar.Parse(calendarRaw)\n\t\t\treturn invalid\n\t\tend if\n\t\treturn calendar\n\tend function\n\n\tinstance.getDescriptionWithCalendar = function(calendar)\n\t\tif calendar = invalid\n\t\t\treturn \"Calendar could not be loaded.\"\n\t\tend if\n\n\t\tnextEvent = m.getNextEvent(calendar)\n\t\tisLive = m.isEventLive(nextEvent)\n\t\tdesc = m.getEventDescription(nextEvent, isLive)\n\t\t\n\t\treturn desc\n\tend function\n\t\n\tinstance.getNowInSeconds = function()\n\t\tnow = CreateObject(\"roDateTime\")\n\t\tnow.mark()\n\t\treturn now.asSeconds()\n\tend function\n\n\tinstance.getNextEvent = function(calendar)\n\t\tnow = m.getNowInSeconds()\n\t\tnextEvent = invalid\n\n\t\tfor each event in calendar.Event\n\t\t\teventStart = m.parseXMLTime(event.start.GetText())\n\t\t\teventFinish = m.parseXMLTime(event.finish.GetText())\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextEvent = invalid\n\t\t\t\tnextEvent = event\n\t\t\telse\n\t\t\t\tnextEventStart = m.parseXMLTime(nextEvent.start.GetText())\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif eventStart < nextEventStart AND eventFinish > now\n\t\t\t\t\tnextEvent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\t\n\t\treturn {\n\t\t\tstart: m.parseXMLTime(nextEvent.start.getText())\n\t\t\tfinish: m.parseXMLTime(nextEvent.finish.getText())\n\t\t\tsummary: strReplace(nextevent.summary.GetText(), \"LIVE: \", \"\") ' Remove \"Live:\" portions from description\n\t\t}\n\tend function\n\n\tinstance.parseXMLTime = function(xmlTime)\n\t\treturn strtoi(ValidStr(xmlTime))\n\tend function\n\n\tinstance.isEventLive = function(event)\n\t\tnow = m.getNowInSeconds()\n\n\t\t' If event starts before now and ends after now, it is live\n\t\treturn (event.start < now AND event.finish > now)\n\tend function\n\n\tinstance.getEventDescription = function(event, isLive)\n\t\tdesc = event.summary\n\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\twhenLive = CreateObject(\"roDateTime\")\n\t\t\twhenLive.fromSeconds(event.start)\n\t\t\twhenLive.toLocalTime()\n\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + whenLive.asDateString(\"long-date\") + \" \"\n\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + m.get24HourTimeString(whenLive.getHours(), whenLive.getMinutes())\n\n\t\t\t' Show next live show time (12hr)\n\t\t\tdesc = desc + \" (\" + m.get12HourTimeString(whenLive.getHours(), whenLive.getMinutes()) + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\treturn desc\n\tend function\n\n\tinstance.get24HourTimeString = function(hours, minutes)\n\t\ttimestr = itostr(hours) + \":\"\n\t\tif minutes < 10 ' If less than 10 minutes, add leading zero\n\t\t\ttimestr = timestr + \"0\"\n\t\tend if\n\t\ttimestr = timestr + itostr(minutes)\n\t\t\n\t\treturn timestr\n\tend function\n\t\n\tinstance.get12HourTimeString = function(hours, minutes)\n\t\ttimestr = \"\"\n\t\t\n\t\tispm = hours > 11 ' If hours is more than 11, is PM\n\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\tif hours = 12 ' If is PM and is 12, show 12\n\t\t\t\ttimestr = timestr + \"12:\"\n\t\t\telse\n\t\t\t\ttimestr = timestr + itostr(hours - 12) + \":\"\n\t\t\tend if\n\t\telse ' If is AM show hours\n\t\t\tif hours = 0 ' If is AM and is 0, show 12\n\t\t\t\ttimestr = timestr + \"12:\"\n\t\t\telse\n\t\t\t\ttimestr = timestr + itostr(hours) + \":\"\n\t\t\tend if\t\t\t\n\t\tend if\n\n\t\tif minutes < 10 ' If less than 10 minutes, add leading zero\n\t\t\ttimestr = timestr + \"0\"\n\t\tend if\n\t\ttimestr = timestr + itostr(minutes) + \" \"\n\n\t\tif ispm\n\t\t\ttimestr = timestr + \"PM\"\n\t\telse\n\t\t\ttimestr = timestr + \"AM\"\n\t\tend if\n\t\t\n\t\treturn timestr\n\tend function\n\n\tinstance.updateDescriptionWithCalendar = function(desc)\n\t\tm.livestream.shortDescriptionLine2 = desc\n\t\tm.livestream.description = desc\t\n\tend function\n\t\n\tinstance.waitForInput = function()\n\t\twhile true\n\t\t\tmsg = wait(0, m.messagePort)\n\t\t\tif msg <> invalid\n\t\t\t\tif msg.isScreenClosed()\n\t\t\t\t\tm.audioStream.Stop()\n\t\t\t\t\texit while\n\t\t\t\telse if msg.isButtonPressed()\n\t\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\t\tm.audioStream.Stop()\n\t\t\t\t\t\tCreateVideoScreen(m.livestream).showScreen()\n\t\t\t\t\telse if msg.GetIndex() = 2\n\t\t\t\t\t\tm.audioStream.Play()\n\t\t\t\t\telse if msg.GetIndex() = 3\n\t\t\t\t\t\tm.audioStream.Stop()\n\t\t\t\t\tendif\n\t\t\t\t\tm.setButtons(m.audioStream.IsPlaying())\n\t\t\t\tendif\n\t\t\tend if\n\t\tend while\n\tend function\n\n\treturn instance\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"ddfa8dba500b33d2c56ec97b30186b7532a7eb03","subject":"bug 1109918 - use generic description style on detail screen","message":"bug 1109918 - use generic description style on detail screen\n","repos":"Nolski\/airmozilla,anjalymehla\/airmozilla,kenrick95\/airmozilla,anu7495\/airmozilla,anu7495\/airmozilla,Nolski\/airmozilla,kenrick95\/airmozilla,Nolski\/airmozilla,mythmon\/airmozilla,mythmon\/airmozilla,lcamacho\/airmozilla,EricSekyere\/airmozilla,ehsan\/airmozilla,blossomica\/airmozilla,ehsan\/airmozilla,zofuthan\/airmozilla,EricSekyere\/airmozilla,blossomica\/airmozilla,Nolski\/airmozilla,kenrick95\/airmozilla,a-buck\/airmozilla,EricSekyere\/airmozilla,blossomica\/airmozilla,tannishk\/airmozilla,ehsan\/airmozilla,lcamacho\/airmozilla,chirilo\/airmozilla,anjalymehla\/airmozilla,bugzPDX\/airmozilla,tannishk\/airmozilla,tannishk\/airmozilla,lcamacho\/airmozilla,anu7495\/airmozilla,anu7495\/airmozilla,tannishk\/airmozilla,mozilla\/airmozilla,chirilo\/airmozilla,anjalymehla\/airmozilla,blossomica\/airmozilla,a-buck\/airmozilla,lcamacho\/airmozilla,lcamacho\/airmozilla,zofuthan\/airmozilla,EricSekyere\/airmozilla,ehsan\/airmozilla,mozilla\/airmozilla,EricSekyere\/airmozilla,zofuthan\/airmozilla,bugzPDX\/airmozilla,a-buck\/airmozilla,mythmon\/airmozilla,kenrick95\/airmozilla,anjalymehla\/airmozilla,anu7495\/airmozilla,mythmon\/airmozilla,tannishk\/airmozilla,chirilo\/airmozilla,zofuthan\/airmozilla,Nolski\/airmozilla,zofuthan\/airmozilla,bugzPDX\/airmozilla,mozilla\/airmozilla,kenrick95\/airmozilla,anjalymehla\/airmozilla,a-buck\/airmozilla,ehsan\/airmozilla,mozilla\/airmozilla,chirilo\/airmozilla,chirilo\/airmozilla,bugzPDX\/airmozilla,mythmon\/airmozilla","old_file":"roku\/airmozilla\/source\/appDetailScreen.brs","new_file":"roku\/airmozilla\/source\/appDetailScreen.brs","new_contents":"' This Source Code Form is subject to the terms of the Mozilla Public\n' License, v. 2.0. If a copy of the MPL was not distributed with this file,\n' You can obtain one at http:\/\/mozilla.org\/MPL\/2.0\/.\n\nFunction preShowDetailScreen(breadA=invalid, breadB=invalid) As Object\n port=CreateObject(\"roMessagePort\")\n screen = CreateObject(\"roSpringboardScreen\")\n ' screen.SetDescriptionStyle(\"video\")\n screen.SetDescriptionStyle(\"generic\")\n screen.SetMessagePort(port)\n if breadA<>invalid and breadB<>invalid then\n screen.SetBreadcrumbText(breadA, breadB)\n end if\n\n return screen\nEnd Function\n\n'***************************************************************\n'** The show detail screen (springboard) is where the user sees\n'** the details for a show and is allowed to select a show to\n'** begin playback. This is the main event loop for that screen\n'** and where we spend our time waiting until the user presses a\n'** button and then we decide how best to handle the event.\n'***************************************************************\nFunction showDetailScreen(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n if validateParam(screen, \"roSpringboardScreen\", \"showDetailScreen\") = false return -1\n if validateParam(showList, \"roArray\", \"showDetailScreen\") = false return -1\n\n refreshShowDetail(screen, showList, showIndex)\n\n 'remote key id's for left\/right navigation\n remoteKeyLeft = 4\n remoteKeyRight = 5\n\n while true\n msg = wait(0, screen.GetMessagePort())\n\n if type(msg) = \"roSpringboardScreenEvent\" then\n if msg.isScreenClosed()\n print \"Screen closed\"\n exit while\n else if msg.isRemoteKeyPressed()\n print \"Remote key pressed\"\n if msg.GetIndex() = remoteKeyLeft then\n showIndex = getPrevShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n else if msg.GetIndex() = remoteKeyRight\n showIndex = getNextShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n endif\n else if msg.isButtonPressed()\n print \"ButtonPressed\"\n print \"ButtonPressed\"\n if msg.GetIndex() = 1\n PlayStart = RegRead(showList[showIndex].ContentId)\n if PlayStart <> invalid then\n showList[showIndex].PlayStart = PlayStart.ToInt()\n endif\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 2\n showList[showIndex].PlayStart = 0\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 3\n endif\n print \"Button pressed: \"; msg.GetIndex(); \" \" msg.GetData()\n end if\n else\n print \"Unexpected message class: \"; type(msg)\n end if\n end while\n\n return showIndex\n\nEnd Function\n\n'**************************************************************\n'** Refresh the contents of the show detail screen. This may be\n'** required on initial entry to the screen or as the user moves\n'** left\/right on the springboard. When the user is on the\n'** springboard, we generally let them press left\/right arrow keys\n'** to navigate to the previous\/next show in a circular manner.\n'** When leaving the screen, the should be positioned on the\n'** corresponding item in the poster screen matching the current show\n'**************************************************************\nFunction refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n if validateParam(screen, \"roSpringboardScreen\", \"refreshShowDetail\") = false return -1\n if validateParam(showList, \"roArray\", \"refreshShowDetail\") = false return -1\n\n show = showList[showIndex]\n\n 'Uncomment this statement to dump the details for each show\n 'PrintAA(show)\n\n screen.ClearButtons()\n if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then\n screen.AddButton(1, \"Resume playing\")\n screen.AddButton(2, \"Play from beginning\")\n else\n screen.addbutton(2,\"Play\")\n end if\n screen.SetStaticRatingEnabled(false)\n screen.SetContent(show)\n screen.Show()\n\nEnd Function\n\n'********************************************************\n'** Get the next item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getNextShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getNextShow\") = false return -1\n\n nextIndex = showIndex + 1\n if nextIndex >= showList.Count() or nextIndex < 0 then\n nextIndex = 0\n end if\n\n show = showList[nextIndex]\n if validateParam(show, \"roAssociativeArray\", \"getNextShow\") = false return -1\n\n return nextIndex\nEnd Function\n\n\n'********************************************************\n'** Get the previous item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getPrevShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getPrevShow\") = false return -1\n\n prevIndex = showIndex - 1\n if prevIndex < 0 or prevIndex >= showList.Count() then\n if showList.Count() > 0 then\n prevIndex = showList.Count() - 1\n else\n return -1\n end if\n end if\n\n show = showList[prevIndex]\n if validateParam(show, \"roAssociativeArray\", \"getPrevShow\") = false return -1\n\n return prevIndex\nEnd Function\n","old_contents":"' This Source Code Form is subject to the terms of the Mozilla Public\n' License, v. 2.0. If a copy of the MPL was not distributed with this file,\n' You can obtain one at http:\/\/mozilla.org\/MPL\/2.0\/.\n\nFunction preShowDetailScreen(breadA=invalid, breadB=invalid) As Object\n port=CreateObject(\"roMessagePort\")\n screen = CreateObject(\"roSpringboardScreen\")\n screen.SetDescriptionStyle(\"video\")\n screen.SetMessagePort(port)\n if breadA<>invalid and breadB<>invalid then\n screen.SetBreadcrumbText(breadA, breadB)\n end if\n\n return screen\nEnd Function\n\n'***************************************************************\n'** The show detail screen (springboard) is where the user sees\n'** the details for a show and is allowed to select a show to\n'** begin playback. This is the main event loop for that screen\n'** and where we spend our time waiting until the user presses a\n'** button and then we decide how best to handle the event.\n'***************************************************************\nFunction showDetailScreen(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n if validateParam(screen, \"roSpringboardScreen\", \"showDetailScreen\") = false return -1\n if validateParam(showList, \"roArray\", \"showDetailScreen\") = false return -1\n\n refreshShowDetail(screen, showList, showIndex)\n\n 'remote key id's for left\/right navigation\n remoteKeyLeft = 4\n remoteKeyRight = 5\n\n while true\n msg = wait(0, screen.GetMessagePort())\n\n if type(msg) = \"roSpringboardScreenEvent\" then\n if msg.isScreenClosed()\n print \"Screen closed\"\n exit while\n else if msg.isRemoteKeyPressed()\n print \"Remote key pressed\"\n if msg.GetIndex() = remoteKeyLeft then\n showIndex = getPrevShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n else if msg.GetIndex() = remoteKeyRight\n showIndex = getNextShow(showList, showIndex)\n if showIndex <> -1\n refreshShowDetail(screen, showList, showIndex)\n end if\n endif\n else if msg.isButtonPressed()\n print \"ButtonPressed\"\n print \"ButtonPressed\"\n if msg.GetIndex() = 1\n PlayStart = RegRead(showList[showIndex].ContentId)\n if PlayStart <> invalid then\n showList[showIndex].PlayStart = PlayStart.ToInt()\n endif\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 2\n showList[showIndex].PlayStart = 0\n showVideoScreen(showList[showIndex])\n refreshShowDetail(screen,showList,showIndex)\n endif\n if msg.GetIndex() = 3\n endif\n print \"Button pressed: \"; msg.GetIndex(); \" \" msg.GetData()\n end if\n else\n print \"Unexpected message class: \"; type(msg)\n end if\n end while\n\n return showIndex\n\nEnd Function\n\n'**************************************************************\n'** Refresh the contents of the show detail screen. This may be\n'** required on initial entry to the screen or as the user moves\n'** left\/right on the springboard. When the user is on the\n'** springboard, we generally let them press left\/right arrow keys\n'** to navigate to the previous\/next show in a circular manner.\n'** When leaving the screen, the should be positioned on the\n'** corresponding item in the poster screen matching the current show\n'**************************************************************\nFunction refreshShowDetail(screen As Object, showList As Object, showIndex as Integer) As Integer\n\n if validateParam(screen, \"roSpringboardScreen\", \"refreshShowDetail\") = false return -1\n if validateParam(showList, \"roArray\", \"refreshShowDetail\") = false return -1\n\n show = showList[showIndex]\n\n 'Uncomment this statement to dump the details for each show\n 'PrintAA(show)\n\n screen.ClearButtons()\n if regread(show.contentid) <> invalid and regread(show.contentid).toint() >=30 then\n screen.AddButton(1, \"Resume playing\")\n screen.AddButton(2, \"Play from beginning\")\n else\n screen.addbutton(2,\"Play\")\n end if\n screen.SetStaticRatingEnabled(false)\n screen.SetContent(show)\n screen.Show()\n\nEnd Function\n\n'********************************************************\n'** Get the next item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getNextShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getNextShow\") = false return -1\n\n nextIndex = showIndex + 1\n if nextIndex >= showList.Count() or nextIndex < 0 then\n nextIndex = 0\n end if\n\n show = showList[nextIndex]\n if validateParam(show, \"roAssociativeArray\", \"getNextShow\") = false return -1\n\n return nextIndex\nEnd Function\n\n\n'********************************************************\n'** Get the previous item in the list and handle the wrap\n'** around case to implement a circular list for left\/right\n'** navigation on the springboard screen\n'********************************************************\nFunction getPrevShow(showList As Object, showIndex As Integer) As Integer\n if validateParam(showList, \"roArray\", \"getPrevShow\") = false return -1\n\n prevIndex = showIndex - 1\n if prevIndex < 0 or prevIndex >= showList.Count() then\n if showList.Count() > 0 then\n prevIndex = showList.Count() - 1\n else\n return -1\n end if\n end if\n\n show = showList[prevIndex]\n if validateParam(show, \"roAssociativeArray\", \"getPrevShow\") = false return -1\n\n return prevIndex\nEnd Function\n","returncode":0,"stderr":"","license":"bsd-3-clause","lang":"Brightscript"} {"commit":"ec475db35767da911271664432a15eda4c2c44d3","subject":"Added\/copy-pasted additional library functionality.","message":"Added\/copy-pasted additional library functionality.\n\n--HG--\nextra : convert_revision : svn%3A1a989651-ce6e-ed51-1896-c0ee68ac2431\/trunk%4013\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/lib\/General.brs","new_file":"source\/lib\/General.brs","new_contents":"REM This file has no dependencies on other common files.\nREM\nREM Functions in this file:\nREM GetDeviceVersion\nREM GetDeviceESN\nREM IsHD\nREM\n\n'******************************************************\n'Get our device version\n'******************************************************\nFunction GetDeviceVersion()\n if m.softwareVersion = invalid OR m.softwareVersion = \"\" then\n m.softwareVersion = CreateObject(\"roDeviceInfo\").GetVersion()\n end if\n return m.softwareVersion\nEnd Function\n\n\n'******************************************************\n'Get our serial number\n'******************************************************\nFunction GetDeviceESN()\n if m.serialNumber = invalid OR m.serialNumber = \"\" then\n m.serialNumber = CreateObject(\"roDeviceInfo\").GetDeviceUniqueId()\n end if\n return m.serialNumber\nEnd Function\n\n\n'******************************************************\n'Determine if the UI is displayed in SD or HD mode\n'******************************************************\nFunction IsHD()\n di = CreateObject(\"roDeviceInfo\")\n if di.GetDisplayMode() = \"720p\" then return true\n return false\nEnd Function\n\n'******************************************************\n'Return a newline character\n'******************************************************\nFunction nl()\n return chr(10)\nEnd Function\n\n'******************************************************\n'Registry Helper Functions\n'******************************************************\nFunction RegRead(key, section=invalid)\n if section = invalid then section = \"Default\"\n sec = CreateObject(\"roRegistrySection\", section)\n if sec.Exists(key) then return sec.Read(key)\n return invalid\nEnd Function\n\nFunction RegWrite(key, val, section=invalid)\n if section = invalid then section = \"Default\"\n sec = CreateObject(\"roRegistrySection\", section)\n sec.Write(key, val)\n sec.Flush() 'commit it\nEnd Function\n\nFunction RegDelete(key, section=invalid)\n if section = invalid then section = \"Default\"\n sec = CreateObject(\"roRegistrySection\", section)\n sec.Delete(key)\n sec.Flush()\nEnd Function","old_contents":"REM This file has no dependencies on other common files.\nREM\nREM Functions in this file:\nREM GetDeviceVersion\nREM GetDeviceESN\nREM IsHD\nREM\n\n'******************************************************\n'Get our device version\n'******************************************************\nFunction GetDeviceVersion()\n if m.softwareVersion = invalid OR m.softwareVersion = \"\" then\n m.softwareVersion = CreateObject(\"roDeviceInfo\").GetVersion()\n end if\n return m.softwareVersion\nEnd Function\n\n\n'******************************************************\n'Get our serial number\n'******************************************************\nFunction GetDeviceESN()\n if m.serialNumber = invalid OR m.serialNumber = \"\" then\n m.serialNumber = CreateObject(\"roDeviceInfo\").GetDeviceUniqueId()\n end if\n return m.serialNumber\nEnd Function\n\n\n'******************************************************\n'Determine if the UI is displayed in SD or HD mode\n'******************************************************\nFunction IsHD()\n di = CreateObject(\"roDeviceInfo\")\n if di.GetDisplayMode() = \"720p\" then return true\n return false\nEnd Function\n\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"eddd54041288b76ead0692bfaeaafd9cb213d8d4","subject":"updated ip","message":"updated ip\n","repos":"NewSpring\/Public-Roku","old_file":"apps\/source\/live\/source\/categoryFeed.brs","new_file":"apps\/source\/live\/source\/categoryFeed.brs","new_contents":"'******************************************************\n'** Video Player Example Application -- Category Feed\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'******************************************************\n\n'******************************************************\n' Set up the category feed connection object\n' This feed provides details about top level categories\n'******************************************************\nFunction InitCategoryFeedConnection() As Object\n\n conn = CreateObject(\"roAssociativeArray\")\n\n conn.UrlPrefix = \"http:\/\/10.0.20.150\/roku\"\n\n conn.UrlCategoryFeed = conn.UrlPrefix + \"\/categories\"\n\n conn.Timer = CreateObject(\"roTimespan\")\n\n conn.LoadCategoryFeed = load_category_feed\n conn.GetCategoryNames = get_category_names\n\n print \"created feed connection for \" + conn.UrlCategoryFeed\n return conn\n\nEnd Function\n\n'*********************************************************\n'** Create an array of names representing the children\n'** for the current list of categories. This is useful\n'** for filling in the filter banner with the names of\n'** all the categories at the next level in the hierarchy\n'*********************************************************\nFunction get_category_names(categories As Object) As Dynamic\n\n categoryNames = CreateObject(\"roArray\", 100, true)\n\n for each category in categories.kids\n 'print category.Title\n categoryNames.Push(category.Title)\n next\n\n return categoryNames\n\nEnd Function\n\n\n'******************************************************************\n'** Given a connection object for a category feed, fetch,\n'** parse and build the tree for the feed. the results are\n'** stored hierarchically with parent\/child relationships\n'** with a single default node named Root at the root of the tree\n'******************************************************************\nFunction load_category_feed(conn As Object) As Dynamic\n\n http = NewHttp(conn.UrlCategoryFeed)\n\n Dbg(\"url: \", http.Http.GetUrl())\n\n m.Timer.Mark()\n rsp = http.GetToStringWithRetry()\n Dbg(\"Took: \", m.Timer)\n\n m.Timer.Mark()\n xml=CreateObject(\"roXMLElement\")\n if not xml.Parse(rsp) then\n print \"Can't parse feed\"\n return invalid\n endif\n Dbg(\"Parse Took: \", m.Timer)\n\n m.Timer.Mark()\n if xml.category = invalid then\n print \"no categories tag\"\n return invalid\n endif\n\n if islist(xml.category) = false then\n print \"invalid feed body\"\n return invalid\n endif\n\n if xml.category[0].GetName() <> \"category\" then\n print \"no initial category tag\"\n return invalid\n endif\n\n topNode = MakeEmptyCatNode()\n topNode.Title = \"root\"\n topNode.isapphome = true\n\n print \"begin category node parsing\"\n\n categories = xml.GetChildElements()\n print \"number of categories: \" + itostr(categories.Count())\n for each e in categories\n o = ParseCategoryNode(e)\n if o <> invalid then\n topNode.AddKid(o)\n print \"added new child node\"\n else\n print \"parse returned no child node\"\n endif\n next\n Dbg(\"Traversing: \", m.Timer)\n\n return topNode\n\nEnd Function\n\n'******************************************************\n'MakeEmptyCatNode - use to create top node in the tree\n'******************************************************\nFunction MakeEmptyCatNode() As Object\n return init_category_item()\nEnd Function\n\n\n'***********************************************************\n'Given the xml element to an tag in the category\n'feed, walk it and return the top level node to its tree\n'***********************************************************\nFunction ParseCategoryNode(xml As Object) As dynamic\n o = init_category_item()\n\n print \"ParseCategoryNode: \" + xml.GetName()\n 'PrintXML(xml, 5)\n\n 'parse the curent node to determine the type. everything except\n 'special categories are considered normal, others have unique types\n if xml.GetName() = \"category\" then\n print \"category: \" + xml@title + \" | \" + xml@description\n o.Type = \"normal\"\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n elseif xml.GetName() = \"categoryLeaf\" then\n o.Type = \"normal\"\n elseif xml.GetName() = \"specialCategory\" then\n if invalid <> xml.GetAttributes() then\n for each a in xml.GetAttributes()\n if a = \"type\" then\n o.Type = xml.GetAttributes()[a]\n print \"specialCategory: \" + xml@type + \"|\" + xml@title + \" | \" + xml@description\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n endif\n next\n endif\n else\n print \"ParseCategoryNode skip: \" + xml.GetName()\n return invalid\n endif\n\n 'only continue processing if we are dealing with a known type\n 'if new types are supported, make sure to add them to the list\n 'and parse them correctly further downstream in the parser\n while true\n if o.Type = \"normal\" exit while\n if o.Type = \"special_category\" exit while\n print \"ParseCategoryNode unrecognized feed type\"\n return invalid\n end while\n\n 'get the list of child nodes and recursed\n 'through everything under the current node\n for each e in xml.GetBody()\n name = e.GetName()\n if name = \"category\" then\n ' print \"category: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.ShortDescriptionLine1 = xml@Description\n kid.SDPosterURL = xml@sd_img\n kid.HDPosterURL = xml@hd_img\n o.AddKid(kid)\n elseif name = \"categoryLeaf\" then\n ' print \"categoryLeaf: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.Feed = e@feed\n o.AddKid(kid)\n elseif name = \"specialCategory\" then\n ' print \"specialCategory: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.sd_img = e@sd_img\n kid.hd_img = e@hd_img\n kid.Feed = e@feed\n o.AddKid(kid)\n endif\n next\n\n return o\nEnd Function\n\n\n'******************************************************\n'Initialize a Category Item\n'******************************************************\nFunction init_category_item() As Object\n o = CreateObject(\"roAssociativeArray\")\n o.Title = \"\"\n o.Type = \"normal\"\n o.Description = \"\"\n o.Kids = CreateObject(\"roArray\", 100, true)\n o.Parent = invalid\n o.Feed = \"\"\n o.IsLeaf = cn_is_leaf\n o.AddKid = cn_add_kid\n return o\nEnd Function\n\n\n'********************************************************\n'** Helper function for each node, returns true\/false\n'** indicating that this node is a leaf node in the tree\n'********************************************************\nFunction cn_is_leaf() As Boolean\n if m.Kids.Count() > 0 return true\n if m.Feed <> \"\" return false\n return true\nEnd Function\n\n\n'*********************************************************\n'** Helper function for each node in the tree to add a\n'** new node as a child to this node.\n'*********************************************************\nSub cn_add_kid(kid As Object)\n if kid = invalid then\n print \"skipping: attempt to add invalid kid failed\"\n return\n endif\n\n kid.Parent = m\n m.Kids.Push(kid)\nEnd Sub\n","old_contents":"'******************************************************\n'** Video Player Example Application -- Category Feed\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'******************************************************\n\n'******************************************************\n' Set up the category feed connection object\n' This feed provides details about top level categories\n'******************************************************\nFunction InitCategoryFeedConnection() As Object\n\n conn = CreateObject(\"roAssociativeArray\")\n\n conn.UrlPrefix = \"http:\/\/10.0.200.114\/roku\"\n conn.UrlCategoryFeed = conn.UrlPrefix + \"\/categories\"\n\n conn.Timer = CreateObject(\"roTimespan\")\n\n conn.LoadCategoryFeed = load_category_feed\n conn.GetCategoryNames = get_category_names\n\n print \"created feed connection for \" + conn.UrlCategoryFeed\n return conn\n\nEnd Function\n\n'*********************************************************\n'** Create an array of names representing the children\n'** for the current list of categories. This is useful\n'** for filling in the filter banner with the names of\n'** all the categories at the next level in the hierarchy\n'*********************************************************\nFunction get_category_names(categories As Object) As Dynamic\n\n categoryNames = CreateObject(\"roArray\", 100, true)\n\n for each category in categories.kids\n 'print category.Title\n categoryNames.Push(category.Title)\n next\n\n return categoryNames\n\nEnd Function\n\n\n'******************************************************************\n'** Given a connection object for a category feed, fetch,\n'** parse and build the tree for the feed. the results are\n'** stored hierarchically with parent\/child relationships\n'** with a single default node named Root at the root of the tree\n'******************************************************************\nFunction load_category_feed(conn As Object) As Dynamic\n\n http = NewHttp(conn.UrlCategoryFeed)\n\n Dbg(\"url: \", http.Http.GetUrl())\n\n m.Timer.Mark()\n rsp = http.GetToStringWithRetry()\n Dbg(\"Took: \", m.Timer)\n\n m.Timer.Mark()\n xml=CreateObject(\"roXMLElement\")\n if not xml.Parse(rsp) then\n print \"Can't parse feed\"\n return invalid\n endif\n Dbg(\"Parse Took: \", m.Timer)\n\n m.Timer.Mark()\n if xml.category = invalid then\n print \"no categories tag\"\n return invalid\n endif\n\n if islist(xml.category) = false then\n print \"invalid feed body\"\n return invalid\n endif\n\n if xml.category[0].GetName() <> \"category\" then\n print \"no initial category tag\"\n return invalid\n endif\n\n topNode = MakeEmptyCatNode()\n topNode.Title = \"root\"\n topNode.isapphome = true\n\n print \"begin category node parsing\"\n\n categories = xml.GetChildElements()\n print \"number of categories: \" + itostr(categories.Count())\n for each e in categories\n o = ParseCategoryNode(e)\n if o <> invalid then\n topNode.AddKid(o)\n print \"added new child node\"\n else\n print \"parse returned no child node\"\n endif\n next\n Dbg(\"Traversing: \", m.Timer)\n\n return topNode\n\nEnd Function\n\n'******************************************************\n'MakeEmptyCatNode - use to create top node in the tree\n'******************************************************\nFunction MakeEmptyCatNode() As Object\n return init_category_item()\nEnd Function\n\n\n'***********************************************************\n'Given the xml element to an tag in the category\n'feed, walk it and return the top level node to its tree\n'***********************************************************\nFunction ParseCategoryNode(xml As Object) As dynamic\n o = init_category_item()\n\n print \"ParseCategoryNode: \" + xml.GetName()\n 'PrintXML(xml, 5)\n\n 'parse the curent node to determine the type. everything except\n 'special categories are considered normal, others have unique types\n if xml.GetName() = \"category\" then\n print \"category: \" + xml@title + \" | \" + xml@description\n o.Type = \"normal\"\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n elseif xml.GetName() = \"categoryLeaf\" then\n o.Type = \"normal\"\n elseif xml.GetName() = \"specialCategory\" then\n if invalid <> xml.GetAttributes() then\n for each a in xml.GetAttributes()\n if a = \"type\" then\n o.Type = xml.GetAttributes()[a]\n print \"specialCategory: \" + xml@type + \"|\" + xml@title + \" | \" + xml@description\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n endif\n next\n endif\n else\n print \"ParseCategoryNode skip: \" + xml.GetName()\n return invalid\n endif\n\n 'only continue processing if we are dealing with a known type\n 'if new types are supported, make sure to add them to the list\n 'and parse them correctly further downstream in the parser\n while true\n if o.Type = \"normal\" exit while\n if o.Type = \"special_category\" exit while\n print \"ParseCategoryNode unrecognized feed type\"\n return invalid\n end while\n\n 'get the list of child nodes and recursed\n 'through everything under the current node\n for each e in xml.GetBody()\n name = e.GetName()\n if name = \"category\" then\n ' print \"category: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.ShortDescriptionLine1 = xml@Description\n kid.SDPosterURL = xml@sd_img\n kid.HDPosterURL = xml@hd_img\n o.AddKid(kid)\n elseif name = \"categoryLeaf\" then\n ' print \"categoryLeaf: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.Feed = e@feed\n o.AddKid(kid)\n elseif name = \"specialCategory\" then\n ' print \"specialCategory: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.sd_img = e@sd_img\n kid.hd_img = e@hd_img\n kid.Feed = e@feed\n o.AddKid(kid)\n endif\n next\n\n return o\nEnd Function\n\n\n'******************************************************\n'Initialize a Category Item\n'******************************************************\nFunction init_category_item() As Object\n o = CreateObject(\"roAssociativeArray\")\n o.Title = \"\"\n o.Type = \"normal\"\n o.Description = \"\"\n o.Kids = CreateObject(\"roArray\", 100, true)\n o.Parent = invalid\n o.Feed = \"\"\n o.IsLeaf = cn_is_leaf\n o.AddKid = cn_add_kid\n return o\nEnd Function\n\n\n'********************************************************\n'** Helper function for each node, returns true\/false\n'** indicating that this node is a leaf node in the tree\n'********************************************************\nFunction cn_is_leaf() As Boolean\n if m.Kids.Count() > 0 return true\n if m.Feed <> \"\" return false\n return true\nEnd Function\n\n\n'*********************************************************\n'** Helper function for each node in the tree to add a\n'** new node as a child to this node.\n'*********************************************************\nSub cn_add_kid(kid As Object)\n if kid = invalid then\n print \"skipping: attempt to add invalid kid failed\"\n return\n endif\n\n kid.Parent = m\n m.Kids.Push(kid)\nEnd Sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"719f49f8325928df9144cb84efc0516a4f486677","subject":"EE-559 Changed category feed to production url","message":"EE-559 Changed category feed to production url\n","repos":"NewSpring\/Public-Roku","old_file":"apps\/source\/live\/source\/categoryFeed.brs","new_file":"apps\/source\/live\/source\/categoryFeed.brs","new_contents":"'******************************************************\n'** Video Player Example Application -- Category Feed\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'******************************************************\n\n'******************************************************\n' Set up the category feed connection object\n' This feed provides details about top level categories\n'******************************************************\nFunction InitCategoryFeedConnection() As Object\n\n conn = CreateObject(\"roAssociativeArray\")\n\n conn.UrlPrefix = \"https:\/\/newspring.cc\/roku\"\n\n conn.UrlCategoryFeed = conn.UrlPrefix + \"\/categories\"\n\n conn.Timer = CreateObject(\"roTimespan\")\n\n conn.LoadCategoryFeed = load_category_feed\n conn.GetCategoryNames = get_category_names\n\n print \"created feed connection for \" + conn.UrlCategoryFeed\n return conn\n\nEnd Function\n\n'*********************************************************\n'** Create an array of names representing the children\n'** for the current list of categories. This is useful\n'** for filling in the filter banner with the names of\n'** all the categories at the next level in the hierarchy\n'*********************************************************\nFunction get_category_names(categories As Object) As Dynamic\n\n categoryNames = CreateObject(\"roArray\", 100, true)\n\n for each category in categories.kids\n 'print category.Title\n categoryNames.Push(category.Title)\n next\n\n return categoryNames\n\nEnd Function\n\n\n'******************************************************************\n'** Given a connection object for a category feed, fetch,\n'** parse and build the tree for the feed. the results are\n'** stored hierarchically with parent\/child relationships\n'** with a single default node named Root at the root of the tree\n'******************************************************************\nFunction load_category_feed(conn As Object) As Dynamic\n\n http = NewHttp(conn.UrlCategoryFeed)\n\n Dbg(\"url: \", http.Http.GetUrl())\n\n m.Timer.Mark()\n rsp = http.GetToStringWithRetry()\n Dbg(\"Took: \", m.Timer)\n\n m.Timer.Mark()\n xml=CreateObject(\"roXMLElement\")\n if not xml.Parse(rsp) then\n print \"Can't parse feed\"\n return invalid\n endif\n Dbg(\"Parse Took: \", m.Timer)\n\n m.Timer.Mark()\n if xml.category = invalid then\n print \"no categories tag\"\n return invalid\n endif\n\n if islist(xml.category) = false then\n print \"invalid feed body\"\n return invalid\n endif\n\n if xml.category[0].GetName() <> \"category\" then\n print \"no initial category tag\"\n return invalid\n endif\n\n topNode = MakeEmptyCatNode()\n topNode.Title = \"root\"\n topNode.isapphome = true\n\n print \"begin category node parsing\"\n\n categories = xml.GetChildElements()\n print \"number of categories: \" + itostr(categories.Count())\n for each e in categories\n o = ParseCategoryNode(e)\n if o <> invalid then\n topNode.AddKid(o)\n print \"added new child node\"\n else\n print \"parse returned no child node\"\n endif\n next\n Dbg(\"Traversing: \", m.Timer)\n\n return topNode\n\nEnd Function\n\n'******************************************************\n'MakeEmptyCatNode - use to create top node in the tree\n'******************************************************\nFunction MakeEmptyCatNode() As Object\n return init_category_item()\nEnd Function\n\n\n'***********************************************************\n'Given the xml element to an tag in the category\n'feed, walk it and return the top level node to its tree\n'***********************************************************\nFunction ParseCategoryNode(xml As Object) As dynamic\n o = init_category_item()\n\n print \"ParseCategoryNode: \" + xml.GetName()\n 'PrintXML(xml, 5)\n\n 'parse the curent node to determine the type. everything except\n 'special categories are considered normal, others have unique types\n if xml.GetName() = \"category\" then\n print \"category: \" + xml@title + \" | \" + xml@description\n o.Type = \"normal\"\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n elseif xml.GetName() = \"categoryLeaf\" then\n o.Type = \"normal\"\n elseif xml.GetName() = \"specialCategory\" then\n if invalid <> xml.GetAttributes() then\n for each a in xml.GetAttributes()\n if a = \"type\" then\n o.Type = xml.GetAttributes()[a]\n print \"specialCategory: \" + xml@type + \"|\" + xml@title + \" | \" + xml@description\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n endif\n next\n endif\n else\n print \"ParseCategoryNode skip: \" + xml.GetName()\n return invalid\n endif\n\n 'only continue processing if we are dealing with a known type\n 'if new types are supported, make sure to add them to the list\n 'and parse them correctly further downstream in the parser\n while true\n if o.Type = \"normal\" exit while\n if o.Type = \"special_category\" exit while\n print \"ParseCategoryNode unrecognized feed type\"\n return invalid\n end while\n\n 'get the list of child nodes and recursed\n 'through everything under the current node\n for each e in xml.GetBody()\n name = e.GetName()\n if name = \"category\" then\n ' print \"category: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.ShortDescriptionLine1 = xml@Description\n kid.SDPosterURL = xml@sd_img\n kid.HDPosterURL = xml@hd_img\n o.AddKid(kid)\n elseif name = \"categoryLeaf\" then\n ' print \"categoryLeaf: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.Feed = e@feed\n o.AddKid(kid)\n elseif name = \"specialCategory\" then\n ' print \"specialCategory: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.sd_img = e@sd_img\n kid.hd_img = e@hd_img\n kid.Feed = e@feed\n o.AddKid(kid)\n endif\n next\n\n return o\nEnd Function\n\n\n'******************************************************\n'Initialize a Category Item\n'******************************************************\nFunction init_category_item() As Object\n o = CreateObject(\"roAssociativeArray\")\n o.Title = \"\"\n o.Type = \"normal\"\n o.Description = \"\"\n o.Kids = CreateObject(\"roArray\", 100, true)\n o.Parent = invalid\n o.Feed = \"\"\n o.IsLeaf = cn_is_leaf\n o.AddKid = cn_add_kid\n return o\nEnd Function\n\n\n'********************************************************\n'** Helper function for each node, returns true\/false\n'** indicating that this node is a leaf node in the tree\n'********************************************************\nFunction cn_is_leaf() As Boolean\n if m.Kids.Count() > 0 return true\n if m.Feed <> \"\" return false\n return true\nEnd Function\n\n\n'*********************************************************\n'** Helper function for each node in the tree to add a\n'** new node as a child to this node.\n'*********************************************************\nSub cn_add_kid(kid As Object)\n if kid = invalid then\n print \"skipping: attempt to add invalid kid failed\"\n return\n endif\n\n kid.Parent = m\n m.Kids.Push(kid)\nEnd Sub\n","old_contents":"'******************************************************\n'** Video Player Example Application -- Category Feed\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'******************************************************\n\n'******************************************************\n' Set up the category feed connection object\n' This feed provides details about top level categories\n'******************************************************\nFunction InitCategoryFeedConnection() As Object\n\n conn = CreateObject(\"roAssociativeArray\")\n\n conn.UrlPrefix = \"http:\/\/10.0.20.150\/roku\"\n\n conn.UrlCategoryFeed = conn.UrlPrefix + \"\/categories\"\n\n conn.Timer = CreateObject(\"roTimespan\")\n\n conn.LoadCategoryFeed = load_category_feed\n conn.GetCategoryNames = get_category_names\n\n print \"created feed connection for \" + conn.UrlCategoryFeed\n return conn\n\nEnd Function\n\n'*********************************************************\n'** Create an array of names representing the children\n'** for the current list of categories. This is useful\n'** for filling in the filter banner with the names of\n'** all the categories at the next level in the hierarchy\n'*********************************************************\nFunction get_category_names(categories As Object) As Dynamic\n\n categoryNames = CreateObject(\"roArray\", 100, true)\n\n for each category in categories.kids\n 'print category.Title\n categoryNames.Push(category.Title)\n next\n\n return categoryNames\n\nEnd Function\n\n\n'******************************************************************\n'** Given a connection object for a category feed, fetch,\n'** parse and build the tree for the feed. the results are\n'** stored hierarchically with parent\/child relationships\n'** with a single default node named Root at the root of the tree\n'******************************************************************\nFunction load_category_feed(conn As Object) As Dynamic\n\n http = NewHttp(conn.UrlCategoryFeed)\n\n Dbg(\"url: \", http.Http.GetUrl())\n\n m.Timer.Mark()\n rsp = http.GetToStringWithRetry()\n Dbg(\"Took: \", m.Timer)\n\n m.Timer.Mark()\n xml=CreateObject(\"roXMLElement\")\n if not xml.Parse(rsp) then\n print \"Can't parse feed\"\n return invalid\n endif\n Dbg(\"Parse Took: \", m.Timer)\n\n m.Timer.Mark()\n if xml.category = invalid then\n print \"no categories tag\"\n return invalid\n endif\n\n if islist(xml.category) = false then\n print \"invalid feed body\"\n return invalid\n endif\n\n if xml.category[0].GetName() <> \"category\" then\n print \"no initial category tag\"\n return invalid\n endif\n\n topNode = MakeEmptyCatNode()\n topNode.Title = \"root\"\n topNode.isapphome = true\n\n print \"begin category node parsing\"\n\n categories = xml.GetChildElements()\n print \"number of categories: \" + itostr(categories.Count())\n for each e in categories\n o = ParseCategoryNode(e)\n if o <> invalid then\n topNode.AddKid(o)\n print \"added new child node\"\n else\n print \"parse returned no child node\"\n endif\n next\n Dbg(\"Traversing: \", m.Timer)\n\n return topNode\n\nEnd Function\n\n'******************************************************\n'MakeEmptyCatNode - use to create top node in the tree\n'******************************************************\nFunction MakeEmptyCatNode() As Object\n return init_category_item()\nEnd Function\n\n\n'***********************************************************\n'Given the xml element to an tag in the category\n'feed, walk it and return the top level node to its tree\n'***********************************************************\nFunction ParseCategoryNode(xml As Object) As dynamic\n o = init_category_item()\n\n print \"ParseCategoryNode: \" + xml.GetName()\n 'PrintXML(xml, 5)\n\n 'parse the curent node to determine the type. everything except\n 'special categories are considered normal, others have unique types\n if xml.GetName() = \"category\" then\n print \"category: \" + xml@title + \" | \" + xml@description\n o.Type = \"normal\"\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n elseif xml.GetName() = \"categoryLeaf\" then\n o.Type = \"normal\"\n elseif xml.GetName() = \"specialCategory\" then\n if invalid <> xml.GetAttributes() then\n for each a in xml.GetAttributes()\n if a = \"type\" then\n o.Type = xml.GetAttributes()[a]\n print \"specialCategory: \" + xml@type + \"|\" + xml@title + \" | \" + xml@description\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n endif\n next\n endif\n else\n print \"ParseCategoryNode skip: \" + xml.GetName()\n return invalid\n endif\n\n 'only continue processing if we are dealing with a known type\n 'if new types are supported, make sure to add them to the list\n 'and parse them correctly further downstream in the parser\n while true\n if o.Type = \"normal\" exit while\n if o.Type = \"special_category\" exit while\n print \"ParseCategoryNode unrecognized feed type\"\n return invalid\n end while\n\n 'get the list of child nodes and recursed\n 'through everything under the current node\n for each e in xml.GetBody()\n name = e.GetName()\n if name = \"category\" then\n ' print \"category: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.ShortDescriptionLine1 = xml@Description\n kid.SDPosterURL = xml@sd_img\n kid.HDPosterURL = xml@hd_img\n o.AddKid(kid)\n elseif name = \"categoryLeaf\" then\n ' print \"categoryLeaf: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.Feed = e@feed\n o.AddKid(kid)\n elseif name = \"specialCategory\" then\n ' print \"specialCategory: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.sd_img = e@sd_img\n kid.hd_img = e@hd_img\n kid.Feed = e@feed\n o.AddKid(kid)\n endif\n next\n\n return o\nEnd Function\n\n\n'******************************************************\n'Initialize a Category Item\n'******************************************************\nFunction init_category_item() As Object\n o = CreateObject(\"roAssociativeArray\")\n o.Title = \"\"\n o.Type = \"normal\"\n o.Description = \"\"\n o.Kids = CreateObject(\"roArray\", 100, true)\n o.Parent = invalid\n o.Feed = \"\"\n o.IsLeaf = cn_is_leaf\n o.AddKid = cn_add_kid\n return o\nEnd Function\n\n\n'********************************************************\n'** Helper function for each node, returns true\/false\n'** indicating that this node is a leaf node in the tree\n'********************************************************\nFunction cn_is_leaf() As Boolean\n if m.Kids.Count() > 0 return true\n if m.Feed <> \"\" return false\n return true\nEnd Function\n\n\n'*********************************************************\n'** Helper function for each node in the tree to add a\n'** new node as a child to this node.\n'*********************************************************\nSub cn_add_kid(kid As Object)\n if kid = invalid then\n print \"skipping: attempt to add invalid kid failed\"\n return\n endif\n\n kid.Parent = m\n m.Kids.Push(kid)\nEnd Sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"cb213b0aef838f11c794d3163c306c5883399957","subject":"Disabled beta quality feature.","message":"Disabled beta quality feature.\n\n--HG--\nextra : convert_revision : svn%3A1a989651-ce6e-ed51-1896-c0ee68ac2431\/trunk%4027\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/Main.brs","new_file":"source\/Main.brs","new_contents":"sub Main()\n\tLoadTheme()\n\tcategories = LoadConfig()\n\n\tif categories.Count() > 1\n\t\tShowPosterScreen( categories )\n\telse\n\t\tShowEpisodeScreen( categories[0] )\n\tend if\nend sub\n\nsub LoadTheme()\n\tapp = CreateObject( \"roAppManager\" )\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Slice_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Slice_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"40\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"40\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( primaryTextColor )\n\ttheme.breadcrumbDelimiter = ValidStr( primaryTextColor )\n\ttheme.breadcrumbTextRight = ValidStr( primaryTextColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\tapp.SetTheme( theme )\nend sub\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\tend if\n\n\t'result.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"HD\"]\n\t\tstreambitrates:\t\t[0]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","old_contents":"sub Main()\n\tLoadTheme()\n\tcategories = LoadConfig()\n\n\tif categories.Count() > 1\n\t\tShowPosterScreen( categories )\n\telse\n\t\tShowEpisodeScreen( categories[0] )\n\tend if\nend sub\n\nsub LoadTheme()\n\tapp = CreateObject( \"roAppManager\" )\n\ttheme = CreateObject( \"roAssociativeArray\" )\n\ttheme.OverhangSliceSD = \"pkg:\/images\/Overhang_Slice_SD.png\"\n\ttheme.OverhangSliceHD = \"pkg:\/images\/Overhang_Slice_HD.png\"\n\ttheme.OverhanglogoHD = \"pkg:\/images\/Logo_Overhang_JB_HD.png\"\n\ttheme.OverhanglogoSD = \"pkg:\/images\/Logo_Overhang_JB_SD.png\"\n\n\ttheme.OverhangPrimaryLogoOffsetHD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetHD_Y = \"40\"\n\n\ttheme.OverhangPrimaryLogoOffsetSD_X = \"60\"\n\ttheme.OverhangPrimaryLogoOffsetSD_Y = \"40\"\n\n\tbackgroundColor = \"#E0E0E0\"\n\tprimaryTextColor = \"#333333\"\n\tsecondaryTextColor = \"#666666\"\n\ttertiaryTextColor = \"#999999\"\n\n\ttheme.backgroundColor = ValidStr( backgroundColor )\n\ttheme.breadcrumbTextLeft = ValidStr( primaryTextColor )\n\ttheme.breadcrumbDelimiter = ValidStr( primaryTextColor )\n\ttheme.breadcrumbTextRight = ValidStr( primaryTextColor )\n\n\ttheme.posterScreenLine1Text = ValidStr( primaryTextColor )\n\ttheme.posterScreenLine2Text = ValidStr( secondaryTextColor )\n\ttheme.episodeSynopsisText = ValidStr( secondaryTextColor )\n\n\ttheme.springboardTitleText = ValidStr( primaryTextColor )\n\ttheme.springboardSynopsisColor = ValidStr( secondaryTextColor )\n\ttheme.springboardRuntimeColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardDirectorLabelColor = ValidStr( tertiaryTextColor )\n\ttheme.springboardActorColor = ValidStr( tertiaryTextColor )\n\n\tapp.SetTheme( theme )\nend sub\n\nfunction LoadConfig()\n\tresult = []\n\n\tresult.push( GetLiveStream() )\n\n\topml = CreateObject( \"roXMLElement\" )\n\traw = NWM_UT_GetStringFromURL( \"http:\/\/roku.jupitercolony.com\/opml.xml\" ) ' Pull configuration from a remote config file\n\tif opml.Parse( raw )\n\t\tfor each category in opml.body.outline\n\t\t\tresult.Push( BuildCategory( category ) )\n\t\tnext\n\telse ' Fallback if cannot contact server, find file, or parse\n\t\traw = ReadASCIIFile(\"pkg:\/config.opml\") ' Pull configuration from a local config file\n\t\tif opml.Parse( raw )\n\t\t\tfor each category in opml.body.outline\n\t\t\t\tresult.Push( BuildCategory( category ) )\n\t\t\tnext\n\t\tend if\n\tend if\n\n\tresult.push( GetQualityIcon() )\n\n\treturn result\nend function\n\nfunction BuildCategory( category )\n\tresult = {\n\t\ttitle:\t\t\tValidStr( category@title )\n\t\tshortDescriptionLine1:\tValidStr( category@title )\n\t\tshortDescriptionLine2:\tValidStr( category@subtitle )\n\t\tsdPosterURL:\t\tValidStr( category@img )\n\t\thdPosterURL:\t\tValidStr( category@img )\n\t\turl:\t\t\tValidStr( category@url )\n\t\tcategories:\t\t[]\n\t}\n\n\tif category@hqfeed <> invalid\n\t\tresult.url = ValidStr( category@hqfeed )\n\tend if\n\n\tquality = RegRead( \"quality\" )\n\tif quality <> invalid AND strtoi( ValidStr( quality ) ) = 1\n\t\tif category@lqfeed <> invalid\n\t\t\tresult.url = ValidStr( category@lqfeed )\n\t\tend if\n\tend if\n\n\tif category.outline.Count() > 0\n\t\tfor each subCategory in category.outline\n\t\t\tresult.categories.Push( BuildCategory( subCategory ) )\n\t\tnext\n\tend if\n\n\treturn result\nend function\n\nfunction GetLiveStream()\n\tresult = {\n\t\tscreenTarget:\t\t\"livestream\"\n\t\tcalendar:\t\t\"http:\/\/roku.jupitercolony.com\/live-calendar.xml\"\n\t\tlive:\t\t\ttrue\n\t\ttitle:\t\t\t\"Live Stream\"\n\t\tshortDescriptionLine1:\t\"Live Stream\"\n\t\tshortDescriptionLine2:\t\"Watch Jupiter Broadcasting Live!\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tstreamurls:\t\t[\"http:\/\/videocdn-us.geocdn.scaleengine.net\/jblive-iphone\/live\/jblive.stream\/playlist.m3u8\"]\n\t\tstreamformat:\t\t\"hls\"\n\t\tstreamqualities:\t[\"HD\"]\n\t\tstreambitrates:\t\t[0]\n\t\tcategories:\t\t[]\n\t}\n\n\treturn result\nend function\n\nfunction GetQualityIcon()\n\tresult = {\n\t\tscreenTarget:\t\t\"quality\"\n\t\ttitle:\t\t\t\"Quality\"\n\t\tshortDescriptionLine1:\t\"Quality\"\n\t\tshortDescriptionLine2:\t\"Currently set to HQ\"\n\t\tsdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_sd.png\"\n\t\thdPosterURL:\t\t\"pkg:\/images\/mm_icon_focus_hd.jpg\"\n\t\tcontentType:\t\t\"episode\"\n\t\tcategories:\t\t[]\n\t}\n\n\tquality = RegRead( \"quality\" )\n\tif( quality <> invalid AND strtoi( ValidStr( quality ) ) = 1 )\n\t\tresult.shortDescriptionLine2 = \"Currently set to LQ (mobile quality)\"\n\tend if\n\n\treturn result\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"fbe79fbad52a9270c8bb548cd56cdb5c91471b50","subject":"Replaced Play with Watch on livestream screen to remove ambiguity.","message":"Replaced Play with Watch on livestream screen to remove ambiguity.\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/screens\/LivestreamScreen.brs","new_file":"source\/screens\/LivestreamScreen.brs","new_contents":"function ShowLivestreamScreen( livestream )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\t\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\t' Disable star ratings\n\tscreen.SetStaticRatingEnabled( false )\n\t' Add \"Play\" button\n\tLivestream_SetButtons( screen, false )\n\t' Set content to live stream (automatically parses array)\n\tscreen.SetContent( livestream )\n\t' Show screen\n\tscreen.Show()\n\n\t' Fetch calendar feed\n\traw = NWM_UT_GetStringFromURL( livestream.calendar )\n\t' Parse calendar feed\n\tcalendar = CreateObject( \"roXMLElement\" )\n\tif calendar.Parse( raw )\n\t\tislive = false\n\t\tnextevent = invalid\n\t\tnow = CreateObject( \"roDateTime\" )\n\t\tnow.mark()\n\t\tnow_s = now.asSeconds()\n\n\t\tfor each event in calendar.Event\n\t\t\t' Parse start and end times into ints\n\t\t\testart = strtoi( ValidStr( event.start.GetText() ) )\n\t\t\tefinish = strtoi( ValidStr( event.finish.GetText() ) )\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextevent = invalid\n\t\t\t\tnextevent = event\n\t\t\telse\n\t\t\t\t' Parse event's start time\n\t\t\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif estart < nestart AND efinish > now_s\n\t\t\t\t\tnextevent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\tnefinish = strtoi( ValidStr( nextevent.finish.GetText() ) )\n\n\t\tislive = ( nestart < now_s AND nefinish > now_s ) ' If event starts before now and ends after now, it is live\n\t\tdesc = strReplace( nextevent.summary.GetText(), \"LIVE: \", \"\" ) ' Remove \"Live:\" portions from description\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\tnextlive = CreateObject( \"roDateTime\" )\n\t\t\tnextlive.fromSeconds( nestart )\n\t\t\tnextlive.toLocalTime()\n\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + nextlive.asDateString( \"long-date\" ) + \" \"\n\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() )\n\n\t\t\t' Show next live show time (12hr)\n\t\t\tispm = nextlive.getHours() > 11 ' If hours is more than 11, is PM\n\t\t\tdesc = desc + \" (\"\n\t\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\t\tif nextlive.getHours() = 12 ' If is PM and is 12, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() - 12 ) + \":\"\n\t\t\t\tend if\n\t\t\telse ' If is AM show hours\n\t\t\t\tif nextlive.getHours() = 0 ' If is AM and is 0, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\t\tend if\t\t\t\n\t\t\tend if\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() ) + \" \"\n\t\t\tif ispm ' If is PM, show PM\n\t\t\t\tdesc = desc + \"PM\"\n\t\t\telse ' If is AM, show AM\n\t\t\t\tdesc = desc + \"AM\"\n\t\t\tend if\n\t\t\tdesc = desc + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\tlivestream.shortDescriptionLine2 = desc\n\t\tlivestream.description = desc\t\t\n\t\tscreen.SetContent( livestream )\n\t\tscreen.Show()\n\tend if\n\t\n\tAudioStream = CreateAudioPlayer( screen.GetMessagePort() )\n\tAudioStream.SetStream( livestream.audio )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\tAudioStream.Stop()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\tAudioStream.Stop()\n\t\t\t\t\tShowVideoScreen( livestream )\n\t\t\t\telse if msg.GetIndex() = 2\n\t\t\t\t\tAudioStream.Play()\n\t\t\t\telse if msg.GetIndex() = 3\n\t\t\t\t\tAudioStream.Stop()\n\t\t\t\tendif\n\t\t\t\tLivestream_SetButtons( screen, AudioStream.IsPlaying() )\n\t\t\tendif\n\t\tend if\n\tend while\n\n\treturn selectedEpisode\nend function\n\nsub Livestream_SetButtons( screen, isPlaying )\n\tscreen.ClearButtons()\n\tif isPlaying\n\t\tscreen.AddButton( 3, \"Stop Listening\" )\n\telse\n\t\tscreen.AddButton( 1, \"Watch\" )\n\t\tscreen.AddButton( 2, \"Listen\" )\n\tend if\nend sub\n","old_contents":"function ShowLivestreamScreen( livestream )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\t\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\t' Disable star ratings\n\tscreen.SetStaticRatingEnabled( false )\n\t' Add \"Play\" button\n\tLivestream_SetButtons( screen, false )\n\t' Set content to live stream (automatically parses array)\n\tscreen.SetContent( livestream )\n\t' Show screen\n\tscreen.Show()\n\n\t' Fetch calendar feed\n\traw = NWM_UT_GetStringFromURL( livestream.calendar )\n\t' Parse calendar feed\n\tcalendar = CreateObject( \"roXMLElement\" )\n\tif calendar.Parse( raw )\n\t\tislive = false\n\t\tnextevent = invalid\n\t\tnow = CreateObject( \"roDateTime\" )\n\t\tnow.mark()\n\t\tnow_s = now.asSeconds()\n\n\t\tfor each event in calendar.Event\n\t\t\t' Parse start and end times into ints\n\t\t\testart = strtoi( ValidStr( event.start.GetText() ) )\n\t\t\tefinish = strtoi( ValidStr( event.finish.GetText() ) )\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextevent = invalid\n\t\t\t\tnextevent = event\n\t\t\telse\n\t\t\t\t' Parse event's start time\n\t\t\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif estart < nestart AND efinish > now_s\n\t\t\t\t\tnextevent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\tnefinish = strtoi( ValidStr( nextevent.finish.GetText() ) )\n\n\t\tislive = ( nestart < now_s AND nefinish > now_s ) ' If event starts before now and ends after now, it is live\n\t\tdesc = strReplace( nextevent.summary.GetText(), \"LIVE: \", \"\" ) ' Remove \"Live:\" portions from description\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\tnextlive = CreateObject( \"roDateTime\" )\n\t\t\tnextlive.fromSeconds( nestart )\n\t\t\tnextlive.toLocalTime()\n\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + nextlive.asDateString( \"long-date\" ) + \" \"\n\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() )\n\n\t\t\t' Show next live show time (12hr)\n\t\t\tispm = nextlive.getHours() > 11 ' If hours is more than 11, is PM\n\t\t\tdesc = desc + \" (\"\n\t\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\t\tif nextlive.getHours() = 12 ' If is PM and is 12, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() - 12 ) + \":\"\n\t\t\t\tend if\n\t\t\telse ' If is AM show hours\n\t\t\t\tif nextlive.getHours() = 0 ' If is AM and is 0, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\t\tend if\t\t\t\n\t\t\tend if\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() ) + \" \"\n\t\t\tif ispm ' If is PM, show PM\n\t\t\t\tdesc = desc + \"PM\"\n\t\t\telse ' If is AM, show AM\n\t\t\t\tdesc = desc + \"AM\"\n\t\t\tend if\n\t\t\tdesc = desc + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\tlivestream.shortDescriptionLine2 = desc\n\t\tlivestream.description = desc\t\t\n\t\tscreen.SetContent( livestream )\n\t\tscreen.Show()\n\tend if\n\t\n\tAudioStream = CreateAudioPlayer( screen.GetMessagePort() )\n\tAudioStream.SetStream( livestream.audio )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\tAudioStream.Stop()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\tAudioStream.Stop()\n\t\t\t\t\tShowVideoScreen( livestream )\n\t\t\t\telse if msg.GetIndex() = 2\n\t\t\t\t\tAudioStream.Play()\n\t\t\t\telse if msg.GetIndex() = 3\n\t\t\t\t\tAudioStream.Stop()\n\t\t\t\tendif\n\t\t\t\tLivestream_SetButtons( screen, AudioStream.IsPlaying() )\n\t\t\tendif\n\t\tend if\n\tend while\n\n\treturn selectedEpisode\nend function\n\nsub Livestream_SetButtons( screen, isPlaying )\n\tscreen.ClearButtons()\n\tif isPlaying\n\t\tscreen.AddButton( 3, \"Stop Listening\" )\n\telse\n\t\tscreen.AddButton( 1, \"Play\" )\n\t\tscreen.AddButton( 2, \"Listen\" )\n\tend if\nend sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"2872c2e41f32ec7a2f94b990a5cf71eccd95e279","subject":"Some comments added in roku","message":"Some comments added in roku\n","repos":"JunctionTV\/Getting-Access-Tokens,JunctionTV\/Getting-Access-Tokens,JunctionTV\/Getting-Access-Tokens","old_file":"roku\/main.brs","new_file":"roku\/main.brs","new_contents":"'To get the authentication token for Junction TV API calls\n\n'For detailed description read: http:\/\/api.junctiontv.com\/jtv\/jtapi\/getting-access-tokens-2\n'Refer Github: https:\/\/github.com\/JunctionTV\/Getting-Access-Tokens \n\n'-----------------------------------------------------------------------------------------\n' Author: Subhankar Ganguly \n'\n' License: The MIT License (MIT)\n' Copyright (c) <2016> \n'------------------------------------------------------------------------------------------\n\n\nSub Main(args as Dynamic)\nprint \"Main called \"\nrespauth = ApiAuthentication()\nAPIAuthToken = respauth.gettoken(respauth)\nprint \"APIAuthToken : \"+APIAuthToken\nEnd Sub","old_contents":"Sub Main(args as Dynamic)\nprint \"Main called \"\nrespauth = ApiAuthentication()\nAPIAuthToken = respauth.gettoken(respauth)\nprint \"APIAuthToken : \"+APIAuthToken\nEnd Sub","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"18b956326d39f0bdf9a5ff1cada36b24e3db9a43","subject":"Enable gzip compression encoding for HTTP requests.","message":"Enable gzip compression encoding for HTTP requests.\n\n--HG--\nextra : convert_revision : svn%3A1a989651-ce6e-ed51-1896-c0ee68ac2431\/trunk%4011\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/lib\/NWM_Utilities.brs","new_file":"source\/lib\/NWM_Utilities.brs","new_contents":"''\n''\tNWM_Utilities.brs\n''\tchagedorn@roku.com\n''\n''\n\nfunction NWM_Utilities()\n\tthis = {\n\t\tGetStringFromURL:\tNWM_UT_GetStringFromURL\n\t\tHTMLEntityDecode:\tNWM_UT_HTMLEntityDecode\n\t\tHTMLStripTags:\t\tNWM_UT_HTMLStripTags\n\t}\n\t\n\treturn this\nend function\n\nfunction NWM_UT_GetStringFromURL(url, userAgent = \"\")\n\tresult = \"\"\n\ttimeout = 10000\n\t\n ut = CreateObject(\"roURLTransfer\")\n ut.SetPort(CreateObject(\"roMessagePort\"))\n ut.EnableEncodings(true) '' Enable gzip encoding\n if userAgent <> \"\"\n\t ut.AddHeader(\"user-agent\", userAgent)\n\tend if\n ut.SetURL(url)\n\tif ut.AsyncGetToString()\n\t\tevent = wait(timeout, ut.GetPort())\n\t\tif type(event) = \"roUrlEvent\"\n\t\t\t\tprint ValidStr(event.GetResponseCode())\n\t\t\t\tresult = event.GetString()\n\t\t\t\t'exit while \n\t\telseif event = invalid\n\t\t\t\tut.AsyncCancel()\n\t\t\t\tREM reset the connection on timeouts\n\t\t\t\t'ut = CreateURLTransferObject(url)\n\t\t\t\t'timeout = 2 * timeout\n\t\telse\n\t\t\t\tprint \"roUrlTransfer::AsyncGetToString(): unknown event\"\n\t\tendif\n\tend if\n\t\n\treturn result\nend function\n\nfunction NWM_UT_HTMLEntityDecode(inStr)\n\tresult = inStr\n\t\n\trx = CreateObject(\"roRegEx\", \"'\", \"\")\n\tresult = rx.ReplaceAll(result, \"'\")\n\n\trx = CreateObject(\"roRegEx\", \"&\", \"\")\n\tresult = rx.ReplaceAll(result, \"&\")\n\n\trx = CreateObject(\"roRegEx\", \"&(quot|rsquo|lsquo);\", \"\")\n\tresult = rx.ReplaceAll(result, Chr(34))\n\t\n\trx = CreateObject(\"roRegEx\", \"&\\w+;\", \"\")\n\tresult = rx.ReplaceAll(result, Chr(34))\n\t\n\treturn result\nend function\n\nfunction NWM_UT_HTMLStripTags(inStr)\n\tresult = inStr\n\t\n\trx = CreateObject(\"roRegEx\", \"<.*?>\", \"\")\n\tresult = rx.ReplaceAll(result, \"\")\n\n\treturn result\nend function\n","old_contents":"''\n''\tNWM_Utilities.brs\n''\tchagedorn@roku.com\n''\n''\n\nfunction NWM_Utilities()\n\tthis = {\n\t\tGetStringFromURL:\tNWM_UT_GetStringFromURL\n\t\tHTMLEntityDecode:\tNWM_UT_HTMLEntityDecode\n\t\tHTMLStripTags:\t\tNWM_UT_HTMLStripTags\n\t}\n\t\n\treturn this\nend function\n\nfunction NWM_UT_GetStringFromURL(url, userAgent = \"\")\n\tresult = \"\"\n\ttimeout = 10000\n\t\n ut = CreateObject(\"roURLTransfer\")\n ut.SetPort(CreateObject(\"roMessagePort\"))\n if userAgent <> \"\"\n\t ut.AddHeader(\"user-agent\", userAgent)\n\tend if\n ut.SetURL(url)\n\tif ut.AsyncGetToString()\n\t\tevent = wait(timeout, ut.GetPort())\n\t\tif type(event) = \"roUrlEvent\"\n\t\t\t\tprint ValidStr(event.GetResponseCode())\n\t\t\t\tresult = event.GetString()\n\t\t\t\t'exit while \n\t\telseif event = invalid\n\t\t\t\tut.AsyncCancel()\n\t\t\t\tREM reset the connection on timeouts\n\t\t\t\t'ut = CreateURLTransferObject(url)\n\t\t\t\t'timeout = 2 * timeout\n\t\telse\n\t\t\t\tprint \"roUrlTransfer::AsyncGetToString(): unknown event\"\n\t\tendif\n\tend if\n\t\n\treturn result\nend function\n\nfunction NWM_UT_HTMLEntityDecode(inStr)\n\tresult = inStr\n\t\n\trx = CreateObject(\"roRegEx\", \"'\", \"\")\n\tresult = rx.ReplaceAll(result, \"'\")\n\n\trx = CreateObject(\"roRegEx\", \"&\", \"\")\n\tresult = rx.ReplaceAll(result, \"&\")\n\n\trx = CreateObject(\"roRegEx\", \"&(quot|rsquo|lsquo);\", \"\")\n\tresult = rx.ReplaceAll(result, Chr(34))\n\t\n\trx = CreateObject(\"roRegEx\", \"&\\w+;\", \"\")\n\tresult = rx.ReplaceAll(result, Chr(34))\n\t\n\treturn result\nend function\n\nfunction NWM_UT_HTMLStripTags(inStr)\n\tresult = inStr\n\t\n\trx = CreateObject(\"roRegEx\", \"<.*?>\", \"\")\n\tresult = rx.ReplaceAll(result, \"\")\n\n\treturn result\nend function\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"b23adf99f6728bf1bcf8d03e712e15c87074cbcf","subject":"Don't need to be so showy.","message":"Don't need to be so showy.\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/screens\/SpringboardScreen.brs","new_file":"source\/screens\/SpringboardScreen.brs","new_contents":"function ShowSpringboardScreen( episodes, selectedEpisode )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\tPlayStart = RegRead( episodes[selectedEpisode].title )\n\t\t\t\t\tif PlayStart <> invalid then\n\t\t\t\t\t\tepisodes[selectedEpisode].PlayStart = PlayStart.ToInt()\n\t\t\t\t\tend if\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tSpringBoardScreen_setButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\t\tif msg.GetIndex() = 2\n\t\t\t\t\tepisodes[selectedEpisode].PlayStart = 0\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tSpringBoardScreen_setButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\telse if msg.isRemoteKeyPressed()\n\t\t\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\t\t\tif selectedEpisode = 0\n\t\t\t\t\t\tselectedEpisode = episodes.Count() - 1\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode - 1\n\t\t\t\t\tend if\n\t\t\t\t\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\t\t\tif selectedEpisode = episodes.Count() - 1\n\t\t\t\t\t\tselectedEpisode = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode + 1\n\t\t\t\t\tend if\n SpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\tend while\n\treturn selectedEpisode\nend function\n\nsub SpringBoardScreen_showContent( screen, episode )\n SpringBoardScreen_setButtons( screen, episode )\n\n SpringBoardScreen_swapPoster( episode )\n screen.SetContent( episode )\n screen.Show()\n SpringBoardScreen_swapPoster( episode )\nend sub\n\nsub SpringBoardScreen_swapPoster( show )\n\ttmp = show.sdPosterURL\n\tif show.sdPosterURL_hq <> invalid and show.sdPosterURL_hq <> \"\"\n\t\tshow.sdPosterURL = show.sdPosterURL_hq\n\t\tshow.sdPosterURL_hq = tmp\n\tend if\n\ttmp = show.hdPosterURL\n\tif show.hdPosterURL_hq <> invalid and show.hdPosterURL_hq <> \"\"\n\t\tshow.hdPosterURL = show.hdPosterURL_hq\n\t\tshow.hdPosterURL_hq = tmp\n\tend if\nend sub\n\nsub SpringBoardScreen_setButtons( screen, episode )\n\tscreen.ClearButtons()\n\tif RegRead( episode.title ) <> invalid and RegRead( episode.title ).toint() >=30 then\n\t\tscreen.AddButton( 1, \"Resume Playing\" ) \n\t\tscreen.AddButton( 2, \"Play from Beginning\" ) \n\telse\n\t\tscreen.addbutton( 2,\"Play\" )\n\tend if\nend sub\n","old_contents":"function ShowSpringboardScreen( episodes, selectedEpisode )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tif msg.GetIndex() = 1\n\t\t\t\t\tPlayStart = RegRead( episodes[selectedEpisode].title )\n\t\t\t\t\tif PlayStart <> invalid then\n\t\t\t\t\t\tepisodes[selectedEpisode].PlayStart = PlayStart.ToInt()\n\t\t\t\t\tend if\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tSpringBoardScreen_setButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\t\tif msg.GetIndex() = 2\n\t\t\t\t\tepisodes[selectedEpisode].PlayStart = 0\n\t\t\t\t\tShowVideoScreen( episodes[selectedEpisode] )\n\t\t\t\t\tSpringBoardScreen_setButtons( screen, episodes[selectedEpisode] )\n\t\t\t\t\tscreen.Show()\n\t\t\t\tend if\n\t\t\telse if msg.isRemoteKeyPressed()\n\t\t\t\tif msg.GetIndex() = 4 ' LEFT\n\t\t\t\t\tif selectedEpisode = 0\n\t\t\t\t\t\tselectedEpisode = episodes.Count() - 1\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode - 1\n\t\t\t\t\tend if\n\t\t\t\t\tSpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\telse if msg.GetIndex() = 5 ' RIGHT\n\t\t\t\t\tif selectedEpisode = episodes.Count() - 1\n\t\t\t\t\t\tselectedEpisode = 0\n\t\t\t\t\telse\n\t\t\t\t\t\tselectedEpisode = selectedEpisode + 1\n\t\t\t\t\tend if\n SpringBoardScreen_showContent( screen, episodes[selectedEpisode] )\n\t\t\t\tend if\n\t\t\tend if\n\t\tend if\n\tend while\n\treturn selectedEpisode\nend function\n\nsub SpringBoardScreen_showContent( screen, episode )\n SpringBoardScreen_setButtons( screen, episode )\n screen.Show()\n\n SpringBoardScreen_swapPoster( episode )\n screen.SetContent( episode )\n screen.Show()\n SpringBoardScreen_swapPoster( episode )\nend sub\n\nsub SpringBoardScreen_swapPoster( show )\n\ttmp = show.sdPosterURL\n\tif show.sdPosterURL_hq <> invalid and show.sdPosterURL_hq <> \"\"\n\t\tshow.sdPosterURL = show.sdPosterURL_hq\n\t\tshow.sdPosterURL_hq = tmp\n\tend if\n\ttmp = show.hdPosterURL\n\tif show.hdPosterURL_hq <> invalid and show.hdPosterURL_hq <> \"\"\n\t\tshow.hdPosterURL = show.hdPosterURL_hq\n\t\tshow.hdPosterURL_hq = tmp\n\tend if\nend sub\n\nsub SpringBoardScreen_setButtons( screen, episode )\n\tscreen.ClearButtons()\n\tif RegRead( episode.title ) <> invalid and RegRead( episode.title ).toint() >=30 then\n\t\tscreen.AddButton( 1, \"Resume Playing\" ) \n\t\tscreen.AddButton( 2, \"Play from Beginning\" ) \n\telse\n\t\tscreen.addbutton( 2,\"Play\" )\n\tend if\nend sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"62ee6c6eda016c61cabc06aee86849a12b198279","subject":"Updating category feed to point to production","message":"Updating category feed to point to production\n","repos":"NewSpring\/Public-Roku","old_file":"apps\/source\/kidspring-public\/source\/categoryFeed.brs","new_file":"apps\/source\/kidspring-public\/source\/categoryFeed.brs","new_contents":"'******************************************************\n'** Video Player Example Application -- Category Feed\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'******************************************************\n\n'******************************************************\n' Set up the category feed connection object\n' This feed provides details about top level categories\n'******************************************************\nFunction InitCategoryFeedConnection() As Object\n\n conn = CreateObject(\"roAssociativeArray\")\n\n ' This also must be updated in analytics brs\n conn.UrlPrefix = \"http:\/\/newspring.cc\/roku\"\n\n conn.UrlCategoryFeed = conn.UrlPrefix + \"\/kidspring\"\n\n conn.Timer = CreateObject(\"roTimespan\")\n\n conn.LoadCategoryFeed = load_category_feed\n conn.GetCategoryNames = get_category_names\n\n print \"created feed connection for \" + conn.UrlCategoryFeed\n return conn\n\nEnd Function\n\n'*********************************************************\n'** Create an array of names representing the children\n'** for the current list of categories. This is useful\n'** for filling in the filter banner with the names of\n'** all the categories at the next level in the hierarchy\n'*********************************************************\nFunction get_category_names(categories As Object) As Dynamic\n\n categoryNames = CreateObject(\"roArray\", 100, true)\n\n for each category in categories.kids\n 'print category.Title\n categoryNames.Push(category.Title)\n next\n\n return categoryNames\n\nEnd Function\n\n\n'******************************************************************\n'** Given a connection object for a category feed, fetch,\n'** parse and build the tree for the feed. the results are\n'** stored hierarchically with parent\/child relationships\n'** with a single default node named Root at the root of the tree\n'******************************************************************\nFunction load_category_feed(conn As Object) As Dynamic\n\n http = NewHttp(conn.UrlCategoryFeed)\n\n Dbg(\"url: \", http.Http.GetUrl())\n\n m.Timer.Mark()\n rsp = http.GetToStringWithRetry()\n Dbg(\"Took: \", m.Timer)\n\n m.Timer.Mark()\n xml=CreateObject(\"roXMLElement\")\n if not xml.Parse(rsp) then\n print \"Can't parse feed\"\n return invalid\n endif\n Dbg(\"Parse Took: \", m.Timer)\n\n m.Timer.Mark()\n if xml.category = invalid then\n print \"no categories tag\"\n return invalid\n endif\n\n if islist(xml.category) = false then\n print \"invalid feed body\"\n return invalid\n endif\n\n if xml.category[0].GetName() <> \"category\" then\n print \"no initial category tag\"\n return invalid\n endif\n\n topNode = MakeEmptyCatNode()\n topNode.Title = \"root\"\n topNode.isapphome = true\n\n print \"begin category node parsing\"\n\n categories = xml.GetChildElements()\n print \"number of categories: \" + itostr(categories.Count())\n for each e in categories\n o = ParseCategoryNode(e)\n if o <> invalid then\n topNode.AddKid(o)\n print \"added new child node\"\n else\n print \"parse returned no child node\"\n endif\n next\n Dbg(\"Traversing: \", m.Timer)\n\n return topNode\n\nEnd Function\n\n'******************************************************\n'MakeEmptyCatNode - use to create top node in the tree\n'******************************************************\nFunction MakeEmptyCatNode() As Object\n return init_category_item()\nEnd Function\n\n\n'***********************************************************\n'Given the xml element to an tag in the category\n'feed, walk it and return the top level node to its tree\n'***********************************************************\nFunction ParseCategoryNode(xml As Object) As dynamic\n o = init_category_item()\n\n print \"ParseCategoryNode: \" + xml.GetName()\n 'PrintXML(xml, 5)\n\n 'parse the curent node to determine the type. everything except\n 'special categories are considered normal, others have unique types\n if xml.GetName() = \"category\" then\n print \"category: \" + xml@title + \" | \" + xml@description\n o.Type = \"normal\"\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n elseif xml.GetName() = \"categoryLeaf\" then\n o.Type = \"normal\"\n elseif xml.GetName() = \"specialCategory\" then\n if invalid <> xml.GetAttributes() then\n for each a in xml.GetAttributes()\n if a = \"type\" then\n o.Type = xml.GetAttributes()[a]\n print \"specialCategory: \" + xml@type + \"|\" + xml@title + \" | \" + xml@description\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n endif\n next\n endif\n else\n print \"ParseCategoryNode skip: \" + xml.GetName()\n return invalid\n endif\n\n 'only continue processing if we are dealing with a known type\n 'if new types are supported, make sure to add them to the list\n 'and parse them correctly further downstream in the parser\n while true\n if o.Type = \"normal\" exit while\n if o.Type = \"special_category\" exit while\n print \"ParseCategoryNode unrecognized feed type\"\n return invalid\n end while\n\n 'get the list of child nodes and recursed\n 'through everything under the current node\n for each e in xml.GetBody()\n name = e.GetName()\n if name = \"category\" then\n ' print \"category: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.ShortDescriptionLine1 = xml@Description\n kid.SDPosterURL = xml@sd_img\n kid.HDPosterURL = xml@hd_img\n o.AddKid(kid)\n elseif name = \"categoryLeaf\" then\n ' print \"categoryLeaf: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.Feed = e@feed\n o.AddKid(kid)\n elseif name = \"specialCategory\" then\n ' print \"specialCategory: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.sd_img = e@sd_img\n kid.hd_img = e@hd_img\n kid.Feed = e@feed\n o.AddKid(kid)\n endif\n next\n\n return o\nEnd Function\n\n\n'******************************************************\n'Initialize a Category Item\n'******************************************************\nFunction init_category_item() As Object\n o = CreateObject(\"roAssociativeArray\")\n o.Title = \"\"\n o.Type = \"normal\"\n o.Description = \"\"\n o.Kids = CreateObject(\"roArray\", 100, true)\n o.Parent = invalid\n o.Feed = \"\"\n o.IsLeaf = cn_is_leaf\n o.AddKid = cn_add_kid\n return o\nEnd Function\n\n\n'********************************************************\n'** Helper function for each node, returns true\/false\n'** indicating that this node is a leaf node in the tree\n'********************************************************\nFunction cn_is_leaf() As Boolean\n if m.Kids.Count() > 0 return true\n if m.Feed <> \"\" return false\n return true\nEnd Function\n\n\n'*********************************************************\n'** Helper function for each node in the tree to add a\n'** new node as a child to this node.\n'*********************************************************\nSub cn_add_kid(kid As Object)\n if kid = invalid then\n print \"skipping: attempt to add invalid kid failed\"\n return\n endif\n\n kid.Parent = m\n m.Kids.Push(kid)\nEnd Sub\n","old_contents":"'******************************************************\n'** Video Player Example Application -- Category Feed\n'** November 2009\n'** Copyright (c) 2009 Roku Inc. All Rights Reserved.\n'******************************************************\n\n'******************************************************\n' Set up the category feed connection object\n' This feed provides details about top level categories\n'******************************************************\nFunction InitCategoryFeedConnection() As Object\n\n conn = CreateObject(\"roAssociativeArray\")\n\n ' This also must be updated in analytics brs\n conn.UrlPrefix = \"http:\/\/newspring.dev.10.0.200.164.xip.io\/roku\"\n\n conn.UrlCategoryFeed = conn.UrlPrefix + \"\/kidspring\"\n\n conn.Timer = CreateObject(\"roTimespan\")\n\n conn.LoadCategoryFeed = load_category_feed\n conn.GetCategoryNames = get_category_names\n\n print \"created feed connection for \" + conn.UrlCategoryFeed\n return conn\n\nEnd Function\n\n'*********************************************************\n'** Create an array of names representing the children\n'** for the current list of categories. This is useful\n'** for filling in the filter banner with the names of\n'** all the categories at the next level in the hierarchy\n'*********************************************************\nFunction get_category_names(categories As Object) As Dynamic\n\n categoryNames = CreateObject(\"roArray\", 100, true)\n\n for each category in categories.kids\n 'print category.Title\n categoryNames.Push(category.Title)\n next\n\n return categoryNames\n\nEnd Function\n\n\n'******************************************************************\n'** Given a connection object for a category feed, fetch,\n'** parse and build the tree for the feed. the results are\n'** stored hierarchically with parent\/child relationships\n'** with a single default node named Root at the root of the tree\n'******************************************************************\nFunction load_category_feed(conn As Object) As Dynamic\n\n http = NewHttp(conn.UrlCategoryFeed)\n\n Dbg(\"url: \", http.Http.GetUrl())\n\n m.Timer.Mark()\n rsp = http.GetToStringWithRetry()\n Dbg(\"Took: \", m.Timer)\n\n m.Timer.Mark()\n xml=CreateObject(\"roXMLElement\")\n if not xml.Parse(rsp) then\n print \"Can't parse feed\"\n return invalid\n endif\n Dbg(\"Parse Took: \", m.Timer)\n\n m.Timer.Mark()\n if xml.category = invalid then\n print \"no categories tag\"\n return invalid\n endif\n\n if islist(xml.category) = false then\n print \"invalid feed body\"\n return invalid\n endif\n\n if xml.category[0].GetName() <> \"category\" then\n print \"no initial category tag\"\n return invalid\n endif\n\n topNode = MakeEmptyCatNode()\n topNode.Title = \"root\"\n topNode.isapphome = true\n\n print \"begin category node parsing\"\n\n categories = xml.GetChildElements()\n print \"number of categories: \" + itostr(categories.Count())\n for each e in categories\n o = ParseCategoryNode(e)\n if o <> invalid then\n topNode.AddKid(o)\n print \"added new child node\"\n else\n print \"parse returned no child node\"\n endif\n next\n Dbg(\"Traversing: \", m.Timer)\n\n return topNode\n\nEnd Function\n\n'******************************************************\n'MakeEmptyCatNode - use to create top node in the tree\n'******************************************************\nFunction MakeEmptyCatNode() As Object\n return init_category_item()\nEnd Function\n\n\n'***********************************************************\n'Given the xml element to an tag in the category\n'feed, walk it and return the top level node to its tree\n'***********************************************************\nFunction ParseCategoryNode(xml As Object) As dynamic\n o = init_category_item()\n\n print \"ParseCategoryNode: \" + xml.GetName()\n 'PrintXML(xml, 5)\n\n 'parse the curent node to determine the type. everything except\n 'special categories are considered normal, others have unique types\n if xml.GetName() = \"category\" then\n print \"category: \" + xml@title + \" | \" + xml@description\n o.Type = \"normal\"\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n elseif xml.GetName() = \"categoryLeaf\" then\n o.Type = \"normal\"\n elseif xml.GetName() = \"specialCategory\" then\n if invalid <> xml.GetAttributes() then\n for each a in xml.GetAttributes()\n if a = \"type\" then\n o.Type = xml.GetAttributes()[a]\n print \"specialCategory: \" + xml@type + \"|\" + xml@title + \" | \" + xml@description\n o.Title = xml@title\n o.Description = xml@Description\n o.ShortDescriptionLine1 = xml@Title\n o.ShortDescriptionLine2 = xml@Description\n o.SDPosterURL = xml@sd_img\n o.HDPosterURL = xml@hd_img\n endif\n next\n endif\n else\n print \"ParseCategoryNode skip: \" + xml.GetName()\n return invalid\n endif\n\n 'only continue processing if we are dealing with a known type\n 'if new types are supported, make sure to add them to the list\n 'and parse them correctly further downstream in the parser\n while true\n if o.Type = \"normal\" exit while\n if o.Type = \"special_category\" exit while\n print \"ParseCategoryNode unrecognized feed type\"\n return invalid\n end while\n\n 'get the list of child nodes and recursed\n 'through everything under the current node\n for each e in xml.GetBody()\n name = e.GetName()\n if name = \"category\" then\n ' print \"category: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.ShortDescriptionLine1 = xml@Description\n kid.SDPosterURL = xml@sd_img\n kid.HDPosterURL = xml@hd_img\n o.AddKid(kid)\n elseif name = \"categoryLeaf\" then\n ' print \"categoryLeaf: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.Feed = e@feed\n o.AddKid(kid)\n elseif name = \"specialCategory\" then\n ' print \"specialCategory: \" + e@title + \" [\" + e@description + \"]\"\n kid = ParseCategoryNode(e)\n kid.Title = e@title\n kid.Description = e@Description\n kid.sd_img = e@sd_img\n kid.hd_img = e@hd_img\n kid.Feed = e@feed\n o.AddKid(kid)\n endif\n next\n\n return o\nEnd Function\n\n\n'******************************************************\n'Initialize a Category Item\n'******************************************************\nFunction init_category_item() As Object\n o = CreateObject(\"roAssociativeArray\")\n o.Title = \"\"\n o.Type = \"normal\"\n o.Description = \"\"\n o.Kids = CreateObject(\"roArray\", 100, true)\n o.Parent = invalid\n o.Feed = \"\"\n o.IsLeaf = cn_is_leaf\n o.AddKid = cn_add_kid\n return o\nEnd Function\n\n\n'********************************************************\n'** Helper function for each node, returns true\/false\n'** indicating that this node is a leaf node in the tree\n'********************************************************\nFunction cn_is_leaf() As Boolean\n if m.Kids.Count() > 0 return true\n if m.Feed <> \"\" return false\n return true\nEnd Function\n\n\n'*********************************************************\n'** Helper function for each node in the tree to add a\n'** new node as a child to this node.\n'*********************************************************\nSub cn_add_kid(kid As Object)\n if kid = invalid then\n print \"skipping: attempt to add invalid kid failed\"\n return\n endif\n\n kid.Parent = m\n m.Kids.Push(kid)\nEnd Sub\n","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"04043f355c1e706beb7a9d93e5bfdb5bf1afaf00","subject":"Added 12hr clock to \"Next Live Show\" display. Commented calendar capture and display.","message":"Added 12hr clock to \"Next Live Show\" display. Commented calendar capture and display.\n\n--HG--\nextra : convert_revision : svn%3A1a989651-ce6e-ed51-1896-c0ee68ac2431\/trunk%4018\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/screens\/LivestreamScreen.brs","new_file":"source\/screens\/LivestreamScreen.brs","new_contents":"function ShowLivestreamScreen( livestream )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\t\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\t' Disable star ratings\n\tscreen.SetStaticRatingEnabled( false )\n\t' Add \"Play\" button\n\tscreen.AddButton( 1, \"Play\" )\n\t' Set content to live stream (automatically parses array)\n\tscreen.SetContent( livestream )\n\t' Show screen\n\tscreen.Show()\n\n\t' Fetch calendar feed\n\traw = NWM_UT_GetStringFromURL( livestream.calendar )\n\t' Parse calendar feed\n\tcalendar = CreateObject( \"roXMLElement\" )\n\tif calendar.Parse( raw )\n\t\tislive = false\n\t\tnextevent = invalid\n\t\tnow = CreateObject( \"roDateTime\" )\n\t\tnow.mark()\n\t\tnow_s = now.asSeconds()\n\n\t\tfor each event in calendar.Event\n\t\t\t' Parse start and end times into ints\n\t\t\testart = strtoi( ValidStr( event.start.GetText() ) )\n\t\t\tefinish = strtoi( ValidStr( event.finish.GetText() ) )\n\t\t\t' If nextevent is not set, set to current event (first run)\n\t\t\tif nextevent = invalid\n\t\t\t\tnextevent = event\n\t\t\telse\n\t\t\t\t' Parse event's start time\n\t\t\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\t\t\t' If event starts before nextevent and finishes after current time\n\t\t\t\tif estart < nestart AND efinish > now_s\n\t\t\t\t\tnextevent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\tnefinish = strtoi( ValidStr( nextevent.finish.GetText() ) )\n\t\t\n\t\tislive = ( nestart < now_s AND nefinish > now_s ) ' If event starts before now and ends after now, it is live\n\t\tdesc = strReplace( nextevent.summary.GetText(), \"LIVE: \", \"\" ) ' Remove \"Live:\" portions from description\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\tnextlive = CreateObject( \"roDateTime\" )\n\t\t\tnextlive.fromSeconds( nestart )\n\t\t\tnextlive.toLocalTime()\n\t\t\t\n\t\t\t' Show next live show name and date\n\t\t\tdesc = \"Next Live Show: \" + desc + nl()\n\t\t\tdesc = desc + nextlive.asDateString( \"long-date\" ) + \" \"\n\t\t\t\n\t\t\t' Show next live show time (24hr)\n\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() )\n\t\t\t\n\t\t\t' Show next live show time (12hr)\n\t\t\tispm = nextlive.getHours() > 11 ' If hours is more than 11, is PM\n\t\t\tdesc = desc + \" (\"\n\t\t\tif ispm ' If is PM, subtract 12 and show hours\n\t\t\t\tif nextlive.getHours() = 12 ' If is PM and is 12, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() - 12 ) + \":\"\n\t\t\t\tend if\n\t\t\telse ' If is AM show hours\n\t\t\t\tif nextlive.getHours() = 0 ' If is AM and is 0, show 12\n\t\t\t\t\tdesc = desc + \"12:\"\n\t\t\t\telse\n\t\t\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\t\tend if\t\t\t\n\t\t\tend if\n\t\t\tif nextlive.getMinutes() < 10 ' If less than 10 minutes, add leading zero\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() ) + \" \"\n\t\t\tif ispm ' If is PM, show PM\n\t\t\t\tdesc = desc + \"PM\"\n\t\t\telse ' If is AM, show AM\n\t\t\t\tdesc = desc + \"AM\"\n\t\t\tend if\n\t\t\tdesc = desc + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\tlivestream.shortDescriptionLine2 = desc\n\t\tlivestream.description = desc\t\t\n\t\tscreen.SetContent( livestream )\n\t\tscreen.Show()\n\tend if\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\t\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tShowVideoScreen( livestream )\n\t\t\tendif\n\t\tend if\n\tend while\n\n\treturn selectedEpisode\nend function","old_contents":"function ShowLivestreamScreen( livestream )\n\tscreen = CreateObject( \"roSpringboardScreen\" )\n\tscreen.SetMessagePort( CreateObject( \"roMessagePort\" ) )\t\n\n\t'screen.setAdURL( sdAd, hdAd )\n\t'screen.setAdSelectable( false )\n\n\tscreen.SetStaticRatingEnabled( false )\n\tscreen.AddButton( 1, \"Play\" )\n\tscreen.SetContent( livestream )\n\tscreen.Show()\n\n\traw = NWM_UT_GetStringFromURL( livestream.calendar )\n\tcalendar = CreateObject( \"roXMLElement\" )\n\tif calendar.Parse( raw )\n\t\tislive = false\n\t\tnextevent = invalid\n\t\tnow = CreateObject( \"roDateTime\" )\n\t\tnow.mark()\n\t\tnow_s = now.asSeconds()\n\n\t\tfor each event in calendar.Event\n\t\t\testart = strtoi( ValidStr( event.start.GetText() ) )\n\t\t\tefinish = strtoi( ValidStr( event.finish.GetText() ) )\n\t\t\tif nextevent = invalid\n\t\t\t\tnextevent = event\n\t\t\telse\n\t\t\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\t\t\tif estart < nestart AND efinish > now_s\n\t\t\t\t\tnextevent = event\n\t\t\t\tend if\n\t\t\tend if\n\t\tnext\n\t\tnestart = strtoi( ValidStr( nextevent.start.GetText() ) )\n\t\tnefinish = strtoi( ValidStr( nextevent.finish.GetText() ) )\n\t\tislive = ( nestart < now_s AND nefinish > now_s )\n\t\tdesc = strReplace( nextevent.summary.GetText(), \"LIVE: \", \"\" )\n\t\tif islive\n\t\t\tdesc = \"LIVE NOW: \" + desc\n\t\telse\n\t\t\tnextlive = CreateObject( \"roDateTime\" )\n\t\t\tnextlive.fromSeconds( nestart )\n\t\t\tnextlive.toLocalTime()\n\t\t\tdesc = \"Next Live Show:\" + nl() + desc + \" (\"\n\t\t\tdesc = desc + nextlive.asDateString( \"long-date\" ) + \" \"\n\t\t\tdesc = desc + itostr( nextlive.getHours() ) + \":\"\n\t\t\tif nextlive.getMinutes() < 10\n\t\t\t\tdesc = desc + \"0\"\n\t\t\tend if\n\t\t\tdesc = desc + itostr( nextlive.getMinutes() ) + \")\"\n\t\tend if\n\n\t\tdesc = desc + nl() + nl() + \"Live pre-shows generally start approximately 15 minutes before shows.\"\n\n\t\tlivestream.shortDescriptionLine2 = desc\n\t\tlivestream.description = desc\t\t\n\t\tscreen.SetContent( livestream )\n\t\tscreen.Show()\n\tend if\n\n\twhile true\n\t\tmsg = wait( 0, screen.GetMessagePort() )\n\t\t\n\t\tif msg <> invalid\n\t\t\tif msg.isScreenClosed()\n\t\t\t\texit while\n\t\t\telse if msg.isButtonPressed()\n\t\t\t\tShowVideoScreen( livestream )\n\t\t\tendif\n\t\tend if\n\tend while\n\n\treturn selectedEpisode\nend function","returncode":0,"stderr":"","license":"mit","lang":"Brightscript"} {"commit":"1b72423fe556b941be40f0f1c5df5e886f48300c","subject":"Added simple loading dialog.","message":"Added simple loading dialog.\n","repos":"cbojar\/jb-roku,cdgeeko\/jb-roku","old_file":"source\/dialogs\/LoadingDialog.brs","new_file":"source\/dialogs\/LoadingDialog.brs","new_contents":"Function ShowLoadingDialog( title=\"\", showBusy = false ) As Object\n\tdialog = CreateObject( \"roOneLineDialog\" )\n\n\tdialog.SetTitle( title )\n\tif showBusy\n\t\tdialog.ShowBusyAnimation()\n\tend if\n\tdialog.Show()\n\t\n\treturn dialog\nEnd Function\n","old_contents":"","returncode":1,"stderr":"error: pathspec 'source\/dialogs\/LoadingDialog.brs' did not match any file(s) known to git\n","license":"mit","lang":"Brightscript"} {"commit":"d019b462f4ef8f5ad53e2d431b256df45dae5dd1","subject":"Create WatchedStatusTracker to encapsulate tracking all watch progress.","message":"Create WatchedStatusTracker to encapsulate tracking all watch progress.\n","repos":"cdgeeko\/jb-roku,cbojar\/jb-roku","old_file":"source\/lib\/WatchedStatusTracker.brs","new_file":"source\/lib\/WatchedStatusTracker.brs","new_contents":"function WatchedStatusTracker()\n\tinstance = CreateObject(\"roAssociativeArray\")\n\n\tinstance.saveProgress = function(title as String, currentPosition as Integer)\n\t\tif(currentPosition < 30)\n\t\t\treturn false\n\t\tend if\n\n\t\tRegWrite(title, currentPosition.toStr())\n\t\treturn true\n\tend function\n\n\tinstance.getProgress = function(title as String)\n\t\tsavedProgress = RegRead(title)\n\t\tif savedProgress = invalid\n\t\t\treturn 0\n\t\tend if\n\t\t\n\t\treturn savedProgress.toInt()\n\tend function\n\n\tinstance.hasProgress = function(title as String)\n\t\tsavedProgress = RegRead(title)\n\t\treturn savedProgress <> invalid\n\tend function\n\n\tinstance.removeProgress = function(title as String)\n\t\tRegDelete(title)\n\tend function\n\n\treturn instance\nend function","old_contents":"","returncode":1,"stderr":"error: pathspec 'source\/lib\/WatchedStatusTracker.brs' did not match any file(s) known to git\n","license":"mit","lang":"Brightscript"} {"commit":"86f93d15e0e332e54e7f6bcf4a8a3ab7a523fd69","subject":"updates roku SG app to allow theming of hud","message":"updates roku SG app to allow theming of hud\n","repos":"oddnetworks\/odd-sample-apps,oddnetworks\/odd-sample-apps","old_file":"roku\/scenegraph\/dev\/source\/main.brs","new_file":"roku\/scenegraph\/dev\/source\/main.brs","new_contents":"","old_contents":"","returncode":128,"stderr":"remote: Support for password authentication was removed on August 13, 2021.\nremote: Please see https:\/\/docs.github.com\/en\/get-started\/getting-started-with-git\/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.\nfatal: Authentication failed for 'https:\/\/github.com\/oddnetworks\/odd-sample-apps.git\/'\n","license":"apache-2.0","lang":"Brightscript"}