Skip to content

Commit

Permalink
Merge pull request #1720 from cewert/merge-205-into-master
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert authored Feb 20, 2024
2 parents c0c6a63 + 204c977 commit 896efc6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# If you want to get_images, you'll also need convert from ImageMagick
##########################################################################

VERSION := 2.0.4
VERSION := 2.0.5

## usage

Expand Down
27 changes: 16 additions & 11 deletions components/ItemGrid/GridItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ sub init()
end sub

sub itemContentChanged()
m.backdrop.blendColor = "#00a4db" ' set default in case global var is invalid
localGlobal = m.global

' Set Random background colors from pallet
posterBackgrounds = m.global.constants.poster_bg_pallet
m.backdrop.blendColor = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
if isValid(localGlobal) and isValid(localGlobal.constants) and isValid(localGlobal.constants.poster_bg_pallet)
posterBackgrounds = localGlobal.constants.poster_bg_pallet
m.backdrop.blendColor = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
end if

itemData = m.top.itemContent

Expand All @@ -56,14 +59,16 @@ sub itemContentChanged()
m.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title
else if itemData.type = "Series"
if m.global.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
else
m.unplayedCount.visible = false
m.unplayedEpisodeCount.text = ""
if isValid(localGlobal) and isValid(localGlobal.session) and isValid(localGlobal.session.user) and isValid(localGlobal.session.user.settings)
if localGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
else
m.unplayedCount.visible = false
m.unplayedEpisodeCount.text = ""
end if
end if
end if
end if
Expand Down
16 changes: 9 additions & 7 deletions components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ end sub


sub itemContentChanged()
m.unplayedCount.visible = false
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
if itemData = invalid then return
localGlobal = m.global

itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"

Expand All @@ -56,16 +57,17 @@ sub itemContentChanged()

if itemData.isWatched
m.playedIndicator.visible = true
m.unplayedCount.visible = false
else
m.playedIndicator.visible = false

if LCase(itemData.type) = "series"
if m.global.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
if isValid(localGlobal) and isValid(localGlobal.session) and isValid(localGlobal.session.user) and isValid(localGlobal.session.user.settings)
if not localGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"]
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
if isValid(m.unplayedCount) then m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
end if
end if
end if
end if
Expand Down
22 changes: 16 additions & 6 deletions components/home/HomeRows.bs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,17 @@ sub processUserSections()
m.expectedRowCount = 1 ' the favorites row is hardcoded to always show atm
m.processedRowCount = 0

sessionUser = m.global.session.user

' calculate expected row count by processing homesections
for i = 0 to 6
sectionName = LCase(m.global.session.user.settings["homesection" + i.toStr()])
userSection = sessionUser.settings["homesection" + i.toStr()]
sectionName = userSection ?? "none"
sectionName = LCase(sectionName)

if sectionName = "latestmedia"
' expect 1 row per filtered media library
m.filteredLatest = filterNodeArray(m.libraryData, "id", m.global.session.user.configuration.LatestItemsExcludes)
m.filteredLatest = filterNodeArray(m.libraryData, "id", sessionUser.configuration.LatestItemsExcludes)
for each latestLibrary in m.filteredLatest
if latestLibrary.collectionType <> "boxsets" and latestLibrary.collectionType <> "livetv" and latestLibrary.json.CollectionType <> "Program"
m.expectedRowCount++
Expand All @@ -94,10 +99,10 @@ sub processUserSections()
' Add home sections in order based on user settings
loadedSections = 0
for i = 0 to 6
sectionName = m.global.session.user.settings["homesection" + i.toStr()]
if not isValid(sectionName) then exit for

userSection = sessionUser.settings["homesection" + i.toStr()]
sectionName = userSection ?? "none"
sectionName = LCase(sectionName)

sectionLoaded = false
if sectionName <> "none"
sectionLoaded = addHomeSection(sectionName)
Expand Down Expand Up @@ -144,8 +149,13 @@ function getOriginalSectionIndex(sectionName as string) as integer
sectionIndex = 0
indexLatestMediaSection = 0

sessionUser = m.global.session.user

for i = 0 to 6
settingSectionName = LCase(m.global.session.user.settings["homesection" + i.toStr()])
userSection = sessionUser.settings["homesection" + i.toStr()]
settingSectionName = userSection ?? "none"
settingSectionName = LCase(settingSectionName)

if settingSectionName = "latestmedia"
indexLatestMediaSection = i
end if
Expand Down
8 changes: 7 additions & 1 deletion components/video/VideoPlayerView.bs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ sub onVideoContentLoaded()
m.top.audioIndex = videoContent[0].audioIndex
m.top.transcodeParams = videoContent[0].transcodeparams
m.chapters = videoContent[0].chapters
m.top.showID = videoContent[0].showID

m.osd.itemTitleText = m.top.content.title

Expand Down Expand Up @@ -444,6 +445,11 @@ sub onNextEpisodeDataLoaded()
m.checkedForNextEpisode = true

m.top.observeField("position", "onPositionChanged")

' If there is no next episode, disable next episode button
if m.getNextEpisodeTask.nextEpisodeData.Items.count() <> 2
m.nextupbuttonseconds = 0
end if
end sub

'
Expand Down Expand Up @@ -558,7 +564,7 @@ sub onState(msg)
m.top.backPressed = true
else if m.top.state = "playing"

' Check if next episde is available
' Check if next episode is available
if isValid(m.top.showID)
if m.top.showID <> "" and not m.checkedForNextEpisode and m.top.content.contenttype = 4
m.getNextEpisodeTask.showID = m.top.showID
Expand Down
2 changes: 1 addition & 1 deletion manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
title=Jellyfin
major_version=2
minor_version=0
build_version=4
build_version=5

### Main Menu Icons / Channel Poster Artwork

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jellyfin-roku",
"type": "module",
"version": "2.0.4",
"version": "2.0.5",
"description": "Roku app for Jellyfin media server",
"dependencies": {
"@rokucommunity/bslib": "0.1.1",
Expand Down Expand Up @@ -55,4 +55,4 @@
"url": "https://github.com/jellyfin/jellyfin-roku/issues"
},
"homepage": "https://github.com/jellyfin/jellyfin-roku"
}
}
18 changes: 18 additions & 0 deletions source/static/whatsNew/2.0.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"description": "Fix sporadic crash when viewing libraries",
"author": "cewert"
},
{
"description": "Prevent crash when homesection setting is invalid",
"author": "1hitsong"
},
{
"description": "Fix 2 sporadic crashes on home view",
"author": "cewert"
},
{
"description": "Only show Next Episode button if there is a next episode",
"author": "1hitsong"
}
]

0 comments on commit 896efc6

Please sign in to comment.