Skip to content

Commit

Permalink
Merge pull request #1987 from Renbo2024/next-up-behavior-configuration
Browse files Browse the repository at this point in the history
New Features: OK button on next up customization and OSD time left customization.
  • Loading branch information
jimdogx authored Oct 23, 2024
2 parents 9e94e2a + 83c4146 commit f394171
Show file tree
Hide file tree
Showing 16 changed files with 214 additions and 20 deletions.
21 changes: 18 additions & 3 deletions components/extras/ExtrasRowList.bs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ sub updateSize()
end sub

sub loadParts(data as object)
m.extrasGrp = m.top.getParent().findNode("extrasGrp")
m.top.parentId = data.id
m.people = data.People
m.LoadAdditionalPartsTask.itemId = m.top.parentId
m.LoadAdditionalPartsTask.control = "RUN"
end sub

sub loadPersonVideos(personId)
m.extrasGrp = m.top.getParent().findNode("extrasGrp")
m.personId = personId
m.LoadMoviesTask.itemId = m.personId
m.LoadMoviesTask.observeField("content", "onMoviesLoaded")
Expand Down Expand Up @@ -114,7 +116,7 @@ sub onLikeThisLoaded()
m.SpecialFeaturesTask.control = "RUN"
end sub

function onSpecialFeaturesLoaded()
sub onSpecialFeaturesLoaded()
data = m.SpecialFeaturesTask.content
m.SpecialFeaturesTask.unobserveField("content")
if data <> invalid and data.count() > 0
Expand All @@ -132,8 +134,8 @@ function onSpecialFeaturesLoaded()
addRowSize([462, 372])
end if

return m.top.content
end function
showOrHideMe()
end sub

sub onMoviesLoaded()
data = m.LoadMoviesTask.content
Expand Down Expand Up @@ -179,6 +181,8 @@ sub onSeriesLoaded()
m.top.content.appendChild(row)
end if
m.top.visible = true

showOrHideMe()
end sub

function buildRow(rowTitle as string, items, imgWdth = 0)
Expand Down Expand Up @@ -218,6 +222,17 @@ sub addRowSize(newRow)
m.top.rowItemSize = newSizeArray
end sub

' don't show popup panel if there is nothing to show
sub showOrHideMe()
if isValid(m.top.content)
if m.top.content.getChildCount() = 0
m.extrasGrp.visible = false
else
m.extrasGrp.visible = true
end if
end if
end sub

sub onRowItemSelected()
m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1])
end sub
Expand Down
1 change: 1 addition & 0 deletions components/home/HomeRows.bs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ end sub
sub itemSelected()
m.selectedRowItem = m.top.rowItemSelected

m.global.launchSource = "home"
m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1])

'Prevent the selected item event from double firing
Expand Down
2 changes: 1 addition & 1 deletion components/movies/MovieDetails.bs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
m.options.setFocus(true)
end if

if key = "down" and m.buttonGrp.isInFocusChain()
if key = "down" and m.buttonGrp.isInFocusChain() and m.extrasGrp.visible = true
m.top.lastFocus = m.extrasGrid
m.extrasGrid.setFocus(true)
m.top.findNode("VertSlider").reverse = false
Expand Down
17 changes: 17 additions & 0 deletions components/tvshows/TVEpisodeRow.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,28 @@ sub init()

m.top.showRowLabel = [false]

m.top.observeField("selectItemId", "onItemSelected")

updateSize()

m.top.setFocus(true)
end sub

sub onItemSelected()
Id = m.top.selectItemId

if Id <> invalid and Id <> "" and m.top.objects <> invalid
for i = 0 to m.top.objects.items.count() - 1
item = m.top.objects.items[i]
if item.id = Id
m.top.jumpToItem = i
return
end if
end for
end if
end sub


sub updateSize()
m.top.translation = [450, 180]

Expand Down
3 changes: 3 additions & 0 deletions components/tvshows/TVEpisodeRow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
<field id="objects" type="assocarray" onChange="setupRows" />
<field id="escapeButton" type="string" alwaysNotify="true" />
<field id="doneLoading" type="boolean" />
<field id="selectItemId" type="string" />

<function name="onItemSelected" />
</interface>
</component>
6 changes: 6 additions & 0 deletions components/tvshows/TVEpisodeRowWithOptions.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ sub init()
m.rows = m.top.findNode("tvEpisodeRow")
m.tvListOptions = m.top.findNode("tvListOptions")

m.top.observeField("selectItemId", "onItemSelected")
m.rows.observeField("doneLoading", "rowsDoneLoading")
end sub

sub onItemSelected()
Id = m.top.selectItemId
m.rows.selectItemId = Id
end sub

sub setupRows()
objects = m.top.objects
m.rows.objects = objects
Expand Down
3 changes: 3 additions & 0 deletions components/tvshows/TVEpisodeRowWithOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
<field id="objects" type="assocarray" onChange="setupRows" />
<field id="itemSelected" type="integer" />
<field id="doneLoading" type="boolean" />
<field id="selectItemId" type="string" />

<function name="onItemSelected" />
</interface>
</component>
8 changes: 8 additions & 0 deletions components/tvshows/TVEpisodes.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "pkg:/source/api/sdk.bs"

sub init()
m.top.optionsAvailable = false
m.top.observeField("selectItemId", "onItemSelected")

