diff --git a/Makefile b/Makefile index b4c714a0..af7e849b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/components/ItemGrid/GridItem.bs b/components/ItemGrid/GridItem.bs index e20e27cc..400a77e3 100644 --- a/components/ItemGrid/GridItem.bs +++ b/components/ItemGrid/GridItem.bs @@ -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 @@ -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 diff --git a/components/home/HomeItem.bs b/components/home/HomeItem.bs index 1048980f..83efe564 100644 --- a/components/home/HomeItem.bs +++ b/components/home/HomeItem.bs @@ -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" @@ -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 diff --git a/components/home/HomeRows.bs b/components/home/HomeRows.bs index e99a3ba9..1a7a9d63 100644 --- a/components/home/HomeRows.bs +++ b/components/home/HomeRows.bs @@ -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++ @@ -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) @@ -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 diff --git a/components/video/VideoPlayerView.bs b/components/video/VideoPlayerView.bs index 8c1bc9d4..b0efdaea 100644 --- a/components/video/VideoPlayerView.bs +++ b/components/video/VideoPlayerView.bs @@ -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 @@ -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 ' @@ -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 diff --git a/manifest b/manifest index 36ed0f30..bc8cf930 100644 --- a/manifest +++ b/manifest @@ -3,7 +3,7 @@ title=Jellyfin major_version=2 minor_version=0 -build_version=4 +build_version=5 ### Main Menu Icons / Channel Poster Artwork diff --git a/package-lock.json b/package-lock.json index e8f363ab..be44ae84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jellyfin-roku", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "jellyfin-roku", - "version": "2.0.4", + "version": "2.0.5", "hasInstallScript": true, "license": "GPL-2.0", "dependencies": { diff --git a/package.json b/package.json index 71f01576..b8397249 100644 --- a/package.json +++ b/package.json @@ -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", @@ -55,4 +55,4 @@ "url": "https://github.com/jellyfin/jellyfin-roku/issues" }, "homepage": "https://github.com/jellyfin/jellyfin-roku" -} \ No newline at end of file +} diff --git a/source/static/whatsNew/2.0.5.json b/source/static/whatsNew/2.0.5.json new file mode 100644 index 00000000..d92c3b53 --- /dev/null +++ b/source/static/whatsNew/2.0.5.json @@ -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" + } +] \ No newline at end of file