Skip to content

Commit

Permalink
Merge branch 'unstable' into server_url
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenrats authored Oct 15, 2023
2 parents d4483a2 + 1465c62 commit 8f8650f
Show file tree
Hide file tree
Showing 30 changed files with 6,930 additions and 310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: "lts/*"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout master (the latest release)
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
ref: master
- name: Install jq to parse json
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Save old Makefile version
run: awk 'BEGIN { FS=" = " } /^VERSION/ { print "oldMakeVersion="$2; }' Makefile >> $GITHUB_ENV
- name: Checkout PR branch
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Save new package.json version
run: echo "newPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV
- name: package.json version must be updated
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
prod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: "lts/*"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/roku-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
static:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
node-version: "lts/*"
cache: "npm"
Expand Down
3 changes: 3 additions & 0 deletions components/ItemGrid/GridItem.brs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ sub itemContentChanged()
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
else
m.unplayedCount.visible = false
m.unplayedEpisodeCount.text = ""
end if
end if
end if
Expand Down
7 changes: 4 additions & 3 deletions components/data/SceneManager.brs
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,17 @@ end sub
sub popScene()
group = m.groups.pop()
if group <> invalid
if group.isSubType("JFGroup")
groupType = group.subtype()
if groupType = "JFGroup"
unregisterOverhangData(group)
else if group.isSubType("JFVideo")
else if groupType = "JFVideo"
' Stop video to make sure app communicates stop playstate to server
group.control = "stop"
end if

group.visible = false

if group.isSubType("JFScreen")
if groupType = "JFScreen"
group.callFunc("OnScreenHidden")
end if
else
Expand Down
7 changes: 3 additions & 4 deletions components/data/UserData.brs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ sub loadFromRegistry(id as string)
end sub

sub saveToRegistry()
set_user_setting("username", m.top.username)
set_user_setting("token", m.top.token)

users = parseJson(get_setting("available_users", "[]"))
this_user = invalid
for each user in users
Expand Down Expand Up @@ -57,7 +54,9 @@ function setPreference(key as string, value as string)
end function

sub setActive()
set_setting("active_user", m.top.id)
if m.global.session.user.settings["global.rememberme"]
set_setting("active_user", m.top.id)
end if
end sub

sub setServer(hostname as string)
Expand Down
6 changes: 4 additions & 2 deletions components/movies/MovieDetails.brs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ end sub
sub trailerAvailableChanged()
if m.top.trailerAvailable
' add trailor button to button group
trailerButton = CreateObject("roSGNode", "JFButton")
trailerButton = CreateObject("roSGNode", "Button")
trailerButton.id = "trailer-button"
trailerButton.text = tr("Play Trailer")
trailerButton.iconUri = ""
trailerButton.focusedIconUri = ""
trailerButton.maxWidth = "300"
trailerButton.minWidth = "300"
trailerButton.minWidth = "280"
m.buttonGrp.appendChild(trailerButton)
else
' remove trailor button from button group
Expand Down
39 changes: 32 additions & 7 deletions components/settings/settings.brs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import "pkg:/source/utils/config.brs"
import "pkg:/source/utils/misc.brs"
import "pkg:/source/roku_modules/log/LogMixin.brs"
import "pkg:/source/api/sdk.bs"

sub init()
m.log = log.Logger("Settings")
m.top.overhangTitle = tr("Settings")
m.top.optionsAvailable = false

m.userLocation = []

m.settingsMenu = m.top.findNode("settingsMenu")
m.settingDetail = m.top.findNode("settingDetail")
m.settingDesc = m.top.findNode("settingDesc")
m.settingTitle = m.top.findNode("settingTitle")
m.path = m.top.findNode("path")

m.boolSetting = m.top.findNode("boolSetting")
Expand Down Expand Up @@ -72,7 +71,7 @@ sub LoadMenu(configSection)
end if

' Set Path display
m.path.text = ""
m.path.text = tr("Settings")
for each level in m.userLocation
if level.title <> invalid then m.path.text += " / " + tr(level.title)
end for
Expand All @@ -82,7 +81,7 @@ sub settingFocused()

selectedSetting = m.userLocation.peek().children[m.settingsMenu.itemFocused]
m.settingDesc.text = tr(selectedSetting.Description)
m.settingTitle.text = tr(selectedSetting.Title)
m.top.overhangTitle = tr(selectedSetting.Title)

