IPTV Plugin

This commit is contained in:
Neil Burrows 2020-10-27 17:12:18 +00:00
parent 3d9bbc584a
commit f9d70d46e0
9 changed files with 51 additions and 41 deletions

View File

@ -40,6 +40,9 @@ sub itemContentChanged()
else if itemData.type = "TvChannel" then
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title
else if itemData.type = "Video" then
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title
else
print "Unhandled Item Type: " + itemData.type
end if

View File

@ -56,6 +56,8 @@ sub loadInitialItems()
'For LiveTV, we want to "Fit" the item images, not zoom
m.top.imageDisplayMode = "scaleToFit"
else if m.top.parentItem.collectionType = "Channel" then
m.top.imageDisplayMode = "scaleToFit"
else
print "Unknown Type: " m.top.parentItem
end if
@ -102,7 +104,11 @@ sub SetUpOptions()
options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" }
]
else
options.views = [{"Title": tr("Default"), "Name": "default" }]
options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" }
]
end if
for each o in options.sort

View File

@ -51,6 +51,8 @@ sub loadItems()
tmp = CreateObject("roSGNode", "CollectionData")
else if item.Type = "TvChannel" then
tmp = CreateObject("roSGNode", "ChannelData")
else if item.Type = "Video" then
tmp = CreateObject("roSGNode", "VideoData")
else
print "Unknown Type: " item.Type

View File

@ -138,9 +138,11 @@ sub setData()
m.top.widePosterUrl = m.top.thumbnailURL
m.top.posterUrl = m.top.thumbnailURL
else if datum.type = "TvChannel" OR datum.type = "UserView" then
m.top.widePosterUrl = "pkg:/images/baseline_live_tv_white_48dp.png"
else if datum.type = "TvChannel" OR datum.type = "Channel" then
params = { "Tag" : datum.ImageTags.Primary, "maxHeight" : 261, "maxWidth" : 464 }
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
m.top.widePosterUrl = m.top.thumbnailURL
m.top.iconUrl = "pkg:/images/baseline_live_tv_white_48dp.png"
end if
end sub

View File

@ -1,16 +1,21 @@
sub setFields()
datum = m.top.json
json = m.top.json
m.top.id = datum.id
m.top.title = datum.name
m.top.id = json.id
m.top.Title = json.name
m.top.Description = json.overview
m.top.favorite = json.UserData.isFavorite
m.top.watched = json.UserData.played
m.top.Type = "Video"
setPoster()
end sub
sub setPoster()
if m.top.image <> invalid
m.top.posterURL = m.top.image.url
else
m.top.posterURL = ""
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)
end if
end sub
end sub

View File

@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="VideoData" extends="ContentNode">
<interface>
<field id="id" type="string" />
<field id="title" type="string" />
<field id="json" type="associativearray" onChange="setFields" />
<field id="image" type="node" onChange="setPoster" />
<field id="posterUrl" type="string" />
</interface>
<component name="VideoData" extends="JFContentItem">
<script type="text/brightscript" uri="VideoData.brs" />
</component>
<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>

View File

@ -33,7 +33,7 @@ sub itemContentChanged()
' Format the Data based on the type of Home Data
if itemData.type = "CollectionFolder" OR itemData.type = "UserView" then
if itemData.type = "CollectionFolder" OR itemData.type = "UserView" OR itemData.type = "Channel" then
m.itemText.text = itemData.name
itemPoster.uri = itemData.widePosterURL
return

View File

@ -107,7 +107,7 @@ sub Main()
group = CreateCollectionsList(selectedItem)
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "livetv"
else if ((selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "livetv") OR selectedItem.type = "Channel"
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
@ -165,22 +165,8 @@ sub Main()
group = CreateMovieDetailsGroup(selectedItem)
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if selectedItem.type = "Video" then
' play episode
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 if selectedItem.type = "TvChannel" then
else if selectedItem.type = "TvChannel" or selectedItem.type = "Video" then
' play channel feed
video_id = selectedItem.id

View File

@ -149,11 +149,16 @@ function getTranscodeParameters(meta as object)
end if
end if
streamInfo = { Codec: meta.json.MediaStreams[0].codec }
if meta.json.MediaStreams[0].Profile <> invalid and meta.json.MediaStreams[0].Profile.len() > 0 then
streamInfo = {}
if meta.json.MediaStreams[0] <> invalid and meta.json.MediaStreams[0].codec <> invalid then
streamInfo.Codec = meta.json.MediaStreams[0].codec
end if
if meta.json.MediaStreams[0] <> invalid and meta.json.MediaStreams[0].Profile <> invalid and meta.json.MediaStreams[0].Profile.len() > 0 then
streamInfo.Profile = LCase(meta.json.MediaStreams[0].Profile)
end if
if meta.json.MediaSources[0].container <> invalid and meta.json.MediaSources[0].container.len() > 0 then
if meta.json.MediaSources[0] <> invalid and meta.json.MediaSources[0].container <> invalid and meta.json.MediaSources[0].container.len() > 0 then
streamInfo.Container = meta.json.MediaSources[0].container
end if
@ -225,6 +230,11 @@ function directPlaySupported(meta as object) as boolean
if meta.json.MediaSources[0] <> invalid and meta.json.MediaSources[0].SupportsDirectPlay = false then
return false
end if
if meta.json.MediaStreams[0] = invalid then
return false
end if
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)