Merge branch 'master' into transcoding-fix

This commit is contained in:
Charles Ewert 2022-07-21 21:58:12 -04:00 committed by GitHub
commit 251cebb16d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 312 additions and 965 deletions

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"files.associations": {
"*.ts": "xml"
}
}

View File

@ -94,19 +94,21 @@ sub loadInitialItems()
else
m.sortAscending = false
end if
'Set Stuido Id
' Set Studio Id
if m.top.parentItem.json.type = "Studio"
m.loadItemsTask.studioIds = m.top.parentItem.Id
m.loadItemsTask.studioIds = m.top.parentItem.id
m.loadItemsTask.itemId = m.top.parentItem.parentFolder
m.loadItemsTask.genreIds = ""
'set Genre Id
' Set Genre Id
else if m.top.parentItem.json.type = "Genre"
m.loadItemsTask.genreIds = m.top.parentItem.Id
m.loadItemsTask.genreIds = m.top.parentItem.id
m.loadItemsTask.itemId = m.top.parentItem.parentFolder
m.loadItemsTask.studioIds = ""
else if (m.view = "Shows" or m.options.view = "Shows") or (m.view = "Movies" or m.options.view = "Movies")
m.loadItemsTask.studioIds = ""
m.loadItemsTask.genreIds = ""
else
m.loadItemsTask.itemId = m.top.parentItem.Id
end if
updateTitle()
@ -116,7 +118,7 @@ sub loadInitialItems()
m.loadItemsTask.sortAscending = m.sortAscending
m.loadItemsTask.filter = m.filter
m.loadItemsTask.startIndex = 0
'Load Item Types
' Load Item Types
if m.top.parentItem.collectionType = "movies"
m.loadItemsTask.itemType = "Movie"
m.loadItemsTask.itemId = m.top.parentItem.Id
@ -143,19 +145,15 @@ sub loadInitialItems()
else if m.top.parentItem.collectionType = "livetv"
m.loadItemsTask.itemType = "LiveTV"
'For LiveTV, we want to "Fit" the item images, not zoom
' For LiveTV, we want to "Fit" the item images, not zoom
m.top.imageDisplayMode = "scaleToFit"
if get_user_setting("display.livetv.landing") = "guide" and m.options.view <> "livetv"
showTvGuide()
end if
else if m.top.parentItem.collectionType = "CollectionFolder" or m.top.parentItem.type = "CollectionFolder" or m.top.parentItem.collectionType = "boxsets" or m.top.parentItem.Type = "Boxset" or m.top.parentItem.Type = "Folder" or m.top.parentItem.Type = "Channel"
' Non-recursive, to not show subfolder contents
m.loadItemsTask.recursive = false
m.loadItemsTask.itemId = m.top.parentItem.parentFolder
else if m.top.parentItem.Type = "Channel"
m.top.imageDisplayMode = "scaleToFit"
else if m.top.parentItem.json.type = "Studio"
@ -168,7 +166,7 @@ sub loadInitialItems()
else
print "[ItemGrid] Unknown Type: " m.top.parentItem
end if
'end if
if m.top.parentItem.type <> "Folder" and (m.options.view = "Networks" or m.view = "Networks" or m.options.view = "Studios" or m.view = "Studios")
m.loadItemsTask.view = "Networks"
m.top.imageDisplayMode = "scaleToFit"

View File

@ -3,13 +3,13 @@
<children>
<poster id="backdrop"
loadDisplayMode="scaleToFit"
loadDisplayMode="scaleToFill"
width="1920"
height="1080"
opacity="0.25"
/>
<poster id="backdropTransition"
loadDisplayMode="scaleToFit"
loadDisplayMode="scaleToFill"
width="1920"
height="1080"
opacity="0.25"

View File