' Hide Settings
m.boolSetting.visible = false
Expand Down Expand Up @@ -160,14 +159,40 @@ end sub


sub boolSettingChanged()

if m.boolSetting.focusedChild = invalid then return
selectedSetting = m.userLocation.peek().children[m.settingsMenu.itemFocused]

if m.boolSetting.checkedItem
set_user_setting(selectedSetting.settingName, "true")
session.user.settings.Save(selectedSetting.settingName, "true")
if Left(selectedSetting.settingName, 7) = "global."
' global user setting
' save to main registry block
set_setting(selectedSetting.settingName, "true")
' setting specific triggers
if selectedSetting.settingName = "global.rememberme"
print "m.global.session.user.id=", m.global.session.user.id
set_setting("active_user", m.global.session.user.id)
end if
else
' regular user setting
' save to user specific registry block
set_user_setting(selectedSetting.settingName, "true")
end if
else
set_user_setting(selectedSetting.settingName, "false")
session.user.settings.Save(selectedSetting.settingName, "false")
if Left(selectedSetting.settingName, 7) = "global."
' global user setting
' save to main registry block
set_setting(selectedSetting.settingName, "false")
' setting specific triggers
if selectedSetting.settingName = "global.rememberme"
unset_setting("active_user")
end if
else
' regular user setting
' save to user specific registry block
set_user_setting(selectedSetting.settingName, "false")
end if
end if
end sub

Expand Down
35 changes: 19 additions & 16 deletions components/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@
<LabelList
translation="[120,250]"
id="settingsMenu"
itemSize="[440,48]"
itemSize="[510,54]"
vertFocusAnimationStyle="floatingFocus"
focusBitmapBlendColor="#006fab"
focusedColor="#ffffff"
itemSpacing="[0,5]" />
itemSpacing="[0,9]"
textVertAlign="center" />

<Poster
translation="[710,250]" id="testRectangle" width="880" height="700" uri="pkg:/images/white.9.png"
translation="[710,230]" id="testRectangle" width="1210" height="830" uri="pkg:/images/white.9.png"
blendColor="#3f3f3f" />

<LayoutGroup translation="[1150,275]" id="settingDetail" vertAlignment="top" horizAlignment="center" itemSpacings="[50]">
<LayoutGroup translation="[1278,270]" id="settingDetail" vertAlignment="top" horizAlignment="center" itemSpacings="[50]">
<Label id="settingDesc"
width="1065"
wrap="true"
horizAlign="center"
translation="[750,270]" />

<ScrollingLabel font="font:LargeSystemFont" id="settingTitle" maxWidth="750" />

<Label id="settingDesc" width="750" wrap="true" />

<RadioButtonList id="boolSetting" vertFocusAnimationStyle="floatingFocus">
<ContentNode role="content">
<ContentNode title="Disabled" />
<ContentNode title="Enabled" />
</ContentNode>
</RadioButtonList>
<RadioButtonList id="radioSetting" vertFocusAnimationStyle="floatingFocus" />
</LayoutGroup>

<RadioButtonList id="radioSetting" translation="[900, 450]" inheritParentTransform="false" vertFocusAnimationStyle="floatingFocus" />
<intkeyboard_integerKeyboard translation="[900, 520]" id="integerSetting" maxLength="3" domain="numeric" visible="false" />
<RadioButtonList id="boolSetting" vertFocusAnimationStyle="floatingFocus" translation="[1034, 510]">
<ContentNode role="content">
<ContentNode title="Disabled" />
<ContentNode title="Enabled" />
</ContentNode>
</RadioButtonList>

<intkeyboard_integerKeyboard translation="[1034, 510]" id="integerSetting" maxLength="3" domain="numeric" visible="false" />

</children>
</component>
88 changes: 74 additions & 14 deletions components/video/VideoPlayerView.brs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sub init()
m.top.observeField("content", "onContentChange")
m.top.observeField("selectedSubtitle", "onSubtitleChange")

' Custom Caption Function
m.top.observeField("allowCaptions", "onAllowCaptionsChange")

