Skip to content

Commit

Permalink
Use movie library view for boxset content
Browse files Browse the repository at this point in the history
Fixes #57
  • Loading branch information
1hitsong committed Oct 26, 2024
1 parent fed8df7 commit cea42d6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
13 changes: 13 additions & 0 deletions components/ItemGrid/MovieLibraryView.bs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "pkg:/source/api/baserequest.bs"
import "pkg:/source/api/Image.bs"
import "pkg:/source/enums/ColorPalette.bs"
import "pkg:/source/enums/ItemType.bs"
import "pkg:/source/enums/String.bs"
import "pkg:/source/utils/config.bs"
import "pkg:/source/utils/deviceCapabilities.bs"
Expand Down Expand Up @@ -184,6 +185,11 @@ sub loadInitialItems()
m.loadItemsTask.itemId = m.top.parentItem.Id
end if

if isStringEqual(getCollectionType(), ItemType.BOXSET)
m.loadItemsTask.itemType = "Movie"
m.loadItemsTask.itemId = m.top.parentItem.Id
end if

' By default we load movies
m.loadItemsTask.studioIds = ""
m.loadItemsTask.view = "Movies"
Expand Down Expand Up @@ -248,6 +254,13 @@ sub setMoviesOptions(options)
{ "Title": tr("Genres"), "Name": "Genres" }
]

if isStringEqual(getCollectionType(), ItemType.BOXSET)
options.views = [
{ "Title": tr("Movies (Presentation)"), "Name": "Movies" },
{ "Title": tr("Movies (Grid)"), "Name": "MoviesGrid" },
]
end if

if m.top.parentItem.json.type = "Genre"
options.views = [
{ "Title": tr("Movies (Presentation)"), "Name": "Movies" },
Expand Down
3 changes: 0 additions & 3 deletions components/config/ConfigList.bs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ sub init()
m.top.itemSpacing = [0, 25]

m.top.setfocus(true)
group = m.global.sceneManager.callFunc("getActiveScene")
group.lastFocus = m.top

end sub

sub setData()
Expand Down
2 changes: 0 additions & 2 deletions components/config/LoginScene.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import "pkg:/source/utils/misc.bs"

sub init()
m.top.setFocus(true)
group = m.global.sceneManager.callFunc("getActiveScene")
group.lastFocus = m.top
m.top.optionsAvailable = false
end sub

Expand Down
2 changes: 0 additions & 2 deletions components/config/SetServerScreen.bs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import "pkg:/source/utils/misc.bs"
sub init()
m.top.optionsAvailable = false
m.top.setFocus(true)
group = m.global.sceneManager.callFunc("getActiveScene")
group.lastFocus = m.top

m.serverPicker = m.top.findNode("serverPicker")
m.serverUrlTextbox = m.top.findNode("serverUrlTextbox")
Expand Down
33 changes: 22 additions & 11 deletions source/Main.bs
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,26 @@ sub Main (args as dynamic) as void
end if
end for

' Bypass What's New popup if server is Jellyfin demo
if isStringEqual(m.global.session.server.url, "https://demo.jellyfin.org/stable")
set_user_setting("LastRunVersion", m.global.app.version)
end if

' Bypass What's New popup if deep linking arguments were passed
if not isValidAndNotEmpty(args.mediaType) or not isValidAndNotEmpty(args.contentId)
usersLastRunVersion = m.global.session.user.settings.lastRunVersion
' has the current user ran this version before?
if not isValid(usersLastRunVersion) or not versionChecker(m.global.session.user.settings.lastRunVersion, m.global.app.version)
set_user_setting("LastRunVersion", m.global.app.version)
' show what's new popup
if m.global.session.user.settings["load.allowwhatsnew"]
dialog = createObject("roSGNode", "WhatsNewDialog")
m.scene.dialog = dialog
m.scene.dialog.observeField("buttonSelected", m.port)
end if
set_user_setting("LastRunVersion", m.global.app.version)
end if

' Bypass What's New popup if deep linking arguments were passed
usersLastRunVersion = m.global.session.user.settings.lastRunVersion
' has the current user ran this version before?
if not isValid(usersLastRunVersion) or not versionChecker(m.global.session.user.settings.lastRunVersion, m.global.app.version)
set_user_setting("LastRunVersion", m.global.app.version)
' show what's new popup
if m.global.session.user.settings["load.allowwhatsnew"]
dialog = createObject("roSGNode", "WhatsNewDialog")
m.scene.dialog = dialog
m.scene.dialog.observeField("buttonSelected", m.port)
end if
end if

Expand Down Expand Up @@ -369,6 +377,9 @@ sub Main (args as dynamic) as void
group = CreateItemGrid(selectedItem)
end if
sceneManager.callFunc("pushScene", group)
else if selectedItemType = "boxset"
group = CreateMovieLibraryView(selectedItem)
sceneManager.callFunc("pushScene", group)
else if selectedItemType = "folder" and selectedItem.json.type = "genre"
' User clicked on a genre folder
if selectedItem.json.MovieCount > 0
Expand All @@ -380,7 +391,7 @@ sub Main (args as dynamic) as void
else if selectedItemType = "folder" and LCase(type(selectedItem.json.type)) = "rostring" and LCase(selectedItem.json.type) = "musicgenre"
group = CreateMusicLibraryView(selectedItem)
sceneManager.callFunc("pushScene", group)
else if selectedItemType = "userview" or selectedItemType = "folder" or selectedItemType = "channel" or selectedItemType = "boxset"
else if selectedItemType = "userview" or selectedItemType = "folder" or selectedItemType = "channel"
group = CreateItemGrid(selectedItem)
sceneManager.callFunc("pushScene", group)
else if selectedItemType = "episode" or selectedItemType = "recording"
Expand Down
4 changes: 4 additions & 0 deletions source/static/whatsNew/1.0.8.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
{
"description": "Improve look of overflow description popups",
"author": "1hitsong"
},
{
"description": "Use movie library view for boxset content",
"author": "1hitsong"
}
]

0 comments on commit cea42d6

Please sign in to comment.