@ -37,7 +37,7 @@ sub setData()
imgParams.Append({ "maxHeight": 261 })
imgParams.Append({ "maxWidth": 464 })
m.top.thumbnailURL = ImageURL(datum.Id, "Primary", imgParams)
m.top.thumbnailURL = ImageURL(datum.id, "Primary", imgParams)
' Add Wide Poster (Series Backdrop)
if datum.ParentThumbImageTag <> invalid
@ -45,7 +45,7 @@ sub setData()
else if datum.ParentBackdropImageTags <> invalid
m.top.widePosterUrl = ImageURL(datum.ParentBackdropItemId, "Backdrop", imgParams)
else if datum.ImageTags.Primary <> invalid
m.top.posterUrl = ImageURL(datum.SeriesId, "Primary", imgParams)
m.top.widePosterUrl = ImageURL(datum.id, "Primary", imgParams)
end if
else if datum.type = "Series"
@ -82,7 +82,7 @@ sub setData()
if datum.ImageTags <> invalid and datum.imageTags.Thumb <> invalid
m.top.thumbnailUrl = ImageURL(datum.Id, "Thumb", imgParams)
else if datum.BackdropImageTags <> invalid and datum.BackdropImageTags[0] <> invalid
else if datum.BackdropImageTags[0] <> invalid
m.top.thumbnailUrl = ImageURL(datum.id, "Backdrop", imgParams)
end if
@ -106,7 +106,7 @@ sub setData()
else if datum.BackdropImageTags[0] <> invalid
m.top.thumbnailUrl = ImageURL(datum.id, "Backdrop", imgParams)
end if
else if datum.type = "MusicAlbum" or datum.type = "Audio" or datum.type = "Book"
else if datum.type = "MusicAlbum"
params = { "maxHeight": 261, "maxWidth": 261 }
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
m.top.widePosterUrl = m.top.thumbnailURL

View File

@ -12,8 +12,6 @@
<field id="collectionType" type="string" />
<field id="imageWidth" type="integer" value="464" />
<field id="usePoster" type="bool" value="false" />
<field id="stretch" type="bool" value="false" />
<field id="isSmall" type="bool" value="false" />
</interface>
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />

View File

@ -9,7 +9,7 @@ sub init()
end sub
sub refresh()
m.top.findNode("homeRows").callFunc("loadLibraries")
m.top.findNode("homeRows").callFunc("updateHomeRows")
end sub
sub loadLibraries()

View File

