Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into homerows-three
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Nov 26, 2024
2 parents cefbeea + eaf2e11 commit 65f03e1
Show file tree
Hide file tree
Showing 26 changed files with 431 additions and 311 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# If you want to get_images, you'll also need convert from ImageMagick
##########################################################################

VERSION := 2.2.2
VERSION := 2.2.5

## usage

Expand Down
20 changes: 18 additions & 2 deletions components/ItemGrid/LoadVideoContentTask.bs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sub loadItems()
forceTranscoding = false

m.top.content = [LoadItems_VideoPlayer(id, mediaSourceId, audio_stream_idx, forceTranscoding)]
m.top.forceMp3 = false
end sub

function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean) as dynamic
Expand Down Expand Up @@ -115,6 +116,21 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
end if
end if

if videotype = "tvchannel" and isValid(meta.json) and isValid(meta.json.CurrentProgram)
if isValid(meta.json.CurrentProgram.Name)
meta.title = `${meta.title}: ${meta.json.CurrentProgram.Name}`
end if
if isValid(meta.json.CurrentProgram.ParentIndexNumber)
video.seasonNumber = meta.json.CurrentProgram.ParentIndexNumber
end if
if isValid(meta.json.CurrentProgram.IndexNumber)
video.episodeNumber = meta.json.CurrentProgram.IndexNumber
end if
if isValid(meta.json.CurrentProgram.IndexNumberEnd)
video.episodeNumberEnd = meta.json.CurrentProgram.IndexNumberEnd
end if
end if

video.chapters = meta.json.Chapters
video.content.title = meta.title
video.showID = meta.showID
Expand Down Expand Up @@ -157,7 +173,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
if not isValid(mediaSourceId) then mediaSourceId = video.id
if meta.live then mediaSourceId = ""

m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition)
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, m.top.forceMp3)
if not isValid(m.playbackInfo)
video.errorMsg = "Error loading playback info"
video.content = invalid
Expand All @@ -174,7 +190,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
video.SelectedSubtitle = defaultSubtitleIndex
subtitle_idx = defaultSubtitleIndex

m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition)
m.playbackInfo = ItemPostPlaybackInfo(video.id, mediaSourceId, audio_stream_idx, subtitle_idx, playbackPosition, m.top.forceMp3)
if not isValid(m.playbackInfo)
video.errorMsg = "Error loading playback info"
video.content = invalid
Expand Down
1 change: 1 addition & 0 deletions components/ItemGrid/LoadVideoContentTask.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<field id="studioIds" type="string" value="" />
<field id="genreIds" type="string" value="" />
<field id="view" type="string" value="" />
<field id="forceMp3" type="boolean" value="false" />
<!-- Total records available from server-->
<field id="totalRecordCount" type="int" value="-1" />
<field id="content" type="array" />
Expand Down
28 changes: 19 additions & 9 deletions components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
if itemData = invalid then return
userSettings = m.global.session.user.settings

itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"

' validate to prevent crash
userSettings = invalid
if isValid(m.global) and isValid(m.global.session) and isValid(m.global.session.user) and isValid(m.global.session.user.settings)
userSettings = m.global.session.user.settings
end if

' validate to prevent crash
if not isValid(m.itemPoster) then initItemPoster()
if not isValid(m.itemText) then initItemText()
Expand Down Expand Up @@ -164,17 +169,22 @@ sub itemContentChanged()
drawProgressBar(itemData)
end if

if userSettings["ui.general.episodeimagesnextup"] = "webclient"
tmpSetting = m.global.session.user.Configuration.useEpisodeImagesInNextUpAndResume
if isValid(tmpSetting) and tmpSetting
m.itemPoster.uri = itemData.thumbnailURL
else
if isValid(userSettings)
if userSettings["ui.general.episodeimagesnextup"] = "webclient"
tmpSetting = m.global.session.user.Configuration.useEpisodeImagesInNextUpAndResume
if isValid(tmpSetting) and tmpSetting
m.itemPoster.uri = itemData.thumbnailURL
else
m.itemPoster.uri = itemData.widePosterURL
end if
else if userSettings["ui.general.episodeimagesnextup"] = "show"
m.itemPoster.uri = itemData.widePosterURL
else if userSettings["ui.general.episodeimagesnextup"] = "episode"
m.itemPoster.uri = itemData.thumbnailURL
end if
else if userSettings["ui.general.episodeimagesnextup"] = "show"
else
' use show image if user settings are invalid for some reason
m.itemPoster.uri = itemData.widePosterURL
else if userSettings["ui.general.episodeimagesnextup"] = "episode"
m.itemPoster.uri = itemData.thumbnailURL
end if

