mirror of
https://github.com/jellyfin/jellyfin-roku.git
synced 2024-11-27 08:20:47 +00:00
Add a favorites filter to movies
This commit is contained in:
parent
646790a432
commit
4a6deb3b44
@ -29,6 +29,8 @@ sub init()
|
||||
m.sortField = "SortName"
|
||||
m.sortAscending = true
|
||||
|
||||
m.filter = "All"
|
||||
|
||||
m.loadItemsTask = createObject("roSGNode", "LoadItemsTask2")
|
||||
m.loadItemsTask.observeField("content", "ItemDataLoaded")
|
||||
|
||||
@ -45,6 +47,7 @@ sub loadInitialItems()
|
||||
m.loadItemsTask.itemId = m.top.parentItem.Id
|
||||
m.loadItemsTask.sortField = m.sortField
|
||||
m.loadItemsTask.sortAscending = m.sortAscending
|
||||
m.loadItemsTask.filter = m.filter
|
||||
m.loadItemsTask.startIndex = 0
|
||||
|
||||
if m.top.parentItem.collectionType = "movies" then
|
||||
@ -70,7 +73,9 @@ sub SetUpOptions()
|
||||
|
||||
'Movies
|
||||
if m.top.parentItem.collectionType = "movies" then
|
||||
options.views = [{ "Title": tr("Movies"), "Name": "movies" }]
|
||||
options.views = [
|
||||
{ "Title": tr("Movies"), "Name": "movies" },
|
||||
]
|
||||
options.sort = [
|
||||
{ "Title": tr("TITLE"), "Name": "SortName" },
|
||||
{ "Title": tr("IMDB_RATING"), "Name": "CommunityRating" },
|
||||
@ -82,6 +87,10 @@ sub SetUpOptions()
|
||||
{ "Title": tr("RELEASE_DATE"), "Name": "PremiereDate" },
|
||||
{ "Title": tr("RUNTIME"), "Name": "Runtime" }
|
||||
]
|
||||
options.filter = [
|
||||
{ "Title": tr("All"), "Name": "All", "selected": true },
|
||||
{ "Title": tr("Favorites"), "Name": "Favorites" }
|
||||
]
|
||||
'TV Shows
|
||||
else if m.top.parentItem.collectionType = "tvshows" then
|
||||
options.views = [{ "Title": tr("Shows"), "Name": "shows" }]
|
||||
@ -237,6 +246,13 @@ sub optionsClosed()
|
||||
m.data = CreateObject("roSGNode", "ContentNode")
|
||||
m.itemGrid.content = m.data
|
||||
loadInitialItems()
|
||||
else if m.options.filter <> m.filter then
|
||||
m.filter = m.options.filter
|
||||
m.loadedRows = 0
|
||||
m.loadedItems = 0
|
||||
m.data = CreateObject("roSGNode", "ContentNode")
|
||||
m.itemGrid.content = m.data
|
||||
loadInitialItems()
|
||||
end if
|
||||
m.itemGrid.setFocus(true)
|
||||
end sub
|
||||
|
@ -14,6 +14,7 @@ sub init()
|
||||
|
||||
m.viewNames = []
|
||||
m.sortNames = []
|
||||
m.filterNames = []
|
||||
|
||||
' Animation
|
||||
m.fadeAnim = m.top.findNode("fadeAnim")
|
||||
@ -78,6 +79,33 @@ sub optionsSet()
|
||||
end if
|
||||
end if
|
||||
|
||||
' Filter Tab
|
||||
if m.top.options.filter <> invalid then
|
||||
filterContent = CreateObject("roSGNode", "ContentNode")
|
||||
index = 0
|
||||
m.selectedFilterIndex = 0
|
||||
|
||||
for each filterItem in m.top.options.filter
|
||||
entry = filterContent.CreateChild("ContentNode")
|
||||
entry.title = filterItem.Title
|
||||
m.filterNames.push(filterItem.Name)
|
||||
if filterItem.selected <> invalid and filterItem.selected = true then
|
||||
m.selectedFilterIndex = index
|
||||
end if
|
||||
index = index + 1
|
||||
end for
|
||||
m.menus[2].content = filterContent
|
||||
m.menus[2].checkedItem = m.selectedFilterIndex
|
||||
else
|
||||
filterContent = CreateObject("roSGNode", "ContentNode")
|
||||
entry = filterContent.CreateChild("ContentNode")
|
||||
entry.title = "All"
|
||||
m.filterNames.push("All")
|
||||
m.menus[2].content = filterContent
|
||||
m.menus[2].checkedItem = 0
|
||||
end if
|
||||
|
||||
|
||||
end sub
|
||||
|
||||
' Switch menu shown when button focus changes
|
||||
@ -106,8 +134,8 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
|
||||
return true
|
||||
else if key = "OK"
|
||||
' Handle Sort screen
|
||||
if(m.menus[m.selectedItem].isInFocusChain()) then
|
||||
' Handle Sort screen
|
||||
if(m.selectedItem = 1) then
|
||||
if m.menus[1].itemSelected <> m.selectedSortIndex then
|
||||
m.menus[1].focusedCheckedIconUri = m.global.constants.icons.ascending_black
|
||||
@ -129,6 +157,11 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
' Handle Filter screen
|
||||
if(m.selectedItem = 2) then
|
||||
m.selectedFilterIndex = m.menus[2].itemSelected
|
||||
m.top.filter = m.filterNames[m.selectedFilterIndex]
|
||||
end if
|
||||
end if
|
||||
return true
|
||||
else if key = "back" or key = "up"
|
||||
|
@ -11,11 +11,8 @@
|
||||
</RadiobuttonList>
|
||||
<RadiobuttonList id="sortMenu" itemspacing="[0,10]" vertFocusAnimationStyle="floatingFocus" opacity="1" numRows="8" drawFocusFeedback="false">
|
||||
</RadiobuttonList>
|
||||
<LabelList id = "filterMenu" itemspacing="[0,10]" vertFocusAnimationStyle="floatingFocus" opacity="0" drawFocusFeedback="false">
|
||||
<ContentNode id = "filterMenuContent" role = "content">
|
||||
<ContentNode title = "Coming Soon..." />
|
||||
</ContentNode>
|
||||
</LabelList>
|
||||
<RadiobuttonList id="filterMenu" itemspacing="[0,10]" vertFocusAnimationStyle="floatingFocus" opacity="0" drawFocusFeedback="false">
|
||||
</RadiobuttonList>
|
||||
</Group>
|
||||
</LayoutGroup>
|
||||
</Group>
|
||||
@ -33,6 +30,7 @@
|
||||
<field id="view" type="string" />
|
||||
<field id="sortField" type="string" value="SortName" />
|
||||
<field id="sortAscending" type="boolean" value="false" />
|
||||
<field id="filter" type="string" value="All" />
|
||||
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="ItemGridOptions.brs" />
|
||||
|
@ -14,6 +14,7 @@ sub loadItems()
|
||||
sort_order = "Descending"
|
||||
end if
|
||||
|
||||
|
||||
params = {
|
||||
limit: m.top.limit,
|
||||
StartIndex: m.top.startIndex,
|
||||
@ -24,6 +25,13 @@ sub loadItems()
|
||||
Fields: "Overview"
|
||||
}
|
||||
|
||||
filter = m.top.filter
|
||||
if filter = "All" or filter = "all" then
|
||||
' do nothing
|
||||
else if filter = "Favorites" then
|
||||
params.append({ Filters: "IsFavorite"})
|
||||
end if
|
||||
|
||||
if m.top.ItemType <> "" then
|
||||
params.append({ IncludeItemTypes: m.top.ItemType})
|
||||
end if
|
||||
@ -53,7 +61,6 @@ sub loadItems()
|
||||
tmp = CreateObject("roSGNode", "ChannelData")
|
||||
else
|
||||
print "Unknown Type: " item.Type
|
||||
|
||||
end if
|
||||
|
||||
if tmp <> invalid then
|
||||
|
@ -9,7 +9,8 @@
|
||||
<field id="metadata" type="associativearray" />
|
||||
<field id="sortField" type="string" value="SortName" />
|
||||
<field id="sortAscending" type="boolean" value="true" />
|
||||
|
||||
<field id="filter" type="string" value="All" />
|
||||
|
||||
<!-- Total records available from server-->
|
||||
<field id="totalRecordCount" type="int" value="-1" />
|
||||
<field id="content" type="array" />
|
||||
|
@ -235,7 +235,7 @@ function CreateMovieListGroup(libraryItem)
|
||||
sidepanel.options = new_options
|
||||
sidepanel.observeField("closeSidePanel", m.port)
|
||||
|
||||
return group
|
||||
return group
|
||||
end function
|
||||
|
||||
function CreateMovieDetailsGroup(movie)
|
||||
|
Loading…
Reference in New Issue
Block a user