Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions components/music/PlaylistItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@ import "pkg:/source/utils/misc.bs"

sub init()
m.title = m.top.findNode("title")
if isValid(m.title)
m.title.font.size = 27
end if

m.subtitle = m.top.findNode("subtitle")
m.subtitle.color = ColorPalette.LIGHTGREY
m.subtitle.font.size = 27
if isValid(m.subtitle)
m.subtitle.font.size = 23
end if
end sub

sub itemContentChanged()
itemData = m.top.itemContent
if not isValidAndNotEmpty(itemData) then return

m.title.text = itemData.LookupCI("title")
m.subtitle.text = getSubtitleText(itemData)
if isValid(m.title)
m.title.text = itemData.LookupCI("title")
end if

if isValid(m.subtitle)
m.subtitle.text = getSubtitleText(itemData)
end if

itemIconData = m.global.queueManager.callFunc("getItemTitleAndIcon", itemData)

Expand All @@ -24,14 +34,25 @@ sub itemContentChanged()
mediaTypeIcon.uri = itemIconData[0]
end if

if isValid(itemData.LookupCI("posterUrl"))
poster = m.top.findNode("poster")
poster.uri = itemData.posterUrl
end if

startingPoint = chainLookupReturn(itemData, "startingPoint", 0)
position = m.top.findNode("position")
if isValid(position)
position.text = ticksToHuman(startingPoint)
end if

if isValid(itemData.LookupCI("RunTimeTicks"))
tracklength = m.top.findNode("tracklength")
tracklength.text = ticksToHuman(itemData.LookupCI("RunTimeTicks"))
end if

' Only apply the played checkmark to specific item types
playlistItemType = chainLookupReturn(itemData, "type", string.EMPTY)
if inArray([ItemType.MOVIE, ItemType.MUSICVIDEO, ItemType.EPISODE, ItemType.RECORDING, ItemType.VIDEO, ItemType.PROGRAM], playlistItemType)
if inArray([ItemType.MOVIE, ItemType.MUSICVIDEO, ItemType.EPISODE, ItemType.RECORDING, ItemType.VIDEO, ItemType.PROGRAM, ItemType.AUDIO], playlistItemType)
playedIndicator = m.top.findNode("playedIndicator")
playedIndicator.data = {
played: chainLookupReturn(itemData, "played", false)
Expand Down Expand Up @@ -65,7 +86,7 @@ function getSubtitleText(itemData as object) as string
if isValid(itemData.LookupCI("ProductionYear"))
subtitleText += `${itemData.LookupCI("ProductionYear")}`
if isValid(itemData.LookupCI("ProductionYear"))
subtitleText += ` - `
subtitleText += ` `
end if
end if

Expand Down
10 changes: 7 additions & 3 deletions components/music/PlaylistItem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
<component name="PlaylistItem" extends="Group">
<children>
<LayoutGroup layoutDirection="horiz" horizAlignment="left" itemSpacings="[25]" translation="[0, 15]">
<Poster id="mediaTypeIcon" width="32" height="32" />
<Rectangle>
<Poster id="mediaTypeIcon" width="40" height="40" translation="[0, 15]" />
</Rectangle>
<Poster id="poster" loadDisplayMode="scaleToZoom" width="70" height="70" />

<LayoutGroup layoutDirection="vert" horizAlignment="left" itemSpacings="[0]">
<ScrollingText height="40" id="title" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" maxWidth="850" />
<ScrollingText height="25" id="subtitle" horizAlign="left" vertAlign="center" font="font:SmallSystemFont" maxWidth="850" />
<ScrollingText height="40" id="title" horizAlign="left" vertAlign="center" font="font:SmallBoldSystemFont" maxWidth="1025" />
<ScrollingText height="25" id="subtitle" horizAlign="left" vertAlign="center" font="font:SmallSystemFont" maxWidth="1025" />
</LayoutGroup>

<LayoutGroup layoutDirection="vert" horizAlignment="left" itemSpacings="[0]">
<Rectangle width="60" height="10" color="0X00000000" />
<PlayedCheckmark id="playedIndicator" width="60" height="46" scale="[.75, .75]" scaleRotateCenter="[0, 0]" />
</LayoutGroup>

<Text id="position" height="60" horizAlign="right" vertAlign="center" font="font:SmallBoldSystemFont" width="150" />
<Text id="tracklength" height="60" horizAlign="right" vertAlign="center" font="font:SmallBoldSystemFont" width="150" />
</LayoutGroup>
</children>
Expand Down
1 change: 0 additions & 1 deletion components/music/PlaylistItems.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "pkg:/source/enums/KeyCode.bs"
import "pkg:/source/utils/misc.bs"

sub init()
m.top.setfocus(true)
group = m.global.sceneManager.callFunc("getActiveScene")
group.lastFocus = m.top
end sub
Expand Down
Loading