Remove unsed/unreferenced code

This commit is contained in:
Neil Burrows 2021-04-10 15:30:33 +01:00
parent a17b93824e
commit 58972c5ece
11 changed files with 0 additions and 546 deletions

View File

@ -1,33 +0,0 @@
Sub Init()
m.top.functionName = "listenInput"
End Sub
function ListenInput()
port=createobject("romessageport")
InputObject=createobject("roInput")
InputObject.setmessageport(port)
while true
msg=port.waitmessage(500)
if type(msg)="roInputEvent" then
print "INPUT EVENT!"
if msg.isInput()
inputData = msg.getInfo()
'print inputData'
for each item in inputData
print item +": " inputData[item]
end for
' pass the deeplink to UI
if inputData.DoesExist("mediaType") and inputData.DoesExist("contentID")
deeplink = {
id: inputData.contentID
type: inputData.mediaType
}
print "got input deeplink= "; deeplink
m.top.inputData = deeplink
end if
end if
end if
end while
end function

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="InputTask" extends="Task">
<interface>
<field id="inputData" type="assocarray" />
</interface>
<script type="text/brightscript" uri="InputTask.brs" />
</component>

View File

@ -1,127 +0,0 @@
sub init()
m.top.currentPage = 0
m.top.maxPages = 0
m.top.layoutDirection = "horiz"
m.top.horizAlignment = "center"
m.top.vertAlignment = "center"
end sub
sub recountPages()
if m.top.currentPage = 0 or m.top.maxPages = 0
return
end if
while m.top.getChildCount() > 0
m.top.removeChildIndex(0)
end while
currentPage = m.top.currentPage
maxPages = m.top.maxPages
minShown = 1
maxShown = maxPages
if currentPage > 1
addPage("<")
minShown = currentPage - 3
end if
if minShown <= 0 then minShown = 1
if currentPage < maxPages then maxShown = currentPage + 3
if maxShown >= maxPages then maxShown = maxPages
for i=minShown to maxShown step 1
addPage(i)
end for
if currentPage <> maxPages
addPage(">")
end if
m.top.pageFocused = m.top.findNode(stri(currentPage).trim())
m.top.pageFocused.color = "#00A4DCff"
updateLayout()
end sub
sub updateLayout()
dimensions = m.top.getScene().currentDesignResolution
height = 115
m.top.translation = [dimensions.width / 2, dimensions.height - (height / 2)]
end sub
sub addPage(i)
p = CreateObject("roSGNode", "Label")
p.height = 50
p.width = 50
p.color = "#a1a1a1FF"
if type(i) = "roInt"
i = stri(i).trim()
end if
p.id = i
p.text = i
m.top.appendChild(p)
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
if key = "OK"
p = m.top.focusedChild.id
if p = ">"
m.top.pageSelected = m.top.currentPage + 1
else if p = "<"
m.top.pageSelected = m.top.currentPage - 1
else
m.top.pageSelected = m.top.focusedChild.id
end if
m.top.currentPage = m.top.pageSelected
recountPages()
return true
else if key = "left"
focusPrev()
return true
else if key = "right"
focusNext()
return true
else if key = "up"
if m.top.getParent().findNode("picker") <> invalid
m.top.getParent().findNode("picker").setFocus(true)
else if m.top.getParent().lastFocus <> invalid
m.top.getParent().lastFocus.setFocus(true)
else
m.top.getParent().setFocus(true)
end if
return true
end if
return false
end function
sub focusNext()
i = getFocusIndex()
if (i + 1) = m.top.getChildCount() then return
m.top.pageFocused.color = "#a1a1a1FF"
m.top.pageFocused = m.top.getChild(i + 1)
m.top.pageFocused.color = "#00A4DCff"
m.top.pageFocused.setFocus(true)
end sub
sub focusPrev()
i = getFocusIndex()
if i = 0 then return
m.top.pageFocused.color = "#a1a1a1FF"
m.top.pageFocused = m.top.getChild(i - 1)
m.top.pageFocused.color = "#00A4DCff"
m.top.pageFocused.setFocus(true)
end sub
function getFocusIndex()
for i=0 to m.top.getChildCount() step 1
if m.top.getChild(i).id = m.top.pageFocused.id then return i
end for
return invalid
end function

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="Pager" extends="LayoutGroup" >
<interface>
<field id="currentPage" type="integer" onChange="recountPages" />
<field id="maxPages" type="integer" onChange="recountPages" />
<field id="pageFocused" type="node" />
<field id="pageSelected" type="string" />
<field id="escape" type="boolean" alwaysNotify="true" />
</interface>
<script type="text/brightscript" uri="Pager.brs" />
</component>

