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

Add View All for Next Up #1846

Merged
merged 8 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
7 changes: 7 additions & 0 deletions components/ItemGrid/GridItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ sub itemContentChanged()
else
m.itemText.text = itemData.Title
end if
' Adjust to wide posters for "View All Next Up"
if m.topParent.overhangTitle = tr("View All Next Up")
m.itemPoster.height = 331
m.itemPoster.width = 464
m.itemText.translation = [0, m.itemPoster.height + 7]
m.itemText.maxWidth = 464
end if
else if itemData.type = "MusicArtist"
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title
Expand Down
14 changes: 11 additions & 3 deletions components/ItemGrid/ItemGrid.bs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ sub loadInitialItems()
' non recursive for collections (folders, boxsets, photo albums, etc)
m.loadItemsTask.recursive = false
end if

if getCollectionType() = "nextup"
m.loadItemsTask.itemType = "NextUp"
m.itemGrid.itemSize = "[464, 331]"
m.itemGrid.itemSpacing = "[5, 5]"
m.top.imageDisplayMode = "scaleToFit"
m.itemGrid.numColumns = 3
m.alpha.visible = false
end if
else if m.top.parentItem.json.type = "Studio"
m.loadItemsTask.itemId = m.top.parentItem.parentFolder
m.loadItemsTask.itemType = "Series,Movie"
Expand Down Expand Up @@ -402,7 +411,6 @@ sub SetUpOptions()
setPhotoAlbumOptions(options)
else if getCollectionType() = "music"
setMusicOptions(options)

else
setDefaultOptions(options)
end if
Expand Down Expand Up @@ -786,7 +794,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
searchGrp.setFocus(false)
end if

if key = "options"
if key = "options" and getCollectionType() <> "nextup"
if m.options.visible = true
m.options.visible = false
m.top.removeChild(m.options)
Expand Down Expand Up @@ -836,7 +844,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
m.top.quickPlayNode = itemToPlay
return true
end if
else if key = "left" and topGrp.isinFocusChain()
else if key = "left" and topGrp.isinFocusChain() and m.alpha.focusable
m.top.alphaActive = true
topGrp.setFocus(false)
m.alphaMenu.setFocus(true)
Expand Down
13 changes: 12 additions & 1 deletion components/ItemGrid/LoadItemsTask2.bs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ sub loadItems()
url = Substitute("Users/{0}/Items/", m.global.session.user.id)
params.append({ ImageTypeLimit: 1 })
params.append({ EnableImageTypes: "Primary,Backdrop,Banner,Thumb" })
else if LCase(m.top.ItemType) = "nextup"
url = "Shows/NextUp"
params.limit = 100 ' If you have more than 100 in your Next Up queue, maybe go outside a bit more.
params.append({ ImageTypeLimit: 1 })
params.append({ EnableImageTypes: "Primary,Backdrop,Banner,Thumb" })
else
url = Substitute("Users/{0}/Items/", m.global.session.user.id)
end if
Expand Down Expand Up @@ -194,6 +199,12 @@ sub loadItems()
tmp.image = PosterImage(item.id, { "maxHeight": 425, "maxWidth": 290, "quality": "90" })
else if item.type = "Episode"
tmp = CreateObject("roSGNode", "TVEpisode")
if LCase(m.top.ItemType) = "nextup"
tmp.title = item.name
tmp.json = item
tmp.type = "Episode"
tmp.posterUrl = api.items.GetImageURL(item.id, "primary", 0, { "maxHeight": 331, "maxWidth": 464, "quality": "90" })
end if
else if LCase(item.Type) = "recording"
tmp = CreateObject("roSGNode", "RecordingData")
else if item.Type = "Genre"
Expand Down Expand Up @@ -281,7 +292,7 @@ sub loadItems()
end if

if tmp <> invalid
if item.Type <> "Genre" and item.Type <> "MusicGenre"
if LCase(item.Type) <> "genre" and LCase(item.Type) <> "musicgenre" and LCase(m.top.ItemType) <> "nextup"
tmp.parentFolder = m.top.itemId
tmp.json = item
if item.UserData <> invalid and item.UserData.isFavorite <> invalid
Expand Down
14 changes: 8 additions & 6 deletions components/data/HomeData.bs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ sub setData()

' Set appropriate Images for Wide and Tall based on type

if datum.type = "CollectionFolder" or datum.type = "UserView"
params = { "Tag": datum.ImageTags.Primary, "maxHeight": 261, "maxWidth": 464 }
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
m.top.widePosterUrl = m.top.thumbnailURL
if LCase(datum.type) = "collectionfolder" or LCase(datum.type) = "userview"
if IsValid(datum.ImageTags)
params = { "Tag": datum.ImageTags.Primary, "maxHeight": 261, "maxWidth": 464 }
m.top.thumbnailURL = ImageURL(datum.id, "Primary", params)
m.top.widePosterUrl = m.top.thumbnailURL
end if

' Add Icon URLs for display if there is no Poster
if datum.CollectionType = "livetv"
if LCase(m.top.CollectionType) = "livetv"
m.top.iconUrl = "pkg:/images/media_type_icons/live_tv_white.png"
else if datum.CollectionType = "folders"
else if LCase(m.top.CollectionType) = "folders" or LCase(m.top.CollectionType) = "nextup"
m.top.iconUrl = "pkg:/images/media_type_icons/folder_white.png"
end if

Expand Down
16 changes: 16 additions & 0 deletions components/home/LoadItemsTask.bs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ sub loadItems()
tmp.json = item
results.push(tmp)
end for
' Add "View All"
' Note: Unfortunately you could have 0 items show up on the home screen and still have
' a bunch of items in NextUp that are > 365 days old. However, checking here for at
' least 1 item in Next Up means you won't have a "Next Up" section with nothing but a single View All folder.
if data.Items.Count() > 0
jimdogx marked this conversation as resolved.
Show resolved Hide resolved
tmp = CreateObject("roSGNode", "HomeData")
tmp.type = "CollectionFolder"
tmp.usePoster = false
tmp.json = {
IsFolder: true,
Name: tr("View All Next Up"),
Type: "CollectionFolder",
CollectionType: "nextup"
}
results.push(tmp)
end if
end if
' Load Continue Watching
else if m.top.itemsToLoad = "continue"
Expand Down
5 changes: 5 additions & 0 deletions locale/en_US/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,11 @@
<translation>Ratings for how good a movie is</translation>
<extracomment>User Setting - Setting description</extracomment>
</message>
<message>
<source>View All Next Up</source>
<translation>View All Next Up</translation>
<extracomment>Title for viewing all episodes available in the Next Up section</extracomment>
</message>
<message>
<source>Rewatching Next Up</source>
<translation>Rewatching Next Up</translation>
Expand Down
3 changes: 3 additions & 0 deletions source/Main.bs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ sub Main (args as dynamic) as void
group = CreateMovieLibraryView(selectedItem)
else if selectedItem.collectionType = "music"
group = CreateMusicLibraryView(selectedItem)
else if selectedItem.collectionType = "nextup"
group = CreateItemGrid(selectedItem)
group.optionsAvailable = false
else
group = CreateItemGrid(selectedItem)
end if
Expand Down
Loading