@ -18,6 +18,8 @@ sub itemContentChanged()
itemData = m.top.itemContent
if itemData = invalid then return
itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"
m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
m.itemTextExtra.width = itemData.imageWidth
@ -30,32 +32,18 @@ sub itemContentChanged()
m.itemIcon.uri = itemData.iconUrl
end if
if itemData.stretch = true
m.itemPoster.loadDisplayMode = "scaleToZoom"
end if
' Format the Data based on the type of Home Data
if itemData.type = "CollectionFolder" or itemData.type = "UserView" or itemData.type = "Channel"
m.itemText.text = itemData.name
if itemData.isSmall = true
m.backdrop.height = "100"
m.itemText.translation = [0, 20]
itemData.usePoster = false
end if
if itemData.usePoster = true
m.itemPoster.uri = itemData.widePosterURL
end if
return
end if
if itemData.type = "UserView" and itemData.usePoster = true
if itemData.type = "UserView"
m.itemPoster.width = "96"
m.itemPoster.height = "96"
m.itemPoster.translation = "[192, 88]"
m.itemText.text = itemData.name
if itemData.isSmall = true
m.itemText.translation = [8, 10]
end if
m.itemPoster.uri = itemData.widePosterURL
return
end if
@ -64,7 +52,8 @@ sub itemContentChanged()
m.itemText.height = 34
m.itemText.font.size = 25
m.itemText.horizAlign = "left"
' m.itemText.vertAlign = "bottom"
m.itemText.vertAlign = "bottom"
m.itemTextExtra.visible = true
m.itemTextExtra.font.size = 22
' "Program" is from clicking on an "On Now" item on the Home Screen
@ -86,12 +75,9 @@ sub itemContentChanged()
m.itemText.text = itemData.json.SeriesName
if itemData.usePoster = true
m.itemPoster.uri = itemData.posterURL
else
m.itemPoster.uri = itemData.widePosterURL
end if
if itemData.json.ImageURL <> invalid
m.itemPoster.uri = itemData.json.ImageURL
else
m.itemPoster.uri = itemData.thumbnailURL
end if
' Set Series and Episode Number for Extra Text
@ -119,9 +105,6 @@ sub itemContentChanged()
else
m.itemPoster.uri = itemData.thumbnailURL
end if
if itemData.json.ImageURL <> invalid
m.itemPoster.uri = itemData.json.ImageURL
end if
' Set Release Year and Age Rating for Extra Text
textExtra = ""
@ -148,17 +131,22 @@ sub itemContentChanged()
else
m.itemPoster.uri = itemData.thumbnailURL
end if
if itemData.json.ImageURL <> invalid
m.itemPoster.uri = itemData.json.ImageURL
end if
return
end if
if itemData.type = "Series"
m.itemText.text = itemData.name
if itemData.usePoster = true
if itemData.imageWidth = 180
m.itemPoster.uri = itemData.posterURL
if itemData.json.ImageURL <> invalid
m.itemPoster.uri = itemData.json.ImageURL
else
m.itemPoster.uri = itemData.widePosterURL
end if
else
m.itemPoster.uri = itemData.thumbnailURL
end if
textExtra = ""
if itemData.json.ProductionYear <> invalid
textExtra = StrI(itemData.json.ProductionYear).trim()
@ -175,25 +163,10 @@ sub itemContentChanged()
return
end if
if itemData.type = "MusicAlbum" or itemData.type = "Audio" or itemData.type = "Book" or itemData.type = "AudioBook"
if itemData.type = "MusicAlbum"
m.itemText.text = itemData.name
m.itemTextExtra.text = itemData.json.AlbumArtist
if itemData.usePoster = true
if itemData.posterURL <> ""
m.itemPoster.uri = itemData.posterURL
else
m.itemPoster.uri = itemData.json.ImageURL
end if
end if
return
end if
if itemData.type = "Photo" or itemData.type = "PhotoAlbum"
if itemData.usePoster = true
if itemData.json.ImageURL <> invalid
m.itemPoster.uri = itemData.json.ImageURL
end if
end if
return
end if
@ -215,7 +188,6 @@ end sub
'Hide backdrop and icon when poster loaded
sub onPosterLoadStatusChanged()
if m.itemPoster <> invalid
if m.itemPoster.loadStatus = "ready" and m.itemPoster.uri <> ""
m.backdrop.visible = false
m.itemIcon.visible = false
@ -223,5 +195,4 @@ sub onPosterLoadStatusChanged()
m.backdrop.visible = true
m.itemIcon.visible = true
end if
end if
end sub

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="HomeItem" extends="Group">
<children>
<Rectangle id="backdrop" width="464" height="270" translation="[8,0]" />
<Rectangle id="backdrop" width="464" height="261" translation="[8,5]" />
<Poster id="itemIcon" width="100" height="100" translation="[190,85]" loadDisplayMode="scaleToFit" />
<Poster id="itemPoster" width="464" height="270" translation="[0,0]" loadDisplayMode="scaleToZoom" />
<ScrollingLabel id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" maxWidth="456" translation="[8,280]" repeatCount="0" />
<Label id="itemTextExtra" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" height="32" width="456" translation="[8,319]" visible="true" color="#777777FF" />
<Poster id="itemPoster" width="464" height="261" translation="[8,5]" loadDisplayMode="scaleToZoom" />
<ScrollingLabel id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" maxWidth="456" translation="[8,267]" repeatCount="0" />
<Label id="itemTextExtra" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" height="32" width="456" translation="[8,300]" visible="false" color="#777777FF" />
</children>
<interface>
<field id="itemContent" type="node" onChange="itemContentChanged" />

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="HomeRow" extends="ContentNode">
<interface>
<field id="imageWidth" type="integer" value="200" />
<field id="stretch" type="bool" value="false" />
<field id="imageWidth" type="integer" value="464" />
<field id="usePoster" type="bool" value="false" />
</interface>
</component>

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,5 @@
<function name="updateHomeRows" />
<function name="loadLibraries" />
</interface>
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
<script type="text/brightscript" uri="HomeRows.brs"/>
</component>

View File