View File

@ -1,116 +0,0 @@
sub init()
m.rowList = m.top.findNode("RowList") ' createObject("roSGNode", "RowList")
' m.top.appendChild(m.rowList)
m.rowList.itemComponentName = "HomeItem"
formatRowList()
m.rowList.setfocus(true)
m.rowList.observeField("rowItemSelected", "itemSelected")
end sub
sub formatRowList()
' how many rows are visible on the screen
m.rowList.numRows = 2
m.rowList.rowFocusAnimationStyle = "fixedFocusWrap"
m.rowList.vertFocusAnimationStyle = "fixedFocus"
m.rowList.showRowLabel = [true]
m.rowList.rowLabelOffset = [0, 20]
m.rowList.showRowCounter = [true]
sideborder = 100
m.rowList.translation = [111, 155]
m.rowItemSizes = []
itemWidth = 480
itemHeight = 330
m.rowList.itemSize = [1920 - 111 - 27, itemHeight]
' spacing between rows
m.rowList.itemSpacing = [0, 105]
' spacing between items in a row
m.rowList.rowItemSpacing = [20, 0]
m.rowList.visible = true
end sub
sub setupRows()
for each item in m.top.objects.Items
homeItem = CreateObject("roSGNode", "HomeData")
homeItem.json = item.json
if homeItem.Type = "Video" or homeItem.Type = "Movie" or homeItem.Type = "Episode" then
if m.videoRow = invalid then
m.videoRow = CreateObject("roSGNode", "HomeRow")
m.videoRow.title = tr("Videos")
m.videoRow.usePoster = true
m.videoRow.imageWidth = 180
end if
m.videoRow.appendChild(homeItem)
else if homeItem.Type = "MusicAlbum"
if m.albumRow = invalid then
m.albumRow = CreateObject("roSGNode", "HomeRow")
m.albumRow.imageWidth = 261
m.albumRow.title = tr("Albums")
m.albumRow.usePoster = true
end if
m.albumRow.appendChild(homeItem)
else if homeItem.Type = "Series"
if m.seriesRow = invalid then
m.seriesRow = CreateObject("roSGNode", "HomeRow")
m.seriesRow.title = tr("Series")
m.seriesRow.usePoster = true
m.seriesRow.imageWidth = 180
end if
m.seriesRow.appendChild(homeItem)
else
print "Collection - Unknown Type ", homeItem.Type
end if
end for
data = CreateObject("roSGNode", "ContentNode")
if m.videoRow <> invalid then
data.appendChild(m.videoRow)
m.rowItemSizes.push([188, 331])
end if
if m.seriesRow <> invalid then
data.appendChild(m.seriesRow)
m.rowItemSizes.push([188, 331])
end if
if m.albumRow <> invalid then
data.appendChild(m.albumRow)
m.rowItemSizes.push([261, 331])
end if
m.rowList.rowItemSize = m.rowItemSizes
m.rowList.content = data
end sub
function itemSelected()
m.top.selectedItem = m.rowList.content.getChild(m.rowList.rowItemSelected[0]).getChild(m.rowList.rowItemSelected[1])
end function

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="CollectionDetail" extends="JFGroup">
<children>
<RowList id="rowList" />
</children>
<interface>
<field id="collectionId" type="string" onChange="collectionIdChanged" />
<field id="selectedItem" type="node" alwaysNotify="true" />
<field id="objects" type="assocarray" onChange="setupRows" />
</interface>
<script type="text/brightscript" uri="CollectionDetail.brs" />
</component>

