Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label actor episodes with series name, and season & episode numbers #1653

Merged
merged 2 commits into from
Jan 14, 2024
Merged
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
17 changes: 15 additions & 2 deletions components/extras/ExtrasRowList.bs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "pkg:/source/utils/misc.bs"

sub init()
m.top.visible = true
updateSize()
Expand Down Expand Up @@ -183,9 +185,20 @@ function buildRow(rowTitle as string, items, imgWdth = 0)
row = CreateObject("roSGNode", "ContentNode")
row.Title = tr(rowTitle)
for each mov in items
if LCase(mov.json.type) = "episode"
if isAllValid([mov.json.SeriesName, mov.json.ParentIndexNumber, mov.json.IndexNumber, mov.json.Name])
mov.labelText = mov.json.SeriesName
mov.subTitle = `S${mov.json.ParentIndexNumber}:E${mov.json.IndexNumber} - ${mov.json.Name}`
else
mov.labelText = mov.json.Name
mov.subTitle = mov.json.ProductionYear
end if
else
mov.labelText = mov.json.Name
mov.subTitle = mov.json.ProductionYear
end if

mov.Id = mov.json.Id
mov.labelText = mov.json.Name
mov.subTitle = mov.json.ProductionYear
mov.Type = mov.json.Type
if imgWdth > 0
mov.imageWidth = imgWdth
Expand Down
8 changes: 8 additions & 0 deletions source/utils/misc.bs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,14 @@ function isValid(input as dynamic) as boolean
return input <> invalid
end function

' Returns whether or not all items in passed array are valid
function isAllValid(input as object) as boolean
for each item in input
if not isValid(item) then return false
end for
return true
end function

' Returns whether or not passed value is valid and not empty
' Accepts a string, or any countable type (arrays and lists)
function isValidAndNotEmpty(input as dynamic) as boolean
Expand Down