mirror of
https://github.com/jellyfin/jellyfin-roku.git
synced 2024-11-28 00:40:39 +00:00
Add sorting and paging to movie list request
This commit is contained in:
parent
9efa3e4686
commit
578581a52c
@ -70,7 +70,7 @@ function getEndTime() as string
|
||||
meridian = "PM"
|
||||
end if
|
||||
|
||||
return Substitute("{0}:{1} {2}", stri(hours), stri(date.getMinutes()), meridian)
|
||||
return Substitute("{0}:{1} {2}", stri(hours).trim(), stri(date.getMinutes()).trim(), meridian)
|
||||
end function
|
||||
|
||||
function round(f as Float) as Integer
|
||||
@ -86,3 +86,4 @@ function round(f as Float) as Integer
|
||||
return n
|
||||
end if
|
||||
end function
|
||||
|
||||
|
@ -36,9 +36,9 @@
|
||||
sub init()
|
||||
main = m.top.findNode("main_group")
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</component>
|
||||
|
@ -4,6 +4,12 @@ sub itemSelectedQ(msg) as boolean
|
||||
return type(msg) = "roSGNodeEvent" and msg.getField() = "itemSelected"
|
||||
end sub
|
||||
|
||||
sub itemFocusedQ(msg) as boolean
|
||||
' "Q" stands for "Question mark" since itemSelected? wasn't acceptable
|
||||
' Probably needs a better name, but unique for now
|
||||
return type(msg) = "roSGNodeEvent" and msg.getField() = "itemFocused"
|
||||
end sub
|
||||
|
||||
sub getMsgRowTarget(msg) as object
|
||||
node = msg.getRoSGNode()
|
||||
coords = node.rowItemSelected
|
||||
|
@ -157,9 +157,16 @@ end function
|
||||
' List items from within a Library
|
||||
' Params: Library ID, Limit, Offset, SortBy, SortOrder, IncludeItemTypes, Fields, EnableImageTypes
|
||||
' Returns { Items, TotalRecordCount }
|
||||
function ItemList(library_id=invalid as String)
|
||||
function ItemList(library_id=invalid as String, params={})
|
||||
if params["limit"] = invalid
|
||||
params["limit"] = 30
|
||||
end if
|
||||
if params["page"] = invalid
|
||||
params["page"] = 1
|
||||
end if
|
||||
params["parentid"] = library_id
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
resp = APIRequest(url, {"parentid": library_id, "limit": 30})
|
||||
resp = APIRequest(url, params)
|
||||
return parseRequest(resp)
|
||||
end function
|
||||
|
||||
|
@ -113,9 +113,13 @@ sub ShowMovieOptions(library_id)
|
||||
screen.show()
|
||||
|
||||
options = scene.findNode("MovieSelect")
|
||||
options_list = ItemList(library_id)
|
||||
options_list = ItemList(library_id, {"limit": 30,
|
||||
"page": 1,
|
||||
"SortBy": "DateCreated,SortName",
|
||||
"SortOrder": "Descending" })
|
||||
options.movieData = options_list
|
||||
|
||||
options.observeField("itemFocused", port)
|
||||
options.observeField("itemSelected", port)
|
||||
|
||||
while true
|
||||
@ -126,6 +130,8 @@ sub ShowMovieOptions(library_id)
|
||||
target = getMsgRowTarget(msg)
|
||||
ShowMovieDetails(target.movieID)
|
||||
'showVideoPlayer(target.movieID)
|
||||
else if itemFocusedQ(msg)
|
||||
print "Selected " + msg.getNode()
|
||||
end if
|
||||
end while
|
||||
end sub
|
||||
@ -146,6 +152,9 @@ sub ShowMovieDetails(movie_id)
|
||||
return
|
||||
else if itemSelectedQ(msg)
|
||||
' showVideoPlayer(target.movieID)
|
||||
else
|
||||
print msg
|
||||
print type(msg)
|
||||
end if
|
||||
end while
|
||||
end sub
|
||||
|
Loading…
Reference in New Issue
Block a user