View File

@ -22,8 +22,6 @@ sub Main()
m.overhang = CreateObject("roSGNode", "JFOverhang")
m.scene.insertChild(m.overhang, 0)
m.page_size = 48
app_start:
m.overhang.title = ""
' First thing to do is validate the ability to use the API
@ -266,18 +264,6 @@ sub Main()
results = SearchMedia(query)
options.itemData = results
options.query = query
else if isNodeEvent(msg, "pageSelected")
group.pageNumber = msg.getRoSGNode().pageSelected
collectionType = group.subType()
if collectionType = "Collections"
CollectionLister(group, m.page_size)
else if collectionType = "TVShows"
SeriesLister(group, m.page_size)
else if collectionType = "Channels"
ChannelLister(group, m.page_size)
end if
' TODO - abstract away the "picker" node
group.findNode("picker").setFocus(true)
else if isNodeEvent(msg, "itemSelected")
' Search item selected
node = getMsgPicker(msg)

View File

@ -297,15 +297,6 @@ function CreateSidePanel(buttons, options)
end function
function CreatePaginator()
group = CreateObject("roSGNode", "Pager")
group.id = "paginator"
group.observeField("pageSelected", m.port)
return group
end function
function CreateVideoPlayerGroup(video_id, audio_stream_idx = 1)
' Video is Playing
video = VideoPlayer(video_id, audio_stream_idx)
@ -320,46 +311,3 @@ function CreateVideoPlayerGroup(video_id, audio_stream_idx = 1)
return video
end function
function SeriesLister(group, page_size)
sort_order = get_user_setting("series_sort_order", "Ascending")
sort_field = get_user_setting("series_sort_field", "SortName")
item_list = ItemList(group.id, {"limit": page_size,
"StartIndex": page_size * (group.pageNumber - 1),
"SortBy": sort_field,
"SortOrder": sort_order,
"IncludeItemTypes": "Series"
})
group.objects = item_list
p = group.findNode("paginator")
p.maxPages = div_ceiling(group.objects.TotalRecordCount, page_size)
end function
function CollectionLister(group, page_size)
sort_order = get_user_setting("boxsets_sort_order", "Ascending")
sort_field = get_user_setting("boxsets_sort_field", "SortName")
item_list = ItemList(group.id, {"limit": page_size,
"StartIndex": page_size * (group.pageNumber - 1),
"SortBy": sort_field,
"SortOrder": sort_order,
})
group.objects = item_list
p = group.findNode("paginator")
p.maxPages = div_ceiling(group.objects.TotalRecordCount, page_size)
end function
function ChannelLister(group, page_size)
sort_order = get_user_setting("channel_sort_order", "Ascending")
sort_field = get_user_setting("channel_sort_field", "SortName")
group.objects = Channels({"limit": page_size,
"StartIndex": page_size * (group.pageNumber - 1),
"SortBy": sort_field,
"SortOrder": sort_order,
})
p = group.findNode("paginator")
p.maxPages = div_ceiling(group.objects.TotalRecordCount, page_size)
end function

View File

@ -1,9 +0,0 @@
function api_BrandingConfig()
' Gets branding configuration
' {
' LoginDisclaimer: string
' CustomCss: string
' }
resp = APIRequest("Branding/Configuration")
return getJson(resp)
end function

View File