m.rows = m.top.findNode("picker")
m.poster = m.top.findNode("seasonPoster")
Expand All @@ -25,6 +26,11 @@ sub setSeasonLoading()
m.top.overhangTitle = tr("Loading...")
end sub

sub onItemSelected()
Id = m.top.selectItemId
m.rows.selectItemId = Id
end sub

' Updates the visibility of the Extras button based on if this season has any extra features
sub setExtraButtonVisibility()
if isValid(m.top.extrasObjects) and isValidAndNotEmpty(m.top.extrasObjects.items)
Expand Down Expand Up @@ -73,13 +79,15 @@ end function
' OnScreenShown: Callback function when view is presented on screen
'
sub OnScreenShown()

if m.isFirstRun
m.isFirstRun = false
return
end if

m.tvEpisodeRow.setFocus(true)
m.top.refreshSeasonDetailsData = not m.top.refreshSeasonDetailsData

end sub

' Handle navigation input from the remote and act on it
Expand Down
3 changes: 3 additions & 0 deletions components/tvshows/TVEpisodes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<field id="objects" alias="picker.objects" />
<field id="episodeObjects" type="assocarray" />
<field id="extrasObjects" type="assocarray" onChange="setExtraButtonVisibility" />
<field id="selectItemId" type="string" />

<function name="updateSeason" />
<function name="onItemSelected" />
</interface>
</component>
16 changes: 15 additions & 1 deletion components/video/OSD.bs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,21 @@ end sub
'
sub onProgressPercentageChanged()
m.videoPositionTime.text = secondsToHuman(m.top.positionTime, true)
m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true)

osdmode = m.global.session.user.settings["ui.general.osdremainingtime"]
if m.global.session.user.settings["ui.design.hideclock"]
' in order to honor the hide clocks setting
osdmode = "remaining"
end if

if osdmode = "remaining"
m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true)
else if osdmode = "timeofday"
m.videoRemainingTime.text = secondsToEndTime(m.top.remainingPositionTime)
else if osdmode = "both"
m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true) + " | " + secondsToEndTime(m.top.remainingPositionTime)
end if

m.progressBar.width = m.progressBarBackground.width * m.top.progressPercentage
end sub

Expand Down
2 changes: 1 addition & 1 deletion components/video/OSD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</Rectangle>

<Label id="videoPositionTime" font="font:MediumSystemFont" color="0xffffffFF" translation="[103,985]" />
<Label id="videoRemainingTime" font="font:MediumSystemFont" color="0xffffffFF" horizAlign="right" width="200" translation="[1617,985]" />
<Label id="videoRemainingTime" font="font:MediumSystemFont" color="0xffffffFF" horizAlign="right" width="400" translation="[1450,985]" />

<Timer id="inactivityTimer" duration="1" repeat="true" />
</children>
Expand Down
47 changes: 46 additions & 1 deletion locale/en_US/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1321,10 +1321,55 @@
<translation>Use Show Image</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>Episode Next Up Behavior</source>
<translation>Episode Next Up Behavior</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>This controls what clicking OK on a Next Up episode does.</source>
<translation>This controls what clicking OK on a Next Up episode does.</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>View Episode Details</source>
<translation>View Episode Details</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>View Season Details</source>
<translation>View Season Details</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>OSD Remaining Time</source>
<translation>OSD Remaining Time</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>How is remaining time represented. Remaining time shows hours, minutes, and seconds remaining. Time of day shows what time the video will complete.</source>
<translation>How is remaining time represented. Remaining time shows hours, minutes, and seconds remaining. Time of day shows what time the video will complete.</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>Remaining Time</source>
<translation>Remaining Time</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>Time of Day</source>
<translation>Time of Day</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>Both</source>
<translation>Both</translation>
<extracomment>User Setting - Setting option title</extracomment>
</message>
<message>
<source>Special</source>
<translation>Special</translation>
<extracomment>Special episode of a TV Show</extracomment>
</message>
</context>
</TS>
</TS>
38 changes: 38 additions & 0 deletions settings/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,23 @@
}
]
},
{
"title": "Episode Next Up Behavior",
"description": "This controls what clicking OK on a Next Up episode does.",
"settingName": "ui.general.episodenextupbehavior",
"type": "radio",
"default": "episode",
"options": [
{
"title": "View Episode Details",
"id": "episode"
},
{
"title": "View Season Details",
"id": "season"
}
]
},
{
"title": "Hide Clock",
"description": "Hide all clocks in Jellyfin. Jellyfin will need to be closed and reopened for changes to take effect.",
Expand All @@ -276,6 +293,27 @@
"type": "integer",
"default": "365"
},
{
"title": "OSD Remaining Time",
"description": "How is remaining time represented. Remaining time shows hours, minutes, and seconds remaining. Time of day shows what time the video will complete.",
"settingName": "ui.general.osdremainingtime",
"type": "radio",
"default": "remaining",
"options": [
{
"title": "Remaining Time",
"id": "remaining"
},
{
"title": "Time of Day",
"id": "timeofday"
},
{
"title": "Both",
"id": "both"
}
]
},
{
"title": "Rewatching Next Up",
"description": "Show already watched episodes in 'Next Up' sections.",
Expand Down
Loading

0 comments on commit f394171

Please sign in to comment.