Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Meron
Visitor

Error Please help this code

hello, a warm greeting, I am new developing in roku, and I based on a code that was not developed by me, the problem is the following, with the recent update of roku OS8, it has stopped working, my live category , it's perfect, but where I put my videos by categories does not work, after the update of the roku.

Investigate a little, and note that many things changed from version os8, example
https://sdkdocs.roku.com/display/sdkdoc ... creenEvent

function GridScreen_run()

    this = m

    while true
        msg = wait(0, this._port)

        if msg = invalid then
            exit while
        end if

        if msg.isListItemSelected() then
            selected_list = msg.getIndex()
            selected_item = msg.getData()
            contentItem = this._lists[selected_list][selected_item]

            if contentItem.cid = "search" then
                this._search()
            elseif contentItem.ContentType = "series"
                this._beginWrapper()

                if selected_list = this.BUSCAR
                    searchTerm = this._lastSearch
                else
                    searchTerm = ""
                end if
                
                finished = this._watch(contentItem, this._titles[selected_list], searchTerm)

                this._endWrapper()
            elseif contentItem.ContentType = "episode"
                this._beginWrapper()

                if selected_list = this.BUSCAR
                    searchTerm = this._lastSearch
                else
                    searchTerm = ""
                end if

                SwatchNext:

                finished = this._watch(contentItem, this._titles[selected_list], searchTerm)
                    if finished and selected_item < this._lists[selected_list].count() - 1 then
                        selected_item = selected_item + 1
                        previousContentItem = contentItem
                        contentItem = this._lists[selected_list][selected_item]

                        playNext = this._interstitialScreen.show(contentItem, previousContentItem)

                        if playNext then
                            goto SwatchNext
                        end if
                    end if

                this._endWrapper()
            elseif contentItem.ContentType = "movie"
                this._beginWrapper()

                if selected_list = this.BUSCAR
                    searchTerm = this._lastSearch
                else
                    searchTerm = ""
                end if

                watchNext:

                finished = this._watch(contentItem, this._titles[selected_list], searchTerm)
                    if finished and selected_item < this._lists[selected_list].count() - 1 then
                        selected_item = selected_item + 1
                        previousContentItem = contentItem
                        contentItem = this._lists[selected_list][selected_item]

                        playNext = this._interstitialScreen.show(contentItem, previousContentItem)

                        if playNext then
                            goto watchNext
                        end if
                    end if

                this._endWrapper()
            elseif contentItem.ContentType = "live"
                finished = this._watch(contentItem, this._titles[selected_list], searchTerm)
                this._endWrapper()
            end if
        else if msg.isRemoteKeyPressed() then
            if msg.getIndex() = 10 then
                this._search()
            end if
        else if msg.isScreenClosed() then
            exit while
        end if
    end while
end function

function _GridScreen_watch(contentItem, fromList, searchTerm)

    this = m
    if contentItem.ContentType = "movie" or contentItem.ContentType = "episode"
        if isFinished(contentItem) then
            unMarkAsFinished(contentItem)
            for i = 0 to this._lists[this.VISTO].count() - 1
                if this._lists[this.VISTO][i].cid = contentItem.cid then
                    this._lists[this.VISTO].delete(i)
                    exit for
                end if
            end for
            if this._lists[this.VISTO].count() = 0 then
                this._screen.setListVisible(this.VISTO, false)
            end if
        endif

        finished = this._videoScreen.play(contentItem, fromList, searchTerm)
        lastWatched = contentItem["visto"]
        contentItem["visto"] = setLastWatched(contentItem)
        if contentItem.ContentType = "episode" then
            this._feed["visto"] = setLastWatched(this._feed)
        endif

        if finished then
            markAsFinished(contentItem)
        end if

        if lastWatched <> invalid then
            ' Remove vid from unwatched list
            for i = 0 to this._lists[this.VISTO].count() - 1
                if this._lists[this.VISTO][i].cid = contentItem.cid then
                    this._lists[this.VISTO].delete(i)
                    exit for
                end if
            end for
        end if

        ' Add vid to watched list
        if finished then
            yasta = false

            for y = 0 to this._lists[this.VISTO].count() -1
                if this._lists[this.VISTO][y].cid = contentItem.cid
                    yasta = true
                end if
            end for
            if not yasta then
                this._lists[this.VISTO].unshift(contentItem)
                this._screen.setContentList(this.VISTO, this._lists[this.VISTO])

                if this._lists[this.VISTO].count() = 1 then
                    this._screen.setListVisible(this.VISTO, true)
                end if
            endif
        else
            yasta = false

            for y = 0 to this._lists[this.VIENDO_AHORA].count() -1
                if this._lists[this.VIENDO_AHORA][y].cid = contentItem.cid
                    yasta = true
                end if
            end for
            if not yasta then
                this._lists[this.VIENDO_AHORA].unshift(contentItem)
                this._screen.setContentList(this.VIENDO_AHORA, this._lists[this.VIENDO_AHORA])

                if this._lists[this.VIENDO_AHORA].count() = 1 then
                    this._screen.setListVisible(this.VIENDO_AHORA, true)
                end if
            endif
        end if

        return finished
    else if contentItem.ContentType = "series"
        seriesgrid = GridScreen("serie", contentItem.cid)
        print "Running the grid Serie " contentItem.nombre
        seriesgrid.run()
    else if contentItem.ContentType = "live"
        finished = this._videoScreen.playlive(contentItem)
        return finished
    endif
end function
0 Kudos
1 REPLY 1
Meron
Visitor

Re: Error Please help this code

I can pay to help me in this problem, I urgently need a solution
0 Kudos