diff --git a/components/s0/s0.brs b/components/s0/s0.brs index f03f720..389815c 100644 --- a/components/s0/s0.brs +++ b/components/s0/s0.brs @@ -5,9 +5,8 @@ sub init() m.top.appendChild(oh) m.Overhang = oh - ps = createObject("roSGNode", "PanelSet") - m.top.appendChild(ps) - m.panelSet = ps + m.panelSet = createObject("roSGNode", "PanelSet") + m.top.appendChild(m.panelSet) oh.showOptions = true loadCategories() @@ -19,29 +18,16 @@ sub initVideoPlayer() m.video = createObject("roSGNode", "Video") m.video.visible = false m.top.appendChild(m.video) - m.video.observeField("state","controlvideoplay") -end sub - -sub controlvideoplay() - print m.video.state - if (m.video.state = "finished") then - m.video.control = "stop" - 'm.videolist.setFocus(true) - m.video.visible = false - else if(m.video.state = "error") then - m.listpanel4.random = RND(999999) - end if end sub function onKeyEvent(key as string,press as boolean) as boolean + ' This event is an overhead, but we have live with it. if press then if key = "back" - if (m.video.state = "playing") + if (m.video.visible) m.video.control = "stop" - 'm.videolist.setFocus(true) m.video.visible = false - m.listpanel4.random = RND(999999) - ''m.listpanel4.setFocus(true) + m.mediaSourcesPanel.lastFocusNode.setFocus(true) return true end if end if @@ -80,46 +66,36 @@ end sub sub showcategorymedia() categorycontent = m.categoriespanel.list.content.getChild(m.categoriespanel.list.itemFocused) m.gridPanel.categoryKey = categorycontent.ShortDescriptionLine1 + m.Overhang.title = categorycontent.title end sub sub setpanels() m.categoriespanel = m.panelSet.createChild("s1") m.gridPanel = m.panelSet.createChild("s2") - m.listpanel3 = createObject("RoSGNode","s3") - m.listpanel4 = createObject("RoSGNode", "s4") - m.listpanel4.video = m.video - - m.listpanel3.topcontainer = m.top - m.listpanel3.gridPanel = m.gridPanel m.gridPanel.grid.observeField("itemFocused", "showCurrentSelectedMediaInfo") - m.gridPanel.observeField("focusedChild", "slidepanels") - m.listpanel3.observeField("focusedChild", "slidepanels1") end sub sub showCurrentSelectedMediaInfo() currentSelectedMediaItem = m.gridPanel.grid.content.getChild(m.gridPanel.grid.itemFocused) - m.Overhang.title = currentSelectedMediaItem.shortdescriptionline1 - m.listpanel3.mediaItem = currentSelectedMediaItem + + m.posterPanel = createObject("RoSGNode","s3") + m.posterPanel.mediaItem = currentSelectedMediaItem + m.gridPanel.nextPanel = m.posterPanel + m.posterPanel.observeField("focusedChild", "onFucusPosterPanel") print "selection changed" end sub -sub slidepanels() +sub onFucusPosterPanel() if not m.panelSet.isGoingBack - if m.panelSet.leftPanelIndex = 0 then - m.panelSet.appendChild(m.listpanel3) - end if + m.posterPanel.posterMode = "full" + mediaSourcesPanel = createObject("RoSGNode", "s4") + mediaSourcesPanel.video = m.video + m.mediaSourcesPanel = mediaSourcesPanel + m.panelSet.appendChild(mediaSourcesPanel) + currentSelectedMediaItem = m.gridPanel.grid.content.getChild(m.gridPanel.grid.itemFocused) + mediaSourcesPanel.mediaItem = currentSelectedMediaItem + m.mediaSourcesPanel.setFocus(true) else - m.listpanel3.posterMode = "normal" - m.gridPanel.setFocus(true) - end if -end sub - -sub slidepanels1() - if not m.panelSet.isGoingBack - if m.panelSet.leftPanelIndex = 1 then - m.listpanel3.posterMode = "full" - m.panelSet.appendChild(m.listpanel4) - m.listpanel4.mediaItem = m.listpanel3.mediaItem - end if + m.posterPanel.posterMode = "" end if end sub \ No newline at end of file diff --git a/components/s2/s2.brs b/components/s2/s2.brs index 84029c4..e4ff88d 100644 --- a/components/s2/s2.brs +++ b/components/s2/s2.brs @@ -4,7 +4,7 @@ sub init() m.top.focusable = true m.top.hasNextPanel = true ' m.top.leftPosition = 130 - m.top.createNextPanelOnItemFocus = false + m.top.createNextPanelOnItemFocus = true m.top.selectButtonMovesPanelForward = true m.top.optionsAvailable = false m.top.grid = m.top.findNode("posterGridCategoryMedia") @@ -44,54 +44,57 @@ end function sub showpostergrid() resultAsJson = ParseJSON(m.readPosterGridTask.content) - parsedContent = createObject("roSGNode", "ContentNode") - for each mediaItem in resultAsJson.items - gridPoster = createObject("roSGNode", "ContentNode") - gridPoster.id = mediaItem.imdbInfo.id - gridPoster.shortdescriptionline1 = mediaItem.imdbInfo.title - gridPoster.Description = mediaItem.imdbInfo.plot - if IsString(mediaItem.mediaSourceUrl) - ' gridPoster.SDPosterUrl = "http://mediacatalogadmin.herokuapp.com" + mediaItem.imdbInfo.posterThumb - ' gridPoster.HDPosterUrl = "http://mediacatalogadmin.herokuapp.com" + mediaItem.imdbInfo.posterThumb - gridPoster.SDPosterUrl = mediaItem.imdbInfo.posterThumb - gridPoster.HDPosterUrl = mediaItem.imdbInfo.posterThumb - gridPoster.Url = mediaItem.imdbInfo.posterHD + if resultAsJson <> invalid - sources = CreateObject("roArray", 1, true) - sources.push("http://mediacatalogadmin.herokuapp.com" + mediaItem.mediaSourceUrl) - gridPoster.StreamContentIDs = sources - else - sources = CreateObject("roArray", mediaItem.mediaSources.Count(), true) - for each source in mediaItem.mediaSources - streamUrl = "http://apighost.herokuapp.com/api/gddirectstreamurl/" + source.id - headerStrigify = "" - if (IsString(source.streamUrl) and source.streamUrl <> "") - streamUrl = source.streamUrl - end if - if (IsArray(source.headers)) - headerStrigify = JoinStrArr(source.headers, ";") - end if - sources.push({ - url : streamUrl, - bitrate : source.size - quality : false - contentid : source.source + "|" + source.mimeType + "|" + headerStrigify - }) - end for - gridPoster.Streams = sources - gridPoster.shortdescriptionline2 = mediaItem.mediaSources[0].id - ' basePoster = Left(mediaItem.imdbInfo.poster, lastIndexOf(mediaItem.imdbInfo.poster, "@")) - ' gridPoster.SDPosterUrl = basePoster + "._V1_UX182_CR0,0,182,268_AL_.jpg" - ' gridPoster.HDPosterUrl = basePoster + "._V1_UX182_CR0,0,182,268_AL_.jpg" - ' gridPoster.Url = basePoster + "._V1_UX388_CR0,0,388,512_AL_.jpg" - gridPoster.SDPosterUrl = mediaItem.imdbInfo.posterThumb - gridPoster.HDPosterUrl = mediaItem.imdbInfo.posterThumb - gridPoster.Url = mediaItem.imdbInfo.posterHD - end if + parsedContent = createObject("roSGNode", "ContentNode") + for each mediaItem in resultAsJson.items + gridPoster = createObject("roSGNode", "ContentNode") + gridPoster.id = mediaItem.imdbInfo.id + gridPoster.shortdescriptionline1 = mediaItem.imdbInfo.title + gridPoster.Description = mediaItem.imdbInfo.plot + if IsString(mediaItem.mediaSourceUrl) + ' gridPoster.SDPosterUrl = "http://mediacatalogadmin.herokuapp.com" + mediaItem.imdbInfo.posterThumb + ' gridPoster.HDPosterUrl = "http://mediacatalogadmin.herokuapp.com" + mediaItem.imdbInfo.posterThumb + gridPoster.SDPosterUrl = mediaItem.imdbInfo.posterThumb + gridPoster.HDPosterUrl = mediaItem.imdbInfo.posterThumb + gridPoster.Url = mediaItem.imdbInfo.posterHD - parsedContent.appendChild(gridPoster) - end for - m.top.grid.content = parsedContent + sources = CreateObject("roArray", 1, true) + sources.push("http://mediacatalogadmin.herokuapp.com" + mediaItem.mediaSourceUrl) + gridPoster.StreamContentIDs = sources + else + sources = CreateObject("roArray", mediaItem.mediaSources.Count(), true) + for each source in mediaItem.mediaSources + streamUrl = "http://apighost.herokuapp.com/api/gddirectstreamurl/" + source.id + headerStrigify = "" + if (IsString(source.streamUrl) and source.streamUrl <> "") + streamUrl = source.streamUrl + end if + if (IsArray(source.headers)) + headerStrigify = JoinStrArr(source.headers, ";") + end if + sources.push({ + url : streamUrl, + bitrate : source.size + quality : false + contentid : source.source + "|" + source.mimeType + "|" + headerStrigify + }) + end for + gridPoster.Streams = sources + gridPoster.shortdescriptionline2 = mediaItem.mediaSources[0].id + ' basePoster = Left(mediaItem.imdbInfo.poster, lastIndexOf(mediaItem.imdbInfo.poster, "@")) + ' gridPoster.SDPosterUrl = basePoster + "._V1_UX182_CR0,0,182,268_AL_.jpg" + ' gridPoster.HDPosterUrl = basePoster + "._V1_UX182_CR0,0,182,268_AL_.jpg" + ' gridPoster.Url = basePoster + "._V1_UX388_CR0,0,388,512_AL_.jpg" + gridPoster.SDPosterUrl = mediaItem.imdbInfo.posterThumb + gridPoster.HDPosterUrl = mediaItem.imdbInfo.posterThumb + gridPoster.Url = mediaItem.imdbInfo.posterHD + end if + + parsedContent.appendChild(gridPoster) + end for + m.top.grid.content = parsedContent + end if end sub function lastIndexOf(input as string, char as string) as integer diff --git a/components/s3/s3.brs b/components/s3/s3.brs index 8225a01..7f580ec 100644 --- a/components/s3/s3.brs +++ b/components/s3/s3.brs @@ -4,7 +4,7 @@ sub init() m.top.focusable = true m.top.hasNextPanel = true 'm.top.leftPosition = 130 - m.top.createNextPanelOnItemFocus = false + ' m.top.createNextPanelOnItemFocus = false m.top.optionsAvailable = false m.top.goBackCount = 2 m.mediaTitle = m.top.findNode("mediaTitle") @@ -38,6 +38,8 @@ sub readImdbInfo() else if resultAsJson.rating <> invalid m.mediaDesc.text = "Imdb: " + resultAsJson.rating end if + else + print "Imdb info parse result failed" end if end sub diff --git a/components/s3/s3.xml b/components/s3/s3.xml index 5f9d88b..0d5ca29 100644 --- a/components/s3/s3.xml +++ b/components/s3/s3.xml @@ -14,13 +14,12 @@ + itemSpacings = "[8]">