Work with videos that span episode numbers

This commit is contained in:
1hitsong 2024-01-28 21:17:51 -05:00
parent 3d282f9fdc
commit f438e1961f
4 changed files with 23 additions and 0 deletions

View File

@ -107,6 +107,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
video.content.contenttype = "episode"
video.seasonNumber = meta.json.ParentIndexNumber
video.episodeNumber = meta.json.IndexNumber
video.episodeNumberEnd = meta.json.IndexNumberEnd
if isValid(meta.showID)
logoLookupID = meta.showID

View File

@ -24,6 +24,7 @@ sub init()
m.top.observeField("itemTitleText", "onItemTitleTextChanged")
m.top.observeField("seasonNumber", "onSeasonNumberChanged")
m.top.observeField("episodeNumber", "onEpisodeNumberChanged")
m.top.observeField("episodeNumberEnd", "onEpisodeNumberEndChanged")
m.top.observeField("logoImage", "onLogoImageChanged")
m.defaultButtonIndex = 1
@ -92,6 +93,21 @@ sub onEpisodeNumberChanged()
end if
end sub
' onEpisodeNumberEndChanged: Handler for changes to m.top.episodeNumberEnd param.
'
sub onEpisodeNumberEndChanged()
m.top.unobserveField("episodeNumberEnd")
itemEpisodeEnd = m.top.findNode("itemEpisodeEnd")
itemEpisodeEnd.font.size = 32
itemEpisodeEnd.text = `-${m.top.episodeNumberEnd}`
' Move the option controls down to give room for episode number
if not m.optionControlsMoved
moveOptionControls(0, OPTIONCONTROLS_TOP_PADDING)
m.optionControlsMoved = true
end if
end sub
' moveOptionControls: Moves option controls node based on passed pixel values
'
' @param {integer} horizontalPixels - Number of horizontal pixels to move option controls

View File

@ -8,6 +8,7 @@
<LayoutGroup id="videoInfo" layoutDirection="horiz" translation="[103,61]">
<Label id="itemSeason" font="font:MediumSystemFont" color="0xffffffFF" />
<Label id="itemEpisode" font="font:MediumSystemFont" color="0xffffffFF" />
<Label id="itemEpisodeEnd" font="font:MediumSystemFont" color="0xffffffFF" />
</LayoutGroup>
</LayoutGroup>
@ -39,6 +40,7 @@
<field id="itemTitleText" type="string" />
<field id="seasonNumber" type="integer" />
<field id="episodeNumber" type="integer" />
<field id="episodeNumberEnd" type="integer" />
<field id="logoImage" type="string" />
<field id="inactiveTimeout" type="integer" />
<field id="progressPercentage" type="float" />

View File

@ -374,6 +374,10 @@ sub onVideoContentLoaded()
if isValid(videoContent[0].episodeNumber)
m.osd.episodeNumber = videoContent[0].episodeNumber
end if
if isValid(videoContent[0].episodeNumberEnd)
m.osd.episodeNumberEnd = videoContent[0].episodeNumberEnd
end if
end if
' Attempt to add logo to OSD