' Set Series and Episode Number for Extra Text
Expand Down
41 changes: 22 additions & 19 deletions components/home/HomeRows.bs
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,30 @@ sub loadLibraries()
end sub

sub updateSize()
m.top.translation = [111, 180]
itemHeight = 330

'Set width of Rows to cut off at edge of Safe Zone
m.top.itemSize = [1703, itemHeight]
uiRowLayout = m.global.session.user.settings["ui.row.layout"]

if isValid(uiRowLayout)
if uiRowLayout = "fullwidth"
m.top.translation = [0, 180]
' rows take up full width of the screen
m.top.itemSize = [1920, 330]
' align with edge of "action" safe zone
m.top.focusXOffset = [96]
m.top.rowLabelOffset = [96, 20]
else
' original layout
m.top.translation = [111, 180]
m.top.itemSize = [1703, 330]
' reset to defaults
m.top.focusXOffset = []
m.top.rowLabelOffset = [0, 20]
end if
end if

' spacing between rows
m.top.itemSpacing = [0, 105]

' spacing between items in a row
m.top.rowItemSpacing = [20, 0]

' Default size to wide poster, the most used size
m.top.rowItemSize = homeRowItemSizes.WIDE_POSTER
m.top.rowItemSpacing = [21, 0]

m.top.visible = true
end sub
Expand Down Expand Up @@ -411,15 +421,6 @@ end sub
' createContinueWatchingRow: Creates a row displaying items the user can continue watching
'
sub createContinueWatchingRow()
sectionName = tr("Continue Watching")

if not sectionExists(sectionName)
nextUpRow = m.top.content.CreateChild("HomeRow")
nextUpRow.title = sectionName
nextUpRow.imageWidth = homeRowItemSizes.WIDE_POSTER[0]
nextUpRow.cursorSize = homeRowItemSizes.WIDE_POSTER
end if

' Load the Continue Watching Data
m.LoadContinueWatchingTask.observeField("content", "updateContinueWatchingItems")
m.LoadContinueWatchingTask.control = "RUN"
Expand Down Expand Up @@ -455,6 +456,8 @@ end sub
sub updateHomeRows()
' Hide the row counter to prevent flicker. We'll show it once loading timer fires
m.top.showRowCounter = [false]
m.top.visible = false
updateSize()
processUserSections()
end sub

Expand Down
14 changes: 14 additions & 0 deletions components/settings/settings.bs
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,19 @@ function onKeyEvent(key as string, press as boolean) as boolean
settingSelected()
end if

if key = "up" and m.settingsMenu.focusedChild <> invalid and m.settingsMenu.itemFocused = 0
m.settingsMenu.jumpToItem = m.settingsMenu.content.getChildCount() - 1

return true
end if

if key = "down" and m.settingsMenu.focusedChild <> invalid
if m.settingsMenu.itemFocused = m.settingsMenu.content.getChildCount() - 1
m.settingsMenu.jumpToItem = 0

return true
end if
end if

return false
end function
7 changes: 6 additions & 1 deletion components/tvshows/TVListDetails.bs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ sub itemContentChanged()
if isValid(itemData.MediaSources)
for i = 0 to itemData.MediaSources.Count() - 1
if item.selectedVideoStreamId = itemData.MediaSources[i].id and isValid(itemData.MediaSources[i].MediaStreams[0])
m.videoCodec.text = tr("Video") + ": " + itemData.MediaSources[i].MediaStreams[0].DisplayTitle
m.videoCodec.text = tr("Video") + ": "
if isValid(itemData.MediaSources[i].MediaStreams[0].DisplayTitle)
m.videoCodec.text = m.videoCodec.text + itemData.MediaSources[i].MediaStreams[0].DisplayTitle
else
m.videoCodec.text = m.videoCodec.text + tr("N/A")
end if
SetupAudioDisplay(itemData.MediaSources[i].MediaStreams, item.selectedAudioStreamIndex)
exit for
end if
Expand Down
102 changes: 50 additions & 52 deletions components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ sub init()

