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

Update master with 2.1.4 bugfixes #1898

Merged
merged 28 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
076fedf
Cache global user setting to ItemGrid and have GridItem's use that in…
cewert Jul 28, 2024
c7fb99a
validate nodes exist to prevent crash
cewert Jul 28, 2024
51f3c07
use isValid()
cewert Jul 28, 2024
190d9b0
add validation to prevent crash
cewert Jul 28, 2024
eda817d
use global session to avoid unneeded API call
cewert Jul 28, 2024
c9eac16
remove unneeded API call and prevent crash when AboutMe() is invalid
cewert Jul 28, 2024
1aea885
Bump build version
jellyfin-bot Jul 28, 2024
6347149
Merge pull request #1877 from jellyfin/bump-bugfix-to-214
cewert Jul 28, 2024
852d57b
validate data to prevent crash
cewert Jul 31, 2024
69aa291
fix crash when data.type is invalid
cewert Jul 31, 2024
fba290f
validate node ref to prevent crash
cewert Jul 31, 2024
05006b3
validate node ref to prevent crash
cewert Jul 31, 2024
da702bc
validate node ref to prevent crash
cewert Jul 31, 2024
74c1f2c
prevent crash by validating data being sent to `CreateSeasonDetailsGr…
cewert Jul 31, 2024
329a796
Merge pull request #1886 from cewert/fix-homeitem-crash2
cewert Jul 31, 2024
fe89be5
Merge pull request #1887 from cewert/fix-itemgrid-crash
cewert Jul 31, 2024
0d30bb6
Merge pull request #1888 from cewert/fix-itemgridoptions-crash
cewert Jul 31, 2024
b28c08a
Merge pull request #1885 from cewert/fix-itemmetadata-crash
cewert Jul 31, 2024
a4c9800
Merge pull request #1884 from cewert/fix-search-crash
cewert Jul 31, 2024
3b13fab
Merge pull request #1889 from cewert/fix-season-details-crash
cewert Jul 31, 2024
e2c390a
Merge pull request #1873 from cewert/fix-loadvideocontenttask-crash
cewert Jul 31, 2024
f4f816e
fix home item alignment when highlighted with remote
cewert Aug 1, 2024
93a6daf
fix verticle alignment of progress bar
cewert Aug 1, 2024
49d8193
Merge pull request #1872 from cewert/fix-extrasitem-crash
cewert Aug 2, 2024
454217a
Merge pull request #1875 from cewert/fix-loadvideocontenttask-crash3
cewert Aug 2, 2024
c7af51f
Merge pull request #1890 from cewert/fix-home-selector
cewert Aug 3, 2024
99ba525
Merge pull request #1871 from cewert/fix-griditem-crash
cewert Aug 3, 2024
a93c893
Merge pull request #1874 from cewert/fix-loadvideocontenttask-crash2
cewert Aug 3, 2024
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
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.1.3
VERSION := 2.1.4

## usage

Expand Down
21 changes: 12 additions & 9 deletions components/ItemGrid/GridItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ sub init()
m.checkmark.height = 60

m.itemText.translation = [0, m.itemPoster.height + 7]

m.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"]
m.itemText.visible = m.gridTitles = "showalways"

' Add some padding space when Item Titles are always showing
if m.itemText.visible then m.itemText.maxWidth = 250

'Parent is MarkupGrid and it's parent is the ItemGrid
m.topParent = m.top.GetParent().GetParent()
'Get the imageDisplayMode for these grid items
if isValid(m.topParent.imageDisplayMode)
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
' grab data from ItemGrid node
m.itemGrid = m.top.GetParent().GetParent() 'Parent is MarkupGrid and it's parent is the ItemGrid

if isValid(m.itemGrid)
if isValid(m.itemGrid.imageDisplayMode)
m.itemPoster.loadDisplayMode = m.itemGrid.imageDisplayMode
end if
if isValid(m.itemGrid.gridTitles)
m.gridTitles = m.itemGrid.gridTitles
end if
end if

end sub
Expand Down Expand Up @@ -91,7 +94,7 @@ sub itemContentChanged()
m.itemPoster.uri = itemData.PosterUrl
'm.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
m.itemPoster.loadDisplayMode = m.itemGrid.imageDisplayMode
else if itemData.type = "Video"
m.itemPoster.uri = itemData.PosterUrl
m.itemIcon.uri = itemData.iconUrl
Expand Down Expand Up @@ -169,7 +172,7 @@ sub focusChanged()
m.posterMask.scale = [1, 1]
else
m.itemText.repeatCount = 0
if m.topParent.alphaActive = true
if m.itemGrid.alphaActive = true
m.posterMask.scale = [0.85, 0.85]
end if
end if
Expand Down
17 changes: 3 additions & 14 deletions components/ItemGrid/ItemGrid.bs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ sub init()

'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]

m.top.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"]
end sub

'
'Genre Item Selected
sub onGenreItemSelected()
m.top.selectedItem = m.genreList.content.getChild(m.genreList.rowItemSelected[0]).getChild(m.genreList.rowItemSelected[1])
end sub

'
'Load initial set of Data
sub loadInitialItems()
m.loadItemsTask.control = "stop"
Expand Down Expand Up @@ -436,7 +436,6 @@ sub SetUpOptions()
m.options.options = options
end sub

'
'Handle loaded data, and add to Grid
sub ItemDataLoaded(msg)
itemData = msg.GetData()
Expand Down Expand Up @@ -497,7 +496,6 @@ sub ItemDataLoaded(msg)
stopLoadingSpinner()
end sub

'
'Set Background Image
sub SetBackground(backgroundUri as string)

Expand All @@ -510,7 +508,6 @@ sub SetBackground(backgroundUri as string)
m.newBackdrop.uri = backgroundUri
end sub

'
'Handle new item being focused
sub onItemFocused()

Expand All @@ -536,7 +533,6 @@ sub onItemFocused()
end if
end sub

'
'When Image Loading Status changes
sub newBGLoaded()
'If image load was sucessful, start the fade swap
Expand All @@ -545,12 +541,9 @@ sub newBGLoaded()
end if
end sub

'
'Swap Complete
sub swapDone()

if m.swapAnimation.state = "stopped"

if isValid(m.swapAnimation) and m.swapAnimation.state = "stopped"
'Set main BG node image and hide transitioning node
m.backdrop.uri = m.newBackdrop.uri
m.backdrop.opacity = 0.25
Expand All @@ -564,7 +557,6 @@ sub swapDone()
end if
end sub

'
'Load next set of items
sub loadMoreData()
if m.Loading = true then return
Expand All @@ -576,7 +568,6 @@ sub loadMoreData()
m.loadItemsTask.control = "RUN"
end sub

'
'Item Selected
sub onItemSelected()
m.top.selectedItem = m.itemGrid.content.getChild(m.itemGrid.itemSelected)
Expand Down Expand Up @@ -627,8 +618,6 @@ sub onvoiceFilter()
end if
end sub


'
'Check if options updated and any reloading required
sub optionsClosed()
if m.top.parentItem.collectionType = "livetv" and m.options.view <> m.view
Expand Down
1 change: 1 addition & 0 deletions components/ItemGrid/ItemGrid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
<field id="alphaSelected" type="string" alias="alpha.letterSelected" alwaysNotify="true" onChange="alphaSelectedChanged" />
<field id="alphaActive" type="boolean" value="false" />
<field id="jumpToItem" type="integer" value="" />
<field id="gridTitles" type="string" />
</interface>
</component>
2 changes: 2 additions & 0 deletions components/ItemGrid/ItemGridOptions.bs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ sub buttonFocusChanged()
end sub

sub toggleFavorite()
if not isValid(m.selectedFavoriteItem) then return

m.favItemsTask = createObject("roSGNode", "FavoriteItemsTask")
if m.favoriteMenu.iconUri = "pkg:/images/icons/favorite.png"
m.favoriteMenu.iconUri = "pkg:/images/icons/favorite_selected.png"
Expand Down
16 changes: 10 additions & 6 deletions components/ItemGrid/LoadVideoContentTask.bs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ enum SubtitleSelection
end enum

sub init()
m.user = AboutMe()
m.top.functionName = "loadItems"
end sub

Expand Down Expand Up @@ -119,8 +118,7 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
video.logoImage = api.items.GetImageURL(logoLookupID, "logo", 0, { "maxHeight": 65, "maxWidth": 300, "quality": "90" })
end if

user = AboutMe()
if user.Configuration.EnableNextEpisodeAutoPlay
if m.global.session.user.Configuration.EnableNextEpisodeAutoPlay
if LCase(m.top.itemType) = "episode"
addNextEpisodesToQueue(video.showID)
end if
Expand Down Expand Up @@ -395,6 +393,12 @@ sub addAudioStreamsToVideo(video)
end sub

sub addSubtitlesToVideo(video, meta)
if not isValid(meta) then return
if not isValid(meta.id) then return
if not isValid(m.playbackInfo) then return
if not isValidAndNotEmpty(m.playbackInfo.MediaSources) then return
if not isValid(m.playbackInfo.MediaSources[0].MediaStreams) then return

subtitles = sortSubtitles(meta.id, m.playbackInfo.MediaSources[0].MediaStreams)
safesubs = subtitles["all"]
subtitleTracks = []
Expand Down Expand Up @@ -565,16 +569,16 @@ function sortSubtitles(id as string, MediaStreams)
end function

function FindPreferredAudioStream(streams as dynamic) as integer
preferredLanguage = m.user.Configuration.AudioLanguagePreference
playDefault = m.user.Configuration.PlayDefaultAudioTrack
preferredLanguage = m.global.session.user.Configuration.AudioLanguagePreference
playDefault = m.global.session.user.Configuration.PlayDefaultAudioTrack

if playDefault <> invalid and playDefault = true
return 1
end if

' Do we already have the MediaStreams or not?
if streams = invalid
url = Substitute("Users/{0}/Items/{1}", m.user.id, m.top.itemId)
url = Substitute("Users/{0}/Items/{1}", m.global.session.user.id, m.top.itemId)
resp = APIRequest(url)
jsonResponse = getJson(resp)

Expand Down
21 changes: 20 additions & 1 deletion components/extras/ExtrasItem.bs
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import "pkg:/source/utils/misc.bs"

sub init()
initPosterImg()
initName()
initRole()
end sub

sub initPosterImg()
m.posterImg = m.top.findNode("posterImg")
end sub

sub initName()
m.name = m.top.findNode("pLabel")
end sub

sub initRole()
m.role = m.top.findNode("subTitle")
end sub

sub showContent()
if m.top.itemContent <> invalid
' validate nodes to prevent crash
if not isValid(m.posterImg) then initPosterImg()
if not isValid(m.name) then initName()
if not isValid(m.role) then initRole()

if isValid(m.top.itemContent)
cont = m.top.itemContent
m.name.text = cont.labelText
m.name.maxWidth = cont.imageWidth
Expand Down
7 changes: 6 additions & 1 deletion components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sub init()
end if

' update the backdrop node
m.backdrop = m.top.findNode("backdrop")
initBackdrop()
m.backdrop.color = backdropColor
end sub

Expand All @@ -46,6 +46,10 @@ sub initItemTextExtra()
m.itemTextExtra = m.top.findNode("itemTextExtra")
end sub

sub initBackdrop()
m.backdrop = m.top.findNode("backdrop")
end sub

sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
Expand All @@ -58,6 +62,7 @@ sub itemContentChanged()
if not isValid(m.itemPoster) then initItemPoster()
if not isValid(m.itemText) then initItemText()
if not isValid(m.itemTextExtra) then initItemTextExtra()
if not isValid(m.backdrop) then initBackdrop()

m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
Expand Down
6 changes: 3 additions & 3 deletions components/home/HomeItem.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="HomeItem" extends="Group">
<children>
<Rectangle id="backdrop" width="464" height="261" translation="[8,5]" />
<Rectangle id="backdrop" width="464" height="261" />
<Poster id="itemIcon" width="100" height="100" translation="[190,85]" loadDisplayMode="scaleToFit" />
<Poster id="itemPoster" width="464" height="261" translation="[8,5]" loadDisplayMode="scaleToZoom">
<Poster id="itemPoster" width="464" height="261" loadDisplayMode="scaleToZoom">
<Rectangle id="unplayedCount" visible="false" width="90" height="60" color="#00a4dcFF" translation="[375, 0]">
<Label id="unplayedEpisodeCount" width="90" height="60" font="font:MediumBoldSystemFont" horizAlign="center" vertAlign="center" />
</Rectangle>
<PlayedCheckmark id="playedIndicator" color="#00a4dcFF" width="60" height="46" visible="false" />
</Poster>
<Rectangle id="progressBackground" visible="false" color="0x00000098" width="464" height="8" translation="[8,260]">
<Rectangle id="progressBackground" visible="false" color="0x00000098" width="464" height="8" translation="[0,253]">
<Rectangle id="progress" color="#00a4dcFF" width="0" height="8" />
</Rectangle>
<ScrollingLabel id="itemText" horizAlign="center" vertAlign="center" font="font:SmallBoldSystemFont" height="64" maxWidth="456" translation="[8,267]" repeatCount="0" />
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=1
build_version=3
build_version=4

### 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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jellyfin-roku",
"type": "module",
"version": "2.1.3",
"version": "2.1.4",
"description": "Roku app for Jellyfin media server",
"dependencies": {
"@rokucommunity/bslib": "0.1.1",
Expand Down
17 changes: 14 additions & 3 deletions source/Main.bs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ sub Main (args as dynamic) as void
else if selectedItemType = "Series"
group = CreateSeriesDetailsGroup(selectedItem.json.id)
else if selectedItemType = "Season"
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id)
if isValid(selectedItem.json) and isValid(selectedItem.json.SeriesId) and isValid(selectedItem.id)
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id)
else
stopLoadingSpinner()
message_dialog(tr("Error loading Season"))
end if
else if selectedItemType = "Movie"
' open movie detail page
group = CreateMovieDetailsGroup(selectedItem)
Expand Down Expand Up @@ -810,7 +815,7 @@ sub Main (args as dynamic) as void
selectedItem = m.global.queueManager.callFunc("getHold")
m.global.queueManager.callFunc("clearHold")

if isValid(selectedItem) and selectedItem.count() > 0 and isValid(selectedItem[0])
if isValidAndNotEmpty(selectedItem) and isValid(selectedItem[0])
if popupNode.returnData.indexselected = 0
'Resume video from resume point
startLoadingSpinner()
Expand Down Expand Up @@ -838,7 +843,13 @@ sub Main (args as dynamic) as void
CreateSeriesDetailsGroup(selectedItem[0].json.SeriesId)
else if popupNode.returnData.indexselected = 3
' User chose Go to season
CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID)
if isValid(selectedItem[0].json) and isValid(selectedItem[0].json.SeriesId) and isValid(selectedItem[0].json.seasonID)
CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID)
else
stopLoadingSpinner()
message_dialog(tr("Error loading Season"))
end if

else if popupNode.returnData.indexselected = 4
' User chose Go to episode
CreateMovieDetailsGroup(selectedItem[0])
Expand Down
2 changes: 1 addition & 1 deletion source/ShowScenes.bs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ function CreateSeriesDetailsGroup(seriesID as string) as dynamic
' Get season data early in the function so we can check number of seasons.
seasonData = TVSeasons(seriesID)
' Divert to season details if user setting goStraightToEpisodeListing is enabled and only one season exists.
if m.global.session.user.settings["ui.tvshows.goStraightToEpisodeListing"] = true and seasonData.Items.Count() = 1
if seasonData <> invalid and m.global.session.user.settings["ui.tvshows.goStraightToEpisodeListing"] and seasonData.Items.Count() = 1
stopLoadingSpinner()
return CreateSeasonDetailsGroupByID(seriesID, seasonData.Items[0].id)
end if
Expand Down
4 changes: 3 additions & 1 deletion source/api/Items.bs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function searchMedia(query as string)
"limit": 100
})

if data = invalid then return []

results = []
for each item in data.Items
tmp = CreateObject("roSGNode", "SearchData")
Expand Down Expand Up @@ -95,7 +97,7 @@ function ItemMetaData(id as string)
tmp.image = PosterImage(data.id, imgParams)
tmp.json = data
return tmp
else if LCase(data.type) = "recording"
else if data.type = "Recording"
tmp = CreateObject("roSGNode", "RecordingData")
tmp.image = PosterImage(data.id, imgParams)
tmp.json = data
Expand Down
Loading