m.playbackTimer.observeField("fire", "ReportPlayback")
m.bufferPercentage = 0 ' Track whether content is being loaded
m.playReported = false
Expand Down Expand Up @@ -51,6 +54,51 @@ sub init()
m.top.trickPlayBar.filledBarBlendColor = m.global.constants.colors.blue
end sub

' Only setup captain items if captions are allowed
sub onAllowCaptionsChange()
if not m.top.allowCaptions then return

m.captionGroup = m.top.findNode("captionGroup")
m.captionGroup.createchildren(9, "LayoutGroup")
m.captionTask = createObject("roSGNode", "captionTask")
m.captionTask.observeField("currentCaption", "updateCaption")
m.captionTask.observeField("useThis", "checkCaptionMode")
m.top.observeField("subtitleTrack", "loadCaption")
m.top.observeField("globalCaptionMode", "toggleCaption")

if m.global.session.user.settings["playback.subs.custom"]
m.top.suppressCaptions = true
toggleCaption()
else
m.top.suppressCaptions = false
end if
end sub

' Set caption url to server subtitle track
sub loadCaption()
if m.top.suppressCaptions
m.captionTask.url = m.top.subtitleTrack
end if
end sub

' Toggles visibility of custom subtitles and sets captionTask's player state
sub toggleCaption()
m.captionTask.playerState = m.top.state + m.top.globalCaptionMode
if LCase(m.top.globalCaptionMode) = "on"
m.captionTask.playerState = m.top.state + m.top.globalCaptionMode + "w"
m.captionGroup.visible = true
else
m.captionGroup.visible = false
end if
end sub

' Removes old subtitle lines and adds new subtitle lines
sub updateCaption()
m.captionGroup.removeChildrenIndex(m.captionGroup.getChildCount(), 0)
m.captionGroup.appendChildren(m.captionTask.currentCaption)
end sub

' Event handler for when selectedSubtitle changes
sub onSubtitleChange()
' Save the current video position
m.global.queueManager.callFunc("setTopStartingPoint", int(m.top.position) * 10000000&)
Expand Down Expand Up @@ -114,7 +162,11 @@ sub onVideoContentLoaded()
m.top.transcodeParams = videoContent[0].transcodeparams

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

if isValid(m.top.audioIndex)
Expand All @@ -132,21 +184,12 @@ sub onContentChange()
if not isValid(m.top.content) then return

m.top.observeField("position", "onPositionChanged")

' If video content type is not episode, remove position observer
if m.top.content.contenttype <> 4
m.top.unobserveField("position")
end if
end sub

sub onNextEpisodeDataLoaded()
m.checkedForNextEpisode = true

m.top.observeField("position", "onPositionChanged")

if m.getNextEpisodeTask.nextEpisodeData.Items.count() <> 2
m.top.unobserveField("position")
end if
end sub

'
Expand Down Expand Up @@ -189,16 +232,27 @@ end sub

' When Video Player state changes
sub onPositionChanged()
if isValid(m.captionTask)
m.captionTask.currentPos = Int(m.top.position * 1000)
end if

' Check if dialog is open
m.dialog = m.top.getScene().findNode("dialogBackground")
if not isValid(m.dialog)
checkTimeToDisplayNextEpisode()
' Do not show Next Episode button for intro videos
if not m.LoadMetaDataTask.isIntro
checkTimeToDisplayNextEpisode()
end if
end if
end sub

'
' When Video Player state changes
sub onState(msg)
if isValid(m.captionTask)
m.captionTask.playerState = m.top.state + m.top.globalCaptionMode
end if

' When buffering, start timer to monitor buffering process
if m.top.state = "buffering" and m.bufferCheckTimer <> invalid

Expand Down Expand Up @@ -319,11 +373,17 @@ function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false

if key = "down"
m.top.selectSubtitlePressed = true
return true
' Do not show subtitle selection for intro videos
if not m.LoadMetaDataTask.isIntro
m.top.selectSubtitlePressed = true
return true
end if
else if key = "up"
m.top.selectPlaybackInfoPressed = true
return true
' Do not show playback info for intro videos
if not m.LoadMetaDataTask.isIntro
m.top.selectPlaybackInfoPressed = true
return true
end if
else if key = "OK"
' OK will play/pause depending on current state
' return false to allow selection during seeking
Expand Down
Loading

0 comments on commit 8f8650f

Please sign in to comment.