m.playbackTimer = m.top.findNode("playbackTimer")
m.bufferCheckTimer = m.top.findNode("bufferCheckTimer")
m.top.observeField("state", "onState")
m.top.observeField("content", "onContentChange")
m.top.observeField("selectedSubtitle", "onSubtitleChange")
m.top.observeField("audioIndex", "onAudioIndexChange")
Expand Down Expand Up @@ -397,6 +396,8 @@ sub onVideoContentLoaded()
return
end if

m.top.observeField("state", "onState")

m.top.content = videoContent[0].content
m.top.PlaySessionId = videoContent[0].PlaySessionId
m.top.videoId = videoContent[0].id
Expand All @@ -412,7 +413,7 @@ sub onVideoContentLoaded()
m.osd.itemTitleText = m.top.content.title

' If video is an episode, attempt to add season and episode numbers to OSD
if m.top.content.contenttype = 4
if m.top.content.contenttype = 4 or m.top.content.live
if isValid(videoContent[0].seasonNumber)
m.osd.seasonNumber = videoContent[0].seasonNumber
end if
Expand All @@ -438,13 +439,9 @@ sub onVideoContentLoaded()

populateChapterMenu()

if m.LoadMetaDataTask.isIntro
' Disable trackplay bar for intro videos
m.top.enableTrickPlay = false
else
' Allow custom captions for non intro videos
m.top.allowCaptions = true
end if

' Allow custom captions for all videos including intro videos
m.top.allowCaptions = true

' Allow default subtitles
m.top.unobserveField("selectedSubtitle")
Expand All @@ -466,8 +463,8 @@ sub onVideoContentLoaded()
' If IsForced, make sure to remember the Roku global setting so we
' can set it back when the video is done playing.
m.originalClosedCaptionState = m.top.globalCaptionMode
m.top.globalCaptionMode = "On"
end if
m.top.globalCaptionMode = "On"
m.top.subtitleTrack = m.top.availableSubtitleTracks[availableSubtitleTrackIndex].TrackName
end if
end if
Expand Down Expand Up @@ -639,6 +636,17 @@ sub onState(msg)

if not m.playReported and m.top.transcodeAvailable
m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding
else if m.top.errorStr = "decoder:pump:Unsupported AAC stream."
m.log.info("retrying video with mp3 audio stream", m.currentItem.id, m.top.SelectedSubtitle, m.top.audioIndex)

m.top.unobserveField("state")
m.LoadMetaDataTask.forceMp3 = true
m.LoadMetaDataTask.selectedSubtitleIndex = m.top.SelectedSubtitle
m.LoadMetaDataTask.selectedAudioStreamIndex = m.top.audioIndex
m.LoadMetaDataTask.itemId = m.currentItem.id
m.LoadMetaDataTask.observeField("content", "onVideoContentLoaded")

m.LoadMetaDataTask.control = "RUN"
else
' If an error was encountered, Display dialog
showPlaybackErrorDialog(tr("Error During Playback"))
Expand Down Expand Up @@ -825,62 +833,52 @@ function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false

if key = "down" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true

else if key = "up" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true

else if key = "OK" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

' Show OSD, but don't pause video
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

return false
' Show OSD, but don't pause video
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if

' Disable OSD for intro videos
if not m.LoadMetaDataTask.isIntro
if key = "play" and not m.top.trickPlayBar.visible
if key = "play" and not m.top.trickPlayBar.visible

' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

' If video is paused, resume it and don't show OSD
if m.top.state = "paused"
m.top.control = "resume"
return true
end if
' Don't allow user to open menu prior to video loading
if not stateAllowsOSD() then return true

' Pause video and show OSD
m.top.control = "pause"
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
' If video is paused, resume it and don't show OSD
if m.top.state = "paused"
m.top.control = "resume"
return true
end if

' Pause video and show OSD
m.top.control = "pause"
m.osd.visible = true
m.osd.hasFocus = true
m.osd.setFocus(true)
return true
end if

if key = "back"
Expand Down
1 change: 1 addition & 0 deletions components/video/VideoPlayerView.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<field id="retryWithTranscoding" type="boolean" value="false" />
<field id="isTranscoded" type="boolean" />
<field id="transcodeReasons" type="array" />
<field id="forceMp3" type="boolean" value="false" />

<field id="videoId" type="string" />
<field id="mediaSourceId" type="string" />
Expand Down
Loading

0 comments on commit 65f03e1

Please sign in to comment.