@ -13,9 +13,12 @@ sub loadItems()
resp = APIRequest(url)
data = getJson(resp)
for each item in data.Items
' Skip Books for now as we don't support it (issue #525)
if item.CollectionType <> "books"
tmp = CreateObject("roSGNode", "HomeData")
tmp.json = item
results.push(tmp)
end if
end for
' Load Latest Additions to Libraries
@ -27,20 +30,17 @@ sub loadItems()
params["ParentId"] = m.top.itemId
params["EnableImageTypes"] = "Primary,Backdrop,Thumb"
params["ImageTypeLimit"] = 1
params["fields"] = "PrimaryImageAspectRatio,BasicSyncInfo,Path"
params["MaxWidth"] = 416
params["MaxHeight"] = 416
resp = APIRequest(url, params)
data = getJson(resp)
for each item in data
' Skip Books for now as we don't support it (issue #525)
if item.Type <> "Book"
tmp = CreateObject("roSGNode", "HomeData")
item.ImageURL = ImageURL(item.Id, "Primary", params)
if item.type = "Episode"
item.ImageURL = ImageURL(item.Id)
end if
tmp.json = item
results.push(tmp)
end if
end for
' Load Next Up
@ -48,7 +48,6 @@ sub loadItems()
url = "Shows/NextUp"
params = {}
params["Limit"] = 30
params["recursive"] = true
params["SortBy"] = "DatePlayed"
params["SortOrder"] = "Descending"
@ -59,96 +58,38 @@ sub loadItems()
data = getJson(resp)
for each item in data.Items
tmp = CreateObject("roSGNode", "HomeData")
if item.type = "Episode"
item.ImageURL = ImageURL(item.SeriesId, "Backdrop")
else
item.ImageURL = ImageURL(item.Id, "Backdrop")
end if
item.stretch = true
tmp.json = item
results.push(tmp)
end for
' Load Continue Watching
else if m.top.itemsToLoad = "continueVideo"
else if m.top.itemsToLoad = "continue"
url = Substitute("Users/{0}/Items/Resume", get_setting("active_user"))
params = {}
params["Limit"] = 30
params["recursive"] = true
params["SortBy"] = "DatePlayed"
params["SortOrder"] = "Descending"
params["Filters"] = "IsResumable"
params["MediaTypes"] = "Video"
params["EnableImageTypes"] = "Primary,Backdrop,Thumb"
params["ImageTypeLimit"] = 1
resp = APIRequest(url, params)
data = getJson(resp)
for each item in data.Items
' Skip Books for now as we don't support it (issue #558)
if item.Type <> "Book"
tmp = CreateObject("roSGNode", "HomeData")
if item.type = "Episode"
item.ImageURL = ImageURL(item.SeriesId, "Backdrop")
else
item.ImageURL = ImageURL(item.Id, "Backdrop")
tmp.json = item
results.push(tmp)
end if
item.stretch = true
tmp.json = item
results.push(tmp)
end for
else if m.top.itemsToLoad = "continueAudio"
url = Substitute("Users/{0}/Items/Resume", get_setting("active_user"))
params = {}
params["Limit"] = 30
params["recursive"] = true
params["SortBy"] = "DatePlayed"
params["SortOrder"] = "Descending"
params["Filters"] = "IsResumable"
params["MediaTypes"] = "Audio"
params["EnableImageTypes"] = "Primary,Backdrop,Thumb"
params["ImageTypeLimit"] = 1
resp = APIRequest(url, params)
data = getJson(resp)
for each item in data.Items
tmp = CreateObject("roSGNode", "HomeData")
item.ImageURL = ImageURL(item.Id, "Backdrop")
tmp.json = item
results.push(tmp)
end for
else if m.top.itemsToLoad = "continueBook"
url = Substitute("Users/{0}/Items/Resume", get_setting("active_user"))
params = {}
params["Limit"] = 30
params["recursive"] = true
params["SortBy"] = "DatePlayed"
params["SortOrder"] = "Descending"
params["Filters"] = "IsResumable"
params["MediaTypes"] = "Book"
params["EnableImageTypes"] = "Primary,Backdrop,Thumb"
resp = APIRequest(url, params)
data = getJson(resp)
for each item in data.Items
tmp = CreateObject("roSGNode", "HomeData")
item.ImageURL = ImageURL(item.Id, "Backdrop")
tmp.json = item
results.push(tmp)
end for
else if m.top.itemsToLoad = "onNow"
url = "LiveTv/Programs/Recommended"
params = {}
params["Limit"] = 30
params["userId"] = get_setting("active_user")
params["isAiring"] = true
params["limit"] = 16 ' 16 to be consistent with "Latest In"
params["imageTypeLimit"] = 1
params["enableImageTypes"] = "Primary,Thumb,Backdrop"
params["enableTotalRecordCount"] = false

View File

@ -4,7 +4,6 @@
<interface>
<field id="itemsToLoad" type="string" value="libraries" />
<field id="itemId" type="string" />
<field id="nodeNumber" type="integer" />
<field id="metadata" type="assocarray" />
<field id="peopleList" type="array" />
<field id="content" type="array" />

View File

@ -585,6 +585,7 @@
<source>Shows</source>
<translation>Shows</translation>
</message>
<message>
<source>Return to Top</source>
<translation>Return to Top</translation>
<extracomment>UI -> Media Grid -> Item Title in user setting screen.</extracomment>

View File

@ -166,7 +166,7 @@ sub Main (args as dynamic) as void
group = CreateAudioPlayerGroup([selectedItem.json])
else
' TODO - switch on more node types
message_dialog(Substitute(tr("{0} support is coming soon!"), selectedItem.type))
message_dialog("This type is not yet supported: " + selectedItem.type + ".")
end if
else if isNodeEvent(msg, "movieSelected")
' If you select a movie from ANYWHERE, follow this flow

View File

@ -38,15 +38,15 @@ end function
function ImageURL(id, version = "Primary", params = {})
' set defaults
if params.maxHeight = invalid
param = { "fillHeight": "331" }
param = { "maxHeight": "384" }
params.append(param)
end if
if params.maxWidth = invalid
param = { "fillWidth": "464" }
param = { "maxWidth": "196" }
params.append(param)
end if
if params.quality = invalid
param = { "quality": "96" }
param = { "quality": "90" }
params.append(param)
end if
url = Substitute("Items/{0}/Images/{1}", id, version)
@ -63,7 +63,7 @@ function UserImageURL(id, params = {})
params.append({ "maxWidth": "300" })
end if
if params.quality = invalid
params.append({ "quality": "96" })
params.append({ "quality": "90" })
end if
url = Substitute("Users/{0}/Images/Primary", id)

View File

@ -141,52 +141,11 @@ sub LoadUserPreferences()
resp = APIRequest(url)
jsonResponse = getJson(resp)
if jsonResponse <> invalid and jsonResponse.CustomPrefs <> invalid
if jsonResponse.CustomPrefs["landing-livetv"] <> invalid
if jsonResponse <> invalid and jsonResponse.CustomPrefs <> invalid and jsonResponse.CustomPrefs["landing-livetv"] <> invalid
set_user_setting("display.livetv.landing", jsonResponse.CustomPrefs["landing-livetv"])
end if
' Take into account nones, if nones are in the middle then resort them to the end to be removed later in HomeRows
nones = 0
for i = 0 to 6
if jsonResponse.CustomPrefs["homesection" + i.ToStr()] <> invalid
if jsonResponse.CustomPrefs["homesection" + i.ToStr()] = "none"
nones += 1
else
if nones > 0
j = i - nones
set_user_setting("display.homesection" + i.ToStr(), "none")
set_user_setting("display.homesection" + j.ToStr(), jsonResponse.CustomPrefs["homesection" + i.ToStr()])
else
set_user_setting("display.homesection" + i.ToStr(), jsonResponse.CustomPrefs["homesection" + i.ToStr()])
unset_user_setting("display.livetv.landing")
end if
end if
end if
end for
if jsonResponse.CustomPrefs["homesection0"] = invalid
setHomeScreenDefaults()
end if
else
setHomeScreenDefaults()
end if
' Actual user settings for getting ordered views
url = Substitute("Users/{0}", id)
resp = APIRequest(url)
jsonResponse = getJson(resp)
if jsonResponse <> invalid
set_user_setting("display.userConfig", FormatJson(jsonResponse))
end if
end sub
sub setHomeScreenDefaults()
set_user_setting("display.homesection0", "smalllibrarytiles")
set_user_setting("display.homesection1", "resume")
set_user_setting("display.homesection2", "resumeaudio")
set_user_setting("display.homesection3", "resumebook")
set_user_setting("display.homesection4", "livetv")
set_user_setting("display.homesection5", "nextup")
set_user_setting("display.homesection6", "latestmedia")
end sub
sub LoadUserAbilities(user)