Initial batch of livetv updates to itemgrid2
This commit is contained in:
parent
419c4a4829
commit
dd391ff0ea
|
@ -29,6 +29,9 @@ sub itemContentChanged()
|
|||
else if itemData.type = "Boxset" then
|
||||
m.itemPoster.uri = itemData.PosterUrl
|
||||
m.itemText.text = itemData.Title
|
||||
else if itemData.type = "TvChannel" then
|
||||
m.itemPoster.uri = itemData.PosterUrl
|
||||
m.itemText.text = itemData.Title
|
||||
else
|
||||
print "Unhandled Item Type: " + itemData.type
|
||||
end if
|
||||
|
|
|
@ -51,6 +51,10 @@ sub loadInitialItems()
|
|||
m.loadItemsTask.itemType = "Movie"
|
||||
else if m.top.parentItem.collectionType = "tvshows" then
|
||||
m.loadItemsTask.itemType = "Series"
|
||||
else if m.top.parentItem.collectionType = "livetv" then
|
||||
m.loadItemsTask.itemType = "LiveTV"
|
||||
else
|
||||
print "Unknown Type: " m.top.parentItem
|
||||
end if
|
||||
|
||||
m.loadItemsTask.control = "RUN"
|
||||
|
@ -89,6 +93,12 @@ sub SetUpOptions()
|
|||
{ "Title": tr("OFFICIAL_RATING"), "Name": "OfficialRating" },
|
||||
{ "Title": tr("RELEASE_DATE"), "Name": "PremiereDate" },
|
||||
]
|
||||
'Live TV
|
||||
else if m.top.parentItem.collectionType = "livetv" then
|
||||
options.views = [{"Title": tr("Live TV"), "Name": "livetv" }]
|
||||
options.sort = [
|
||||
{ "Title": tr("TITLE"), "Name": "SortName" }
|
||||
]
|
||||
|
||||
end if
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ sub loadItems()
|
|||
results = []
|
||||
|
||||
sort_field = m.top.sortField
|
||||
|
||||
|
||||
if m.top.sortAscending = true then
|
||||
sort_order = "Ascending"
|
||||
else
|
||||
|
@ -28,14 +28,18 @@ sub loadItems()
|
|||
params.append({ IncludeItemTypes: m.top.ItemType})
|
||||
end if
|
||||
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
if m.top.ItemType = "LiveTV" then
|
||||
url = "LiveTv/Channels"
|
||||
else
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
end if
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
|
||||
if data.TotalRecordCount <> invalid then
|
||||
m.top.totalRecordCount = data.TotalRecordCount
|
||||
end if
|
||||
|
||||
|
||||
for each item in data.Items
|
||||
|
||||
tmp = invalid
|
||||
|
@ -45,11 +49,13 @@ sub loadItems()
|
|||
tmp = CreateObject("roSGNode", "SeriesData")
|
||||
else if item.Type = "BoxSet" then
|
||||
tmp = CreateObject("roSGNode", "CollectionData")
|
||||
else if item.Type = "TvChannel" then
|
||||
tmp = CreateObject("roSGNode", "ChannelData")
|
||||
else
|
||||
print "Unknown Type: " item.Type
|
||||
|
||||
end if
|
||||
|
||||
|
||||
if tmp <> invalid then
|
||||
|
||||
tmp.json = item
|
||||
|
|
|
@ -40,7 +40,7 @@ sub recountPages()
|
|||
|
||||
m.top.pageFocused = m.top.findNode(stri(currentPage).trim())
|
||||
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.color = "#00A4DCff"
|
||||
|
||||
updateLayout()
|
||||
end sub
|
||||
|
@ -105,7 +105,7 @@ sub focusNext()
|
|||
|
||||
m.top.pageFocused.color = "#a1a1a1FF"
|
||||
m.top.pageFocused = m.top.getChild(i + 1)
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.color = "#00A4DCff"
|
||||
m.top.pageFocused.setFocus(true)
|
||||
end sub
|
||||
|
||||
|
@ -115,7 +115,7 @@ sub focusPrev()
|
|||
|
||||
m.top.pageFocused.color = "#a1a1a1FF"
|
||||
m.top.pageFocused = m.top.getChild(i - 1)
|
||||
m.top.pageFocused.color = "#00ff00ff"
|
||||
m.top.pageFocused.color = "#00A4DCff"
|
||||
m.top.pageFocused.setFocus(true)
|
||||
end sub
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ sub setFields()
|
|||
json = m.top.json
|
||||
|
||||
m.top.id = json.id
|
||||
m.top.title = json.name
|
||||
m.top.live = true
|
||||
m.top.Title = json.name
|
||||
m.top.Type = "TvChannel"
|
||||
end sub
|
||||
|
||||
sub setPoster()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="ChannelData" extends="ContentNode">
|
||||
<component name="ChannelData" extends="JFContentItem">
|
||||
<interface>
|
||||
<field id="id" type="string" />
|
||||
<field id="title" type="string" />
|
||||
<field id="image" type="node" onChange="setPoster" />
|
||||
<field id="posterURL" type="string" />
|
||||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
<field id="channelID" type="string" />
|
||||
<field id="Title" type="string" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="ChannelData.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/Image.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
</component>
|
||||
|
|
|
@ -7,8 +7,8 @@ sub setFields()
|
|||
m.top.Description = json.overview
|
||||
m.top.favorite = json.UserData.isFavorite
|
||||
m.top.watched = json.UserData.played
|
||||
m.top.Type = "Boxset"
|
||||
|
||||
m.top.Type = "Boxset"
|
||||
|
||||
setPoster()
|
||||
end sub
|
||||
|
||||
|
@ -18,7 +18,6 @@ sub setPoster()
|
|||
else
|
||||
|
||||
if m.top.json.ImageTags.Primary <> invalid then
|
||||
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag" : m.top.json.ImageTags.Primary }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
||||
else if m.top.json.BackdropImageTags <> invalid then
|
||||
|
|
|
@ -113,7 +113,7 @@ sub Main()
|
|||
group.visible = false
|
||||
|
||||
m.overhang.title = selectedItem.title
|
||||
group = CreateChannelList(selectedItem.Id)
|
||||
group = CreateChannelList(selectedItem)
|
||||
group.overhangTitle = selectedItem.title
|
||||
m.scene.appendChild(group)
|
||||
else if selectedItem.type = "Boxset" then
|
||||
|
@ -180,6 +180,22 @@ sub Main()
|
|||
ReportPlayback(group, "start")
|
||||
m.overhang.visible = false
|
||||
end if
|
||||
else if selectedItem.type = "TvChannel" then
|
||||
' play channel feed
|
||||
print selectedItem
|
||||
video_id = selectedItem.id
|
||||
video = CreateVideoPlayerGroup(video_id)
|
||||
if video <> invalid then
|
||||
group.lastFocus = group.focusedChild
|
||||
group.setFocus(false)
|
||||
group.visible = false
|
||||
group = video
|
||||
m.scene.appendChild(group)
|
||||
group.setFocus(true)
|
||||
group.control = "play"
|
||||
ReportPlayback(group, "start")
|
||||
m.overhang.visible = false
|
||||
end if
|
||||
else
|
||||
' TODO - switch on more node types
|
||||
if selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView" then
|
||||
|
@ -253,7 +269,7 @@ sub Main()
|
|||
' If you select a Channel from ANYWHERE, follow this flow
|
||||
node = getMsgPicker(msg, "picker")
|
||||
video_id = node.id
|
||||
|
||||
|
||||
' Show Channel Loading spinner
|
||||
dialog = createObject("roSGNode", "ProgressDialog")
|
||||
dialog.title = tr("Loading Channel Data")
|
||||
|
@ -279,7 +295,7 @@ sub Main()
|
|||
dialog.buttons = [tr("OK")]
|
||||
m.scene.dialog = dialog
|
||||
end if
|
||||
|
||||
|
||||
else if isNodeEvent(msg, "search_value")
|
||||
query = msg.getRoSGNode().search_value
|
||||
group.findNode("SearchBox").visible = false
|
||||
|
|
|
@ -317,55 +317,17 @@ function CreateCollectionDetailList(collectionId)
|
|||
return group
|
||||
end function
|
||||
|
||||
function CreateChannelList(libraryItem)
|
||||
group = CreateObject("roSGNode", "ItemGrid2")
|
||||
print libraryItem
|
||||
group.parentItem = libraryItem
|
||||
' group = CreateObject("roSGNode", "Channels")
|
||||
' group.id = libraryId
|
||||
|
||||
|
||||
|
||||
function CreateChannelList(libraryId)
|
||||
group = CreateObject("roSGNode", "Channels")
|
||||
group.id = libraryId
|
||||
|
||||
group.observeField("channelSelected", m.port)
|
||||
group.observeField("selectedItem", m.port)
|
||||
|
||||
|
||||
sidepanel = group.findNode("options")
|
||||
channel_options = [
|
||||
{"title": "Sort Field",
|
||||
"base_title": "Sort Field",
|
||||
"key": "channel_sort_field",
|
||||
"default": "Name",
|
||||
"values": [
|
||||
{display: tr("Name"), value: "SortName"}
|
||||
]},
|
||||
{"title": "Sort Order",
|
||||
"base_title": "Sort Order",
|
||||
"key": "channel_sort_order",
|
||||
"default": "Ascending",
|
||||
"values": [
|
||||
{display: tr("Descending"), value: "Descending"},
|
||||
{display: tr("Ascending"), value: "Ascending"}
|
||||
]}
|
||||
]
|
||||
new_options = []
|
||||
for each opt in channel_options
|
||||
o = CreateObject("roSGNode", "OptionsData")
|
||||
o.title = tr(opt.title)
|
||||
o.choices = opt.values
|
||||
o.base_title = tr(opt.base_title)
|
||||
o.config_key = opt.key
|
||||
o.value = get_user_setting(opt.key, opt.default)
|
||||
new_options.append([o])
|
||||
end for
|
||||
|
||||
sidepanel.options = new_options
|
||||
sidepanel.observeField("closeSidePanel", m.port)
|
||||
|
||||
p = CreatePaginator()
|
||||
group.appendChild(p)
|
||||
|
||||
group.pageNumber = 1
|
||||
p.currentPage = group.pageNumber
|
||||
|
||||
ChannelLister(group, m.page_size)
|
||||
|
||||
return group
|
||||
end function
|
||||
|
|
|
@ -21,7 +21,7 @@ function VideoContent(video) as object
|
|||
|
||||
meta = ItemMetaData(video.id)
|
||||
video.content.title = meta.Name
|
||||
|
||||
|
||||
' If there is a last playback positon, ask user if they want to resume
|
||||
position = meta.json.UserData.PlaybackPositionTicks
|
||||
if position > 0 then
|
||||
|
@ -149,6 +149,7 @@ function getTranscodeParameters(meta as object)
|
|||
end if
|
||||
end if
|
||||
|
||||
print meta.json.MediaStreams
|
||||
streamInfo = { Codec: meta.json.MediaStreams[0].codec }
|
||||
if meta.json.MediaStreams[0].Profile <> invalid and meta.json.MediaStreams[0].Profile.len() > 0 then
|
||||
streamInfo.Profile = LCase(meta.json.MediaStreams[0].Profile)
|
||||
|
|
Loading…
Reference in New Issue
Block a user