Add support for Intro Skipper plugin (#696)
This commit is contained in:
parent
17e5085fd0
commit
1893121fdf
1
.github/workflows/master-release.yml
vendored
1
.github/workflows/master-release.yml
vendored
|
@ -13,6 +13,7 @@ jobs:
|
|||
with:
|
||||
node-version: "14.12.0"
|
||||
- run: npm ci
|
||||
- run: npx ropm install
|
||||
- run: npm run validate
|
||||
- run: npm run check-formatting
|
||||
- name: "Find and save major_version from manifest"
|
||||
|
|
1
.github/workflows/unstable-release.yml
vendored
1
.github/workflows/unstable-release.yml
vendored
|
@ -13,6 +13,7 @@ jobs:
|
|||
with:
|
||||
node-version: "14.12.0"
|
||||
- run: npm ci
|
||||
- run: npx ropm install
|
||||
- run: npm run validate
|
||||
- run: npm run check-formatting
|
||||
- name: "Find and save major_version from manifest"
|
||||
|
|
1
.github/workflows/validate.yml
vendored
1
.github/workflows/validate.yml
vendored
|
@ -10,5 +10,6 @@ jobs:
|
|||
with:
|
||||
node-version: "14.12.0"
|
||||
- run: npm ci
|
||||
- run: npx ropm install
|
||||
- run: npm run validate
|
||||
- run: npm run check-formatting
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,6 +7,8 @@ source/globals.brs
|
|||
dist/apps
|
||||
out/
|
||||
|
||||
roku_modules
|
||||
|
||||
#NPM modules
|
||||
node_modules/
|
||||
|
||||
|
|
|
@ -8,5 +8,8 @@
|
|||
"locale/**/*.*",
|
||||
"settings/*.*"
|
||||
],
|
||||
"plugins": [ "@rokucommunity/bslint" ]
|
||||
"plugins": [ "@rokucommunity/bslint" ],
|
||||
"diagnosticFilters": [
|
||||
"**/roku_modules/**/*"
|
||||
]
|
||||
}
|
|
@ -2,6 +2,8 @@ sub init()
|
|||
m.playbackTimer = m.top.findNode("playbackTimer")
|
||||
m.bufferCheckTimer = m.top.findNode("bufferCheckTimer")
|
||||
m.top.observeField("state", "onState")
|
||||
m.top.observeField("position", "onPositionChanged")
|
||||
m.top.trickPlayBar.observeField("visible", "onTrickPlayBarVisibilityChange")
|
||||
m.playbackTimer.observeField("fire", "ReportPlayback")
|
||||
m.bufferPercentage = 0 ' Track whether content is being loaded
|
||||
m.playReported = false
|
||||
|
@ -12,6 +14,112 @@ sub init()
|
|||
clockNode = findNodeBySubtype(m.top, "clock")
|
||||
if clockNode[0] <> invalid then clockNode[0].parent.removeChild(clockNode[0].node)
|
||||
end if
|
||||
|
||||
' Skip Intro Button
|
||||
m.skipIntroButton = m.top.findNode("skipIntro")
|
||||
m.skipIntroButton.text = tr("Skip Intro")
|
||||
m.introCompleted = false
|
||||
m.showskipIntroButtonAnimation = m.top.findNode("showskipIntroButton")
|
||||
m.hideskipIntroButtonAnimation = m.top.findNode("hideskipIntroButton")
|
||||
m.moveUpskipIntroButtonAnimation = m.top.findNode("moveUpskipIntroButton")
|
||||
m.moveDownskipIntroButtonAnimation = m.top.findNode("moveDownskipIntroButton")
|
||||
end sub
|
||||
|
||||
'
|
||||
' Checks if we have valid skip intro param data
|
||||
function haveSkipIntroParams() as boolean
|
||||
|
||||
' Intro data is invalid, skip
|
||||
if not isValid(m.top.skipIntroParams?.Valid)
|
||||
return false
|
||||
end if
|
||||
|
||||
' Returned intro data is not valid, return
|
||||
if not m.top.skipIntroParams.Valid
|
||||
return false
|
||||
end if
|
||||
|
||||
return true
|
||||
end function
|
||||
|
||||
'
|
||||
' Handles showing / hiding the skip intro button
|
||||
sub handleSkipIntro()
|
||||
' We've already shown the intro, return
|
||||
if m.introCompleted then return
|
||||
|
||||
' We don't have valid data, return
|
||||
if not haveSkipIntroParams() then return
|
||||
|
||||
' Check if it's time to hide the skip prompt
|
||||
if m.top.position >= m.top.skipIntroParams.HideSkipPromptAt
|
||||
if skipIntroButtonVisible()
|
||||
hideSkipIntro()
|
||||
end if
|
||||
return
|
||||
end if
|
||||
|
||||
' Check if it's time to show the skip prompt
|
||||
if m.top.position >= m.top.skipIntroParams.ShowSkipPromptAt
|
||||
if not skipIntroButtonVisible()
|
||||
showSkipIntro()
|
||||
end if
|
||||
return
|
||||
end if
|
||||
end sub
|
||||
|
||||
'
|
||||
' When Trick Playbar Visibility changes
|
||||
sub onTrickPlayBarVisibilityChange()
|
||||
' Skip Intro button isn't visible, return
|
||||
if not skipIntroButtonVisible() then return
|
||||
|
||||
' Trick Playbar is visible, move the skip intro button up and fade it out
|
||||
if m.top.trickPlayBar.visible
|
||||
m.moveUpskipIntroButtonAnimation.control = "start"
|
||||
|
||||
m.skipIntroButton.setFocus(false)
|
||||
m.top.setFocus(true)
|
||||
|
||||
return
|
||||
end if
|
||||
|
||||
' Trick Playbar is not visible, move the skip intro button down and fade it in
|
||||
m.moveDownskipIntroButtonAnimation.control = "start"
|
||||
m.skipIntroButton.setFocus(true)
|
||||
|
||||
end sub
|
||||
|
||||
'
|
||||
' When Video Player state changes
|
||||
sub onPositionChanged()
|
||||
' Check if content is episode
|
||||
if m.top.content.contenttype = 4
|
||||
handleSkipIntro()
|
||||
end if
|
||||
end sub
|
||||
|
||||
'
|
||||
' Returns if skip intro button is currently visible
|
||||
function skipIntroButtonVisible() as boolean
|
||||
return m.skipIntroButton.opacity > 0
|
||||
end function
|
||||
|
||||
'
|
||||
' Runs skip intro button animation and sets focus to button
|
||||
sub showSkipIntro()
|
||||
m.showskipIntroButtonAnimation.control = "start"
|
||||
m.skipIntroButton.setFocus(true)
|
||||
end sub
|
||||
|
||||
'
|
||||
' Runs hide intro button animation and sets focus back to video
|
||||
sub hideSkipIntro()
|
||||
m.top.trickPlayBar.unobserveField("visible")
|
||||
m.hideskipIntroButtonAnimation.control = "start"
|
||||
m.introCompleted = true
|
||||
m.skipIntroButton.setFocus(false)
|
||||
m.top.setFocus(true)
|
||||
end sub
|
||||
|
||||
'
|
||||
|
@ -130,6 +238,16 @@ end sub
|
|||
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if key = "OK"
|
||||
if not m.top.trickPlayBar.visible
|
||||
if m.skipIntroButton.hasFocus()
|
||||
m.top.seek = m.top.skipIntroParams.IntroEnd
|
||||
hideSkipIntro()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
if not press then return false
|
||||
|
||||
if m.top.Subtitles.count() and key = "down"
|
||||
|
|
|
@ -22,12 +22,30 @@
|
|||
<field id="mediaSourceId" type="string" />
|
||||
<field id="audioIndex" type="integer" />
|
||||
|
||||
<field id="skipIntroParams" type="assocarray" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="JFVideo.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<children>
|
||||
<JFButton id="skipIntro" opacity="0" textColor="#f0f0f0" focusedTextColor="#202020" focusFootprintBitmapUri="pkg:/images/option-menu-bg.9.png" focusBitmapUri="pkg:/images/white.9.png" translation="[1575, 900]" />
|
||||
<timer id="playbackTimer" repeat="true" duration="30" />
|
||||
<timer id="bufferCheckTimer" repeat="true" />
|
||||
|
||||
<Animation id="moveUpskipIntroButton" duration=".1" repeat="false" easeFunction="linear">
|
||||
<Vector2DFieldInterpolator key="[0.0,1.0]" keyValue="[[1575, 900], [1575, 825]]" fieldToInterp="skipIntro.translation"/>
|
||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, .1]" fieldToInterp="skipIntro.opacity" />
|
||||
</Animation>
|
||||
<Animation id="moveDownskipIntroButton" duration=".1" repeat="false" easeFunction="linear">
|
||||
<Vector2DFieldInterpolator key="[0.0,1.0]" keyValue="[[1575, 825], [1575, 900]]" fieldToInterp="skipIntro.translation"/>
|
||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.1, .9]" fieldToInterp="skipIntro.opacity" />
|
||||
</Animation>
|
||||
|
||||
<Animation id="showskipIntroButton" duration="1.0" repeat="false" easeFunction="inQuad">
|
||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[0.0, .9]" fieldToInterp="skipIntro.opacity" />
|
||||
</Animation>
|
||||
<Animation id="hideskipIntroButton" duration=".2" repeat="false" easeFunction="inQuad">
|
||||
<FloatFieldInterpolator key="[0.0, 1.0]" keyValue="[.9, 0]" fieldToInterp="skipIntro.opacity" />
|
||||
</Animation>
|
||||
</children>
|
||||
</component>
|
||||
|
|
|
@ -684,6 +684,10 @@
|
|||
<translation>Hides all clocks in Jellyfin. Jellyfin will need to be closed and reopened for change to take effect.</translation>
|
||||
<extracomment>Settings Menu - Description for option</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>Skip Intro</source>
|
||||
<translation>Skip Intro</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name></name>
|
||||
|
|
1187
package-lock.json
generated
1187
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,8 @@
|
|||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "0.7.3",
|
||||
"brighterscript": "0.55.2",
|
||||
"rooibos-cli": "1.4.0"
|
||||
"rooibos-cli": "1.4.0",
|
||||
"ropm": "^0.10.6"
|
||||
},
|
||||
"scripts": {
|
||||
"validate": "npx bsc --copy-to-staging=false --create-package=false",
|
||||
|
@ -33,6 +34,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/jellyfin/jellyfin-roku#readme",
|
||||
"dependencies": {
|
||||
"api": "npm:jellyfin-api-bs-client@^1.0.5",
|
||||
"brighterscript-formatter": "^1.6.8"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,6 +36,11 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
|
|||
video.id = meta.json.ChannelId
|
||||
end if
|
||||
|
||||
if m.videotype = "Episode" or m.videotype = "Series"
|
||||
video.skipIntroParams = api_API().introskipper.get(video.id)
|
||||
video.content.contenttype = "episode"
|
||||
end if
|
||||
|
||||
video.content.title = meta.title
|
||||
video.showID = meta.showID
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user