@ -1,27 +1,3 @@
function ItemsList(params = {} as object)
' Gets items based on a query.
resp = APIRequest("Items", params)
data = getJson(resp)
' TODO - parse items
return data
end function
function UserItems(params = {} as object)
' Gets items based on a query
resp = APIRequest(Substitute("Items/{0}/Items", get_setting("active_user")), params)
data = getJson(resp)
' TODO - parse items
return data
end function
function UserItemsResume(params = {} as object)
' Gets items based on a query
resp = APIRequest(Substitute("Items/{0}/Items/Resume", get_setting("active_user")), params)
data = getJson(resp)
' TODO - parse items
return data
end function
function ItemGetPlaybackInfo(id as string, StartTimeTicks = 0 as longinteger)
params = {
"UserId": get_setting("active_user"),
@ -80,87 +56,6 @@ function SearchMedia(query as string)
return data
end function
' List items from within a library
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
params["recursive"] = true
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
resp = APIRequest(url, params)
data = getJson(resp)
results = []
for each item in data.Items
imgParams = {}
if item.ImageTags.Primary <> invalid then
' If Primary image exists use it
param = { "Tag" : item.ImageTags.Primary }
imgParams.Append(param)
end if
param = { "AddPlayedIndicator": item.UserData.Played }
imgParams.Append(param)
if item.UserData.PlayedPercentage <> invalid then
param = { "PercentPlayed": item.UserData.PlayedPercentage }
imgParams.Append(param)
end if
if item.type = "Movie"
tmp = CreateObject("roSGNode", "MovieData")
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "Series"
if item.UserData.UnplayedItemCount > 0 then
param = { "UnplayedCount" : item.UserData.UnplayedItemCount }
imgParams.Append(param)
end if
tmp = CreateObject("roSGNode", "SeriesData")
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "BoxSet"
if item.UserData.UnplayedItemCount > 0 then
param = { "UnplayedCount" : item.UserData.UnplayedItemCount }
imgParams.Append(param)
end if
tmp = CreateObject("roSGNode", "CollectionData")
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "Episode"
imgParams.Append({ "AddPlayedIndicator": item.UserData.Played })
tmp = CreateObject("roSGNode", "TVEpisodeData")
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "MusicAlbum"
tmp = CreateObject("roSGNode", "AlbumData")
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "Video"
tmp = CreateObject("roSGNode", "VideoData")
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "Folder"
tmp = CreateObject("roSGNode", "FolderData")
tmp.json = item
results.push(tmp)
else
print "Items.brs::ItemList received unhandled type: " item.type
' Otherwise we just stick with the JSON
results.push(item)
end if
end for
data.items = results
return data
end function
' MetaData about an item
function ItemMetaData(id as string)
url = Substitute("Users/{0}/Items/{1}", get_setting("active_user"), id)
@ -262,42 +157,3 @@ function TVEpisodes(show_id as string, season_id as string)
data.Items = results
return data
end function
' The next up episode for a TV show
function TVNext(id as string)
url = Substitute("Shows/NextUp", id)
resp = APIRequest(url, { "UserId": get_setting("active_user"), "SeriesId": id })
data = getJson(resp)
for each item in data.Items
item.image = PosterImage(item.id)
end for
return data
end function
function Channels(params = {})
if params["limit"] = invalid
params["limit"] = 30
end if
if params["page"] = invalid
params["page"] = 1
end if
params["recursive"] = true
resp = APIRequest("LiveTv/Channels", params)
data = getJson(resp)
results = []
for each item in data.Items
imgParams = { "maxWidth": 712, "maxheight": 400 }
tmp = CreateObject("roSGNode", "ChannelData")
tmp.image = PosterImage(item.id, imgParams)
if tmp.image <> invalid
tmp.image.posterDisplayMode = "scaleToFit"
end if
tmp.json = item
results.push(tmp)
end for
data.Items = results
return data
end function

View File

@ -1,19 +0,0 @@
function ItemCounts()
' Gets counts of a library
' Query:
' UserId: Get counts from specific user's library
' IsFavorite: Get counts of favorite items
resp = APIRequest("Items/Counts", {})
data = getJson(resp)
return data
end function
function LibraryMediaFolders()
' Gets all user media folders
' Query:
' IsHidden: Filter by folders that are marked hidden, or not
resp = APIRequest("Library/MediaFolders")
data = getJson(resp)
return data
end function