From bb2c6ba42d37ab99c3139f2a16ecfe012d7d1890 Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Mon, 6 Jun 2022 20:31:57 -0400
Subject: [PATCH 1/9] Create Artist & Album view for music
---
components/ItemGrid/ItemGrid.brs | 44 +++++++++++++++++++++++---
components/music/MusicAlbumDetails.brs | 14 --------
2 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/components/ItemGrid/ItemGrid.brs b/components/ItemGrid/ItemGrid.brs
index a2592154..45dd578a 100644
--- a/components/ItemGrid/ItemGrid.brs
+++ b/components/ItemGrid/ItemGrid.brs
@@ -69,6 +69,11 @@ sub loadInitialItems()
m.sortField = get_user_setting("display.livetv.sortField")
sortAscendingStr = get_user_setting("display.livetv.sortAscending")
m.filter = get_user_setting("display.livetv.filter")
+ else if m.top.parentItem.collectionType = "music"
+ m.view = get_user_setting("display.music.view")
+ m.sortField = get_user_setting("display." + m.top.parentItem.Id + ".sortField")
+ sortAscendingStr = get_user_setting("display." + m.top.parentItem.Id + ".sortAscending")
+ m.filter = get_user_setting("display." + m.top.parentItem.Id + ".filter")
else
m.view = invalid
m.sortField = get_user_setting("display." + m.top.parentItem.Id + ".sortField")
@@ -101,9 +106,20 @@ sub loadInitialItems()
else if m.top.parentItem.collectionType = "tvshows"
m.loadItemsTask.itemType = "Series"
else if m.top.parentItem.collectionType = "music"
- m.loadItemsTask.itemType = "MusicArtist,MusicAlbum"
- m.loadItemsTask.fallbackType = "MusicAlbum"
+ ' Default Settings
m.loadItemsTask.recursive = false
+ m.loadItemsTask.itemType = "MusicArtist,MusicAlbum"
+
+ m.view = get_user_setting("display.music.view")
+
+ if m.view = "music-artist"
+ m.loadItemsTask.recursive = true
+ m.loadItemsTask.itemType = "MusicArtist"
+ else if m.view = "music-album"
+ m.loadItemsTask.itemType = "MusicAlbum"
+ m.loadItemsTask.recursive = true
+ end if
+
else if m.top.parentItem.collectionType = "livetv"
m.loadItemsTask.itemType = "LiveTV"
@@ -214,7 +230,11 @@ sub SetUpOptions()
options.filter = []
'Music
else if m.top.parentItem.collectionType = "music"
- options.views = [{ "Title": tr("Music"), "Name": "music" }]
+ options.views = [
+ { "Title": tr("Default"), "Name": "music-default" },
+ { "Title": tr("Artists"), "Name": "music-artist" },
+ { "Title": tr("Albums"), "Name": "music-album" },
+ ]
options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" },
{ "Title": tr("DATE_ADDED"), "Name": "DateCreated" },
@@ -414,7 +434,6 @@ sub optionsClosed()
m.top.removeChild(m.tvGuide)
end if
end if
-
end if
if m.top.parentItem.Type = "CollectionFolder" or m.top.parentItem.CollectionType = "CollectionFolder"
@@ -429,6 +448,23 @@ sub optionsClosed()
end if
reload = false
+
+ if m.top.parentItem.collectionType = "music"
+ if m.options.view <> m.view
+ if m.options.view = "music-artist"
+ m.view = "music-artist"
+ set_user_setting("display.music.view", m.view)
+ else if m.options.view = "music-album"
+ m.view = "music-album"
+ set_user_setting("display.music.view", m.view)
+ else
+ m.view = "music-default"
+ end if
+ set_user_setting("display.music.view", m.view)
+ reload = true
+ end if
+ end if
+
if m.options.sortField <> m.sortField or m.options.sortAscending <> m.sortAscending
m.sortField = m.options.sortField
m.sortAscending = m.options.sortAscending
diff --git a/components/music/MusicAlbumDetails.brs b/components/music/MusicAlbumDetails.brs
index 33c53d63..dca18ba8 100644
--- a/components/music/MusicAlbumDetails.brs
+++ b/components/music/MusicAlbumDetails.brs
@@ -12,7 +12,6 @@ sub init()
m.spinner.visible = true
m.dscr = m.top.findNode("overview")
- m.dscr.observeField("isTextEllipsized", "onEllipsisChanged")
createDialogPallete()
end sub
@@ -123,19 +122,6 @@ function onKeyEvent(key as string, press as boolean) as boolean
return false
end function
-sub onEllipsisChanged()
- if m.dscr.isTextEllipsized
- dscrShowFocus()
- end if
-end sub
-
-sub dscrShowFocus()
- if m.dscr.isTextEllipsized
- m.dscr.setFocus(true)
- m.dscr.opacity = 1.0
- end if
-end sub
-
sub createFullDscrDlg()
dlg = CreateObject("roSGNode", "OverviewDialog")
dlg.Title = tr("Press 'Back' to Close")
From 45cc71020026ce29730f9ad5073f0e6e1a8288a9 Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Mon, 6 Jun 2022 20:41:35 -0400
Subject: [PATCH 2/9] Remove dupe code
---
components/ItemGrid/ItemGrid.brs | 2 --
1 file changed, 2 deletions(-)
diff --git a/components/ItemGrid/ItemGrid.brs b/components/ItemGrid/ItemGrid.brs
index 45dd578a..3cf1dc3b 100644
--- a/components/ItemGrid/ItemGrid.brs
+++ b/components/ItemGrid/ItemGrid.brs
@@ -453,10 +453,8 @@ sub optionsClosed()
if m.options.view <> m.view
if m.options.view = "music-artist"
m.view = "music-artist"
- set_user_setting("display.music.view", m.view)
else if m.options.view = "music-album"
m.view = "music-album"
- set_user_setting("display.music.view", m.view)
else
m.view = "music-default"
end if
From 03b6ce984aa2c5cd6451d17508ec2e07271bebcf Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Wed, 8 Jun 2022 09:08:05 -0400
Subject: [PATCH 3/9] Add instant mix to album screen
---
components/music/MusicAlbumDetails.brs | 15 +++++++++++---
components/music/MusicAlbumDetails.xml | 2 ++
source/Main.brs | 7 +++++++
source/ShowScenes.brs | 28 ++++++++++++++++++++++++++
source/api/Items.brs | 11 ++++++++++
5 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/components/music/MusicAlbumDetails.brs b/components/music/MusicAlbumDetails.brs
index 33c53d63..e4784842 100644
--- a/components/music/MusicAlbumDetails.brs
+++ b/components/music/MusicAlbumDetails.brs
@@ -3,6 +3,7 @@ sub init()
setupMainNode()
m.playAlbum = m.top.findNode("playAlbum")
+ m.instantMix = m.top.findNode("instantMix")
m.albumCover = m.top.findNode("albumCover")
m.songList = m.top.findNode("songList")
m.infoGroup = m.top.FindNode("infoGroup")
@@ -112,12 +113,20 @@ function onKeyEvent(key as string, press as boolean) as boolean
return false
end if
- if key = "right" and m.playAlbum.hasFocus()
- m.songList.setFocus(true)
- return true
+ if key = "right"
+ if m.playAlbum.hasFocus() or m.instantMix.hasFocus()
+ m.songList.setFocus(true)
+ return true
+ end if
else if key = "left" and m.songList.hasFocus()
m.playAlbum.setFocus(true)
return true
+ else if key = "down" and m.playAlbum.hasFocus()
+ m.instantMix.setFocus(true)
+ return true
+ else if key = "up" and m.instantMix.hasFocus()
+ m.playAlbum.setFocus(true)
+ return true
end if
return false
diff --git a/components/music/MusicAlbumDetails.xml b/components/music/MusicAlbumDetails.xml
index 5703dee9..d2ad590a 100644
--- a/components/music/MusicAlbumDetails.xml
+++ b/components/music/MusicAlbumDetails.xml
@@ -10,6 +10,7 @@
+
@@ -26,6 +27,7 @@
+
diff --git a/source/Main.brs b/source/Main.brs
index 377ed1cc..4edc58a6 100644
--- a/source/Main.brs
+++ b/source/Main.brs
@@ -201,6 +201,13 @@ sub Main (args as dynamic) as void
m.spinner = screenContent.findNode("spinner")
m.spinner.visible = true
group = CreateAudioPlayerGroup(screenContent.albumData.items)
+ else if isNodeEvent(msg, "instantMixSelected")
+ ' User has selected instant mix
+ ' User has selected playlist of of audio they want us to play
+ screenContent = msg.getRoSGNode()
+ m.spinner = screenContent.findNode("spinner")
+ m.spinner.visible = true
+ group = CreateInstantMixGroup(screenContent.albumData.items)
else if isNodeEvent(msg, "episodeSelected")
' If you select a TV Episode from ANYWHERE, follow this flow
node = getMsgPicker(msg, "picker")
diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs
index 9f715552..8ef79a07 100644
--- a/source/ShowScenes.brs
+++ b/source/ShowScenes.brs
@@ -380,6 +380,7 @@ function CreateMusicArtistDetailsGroup(musicartist)
group.albumData = MusicSongList(musicartist.id)
group.observeField("playSong", m.port)
group.observeField("playAllSelected", m.port)
+ group.observeField("instantMixSelected", m.port)
else
' User has albums under artists
group = CreateObject("roSGNode", "MusicArtistDetails")
@@ -407,6 +408,9 @@ function CreateMusicAlbumDetailsGroup(album)
' Watch for user click on Play button on album
group.observeField("playAllSelected", m.port)
+ ' Watch for user click on Instant Mix button on album
+ group.observeField("instantMixSelected", m.port)
+
return group
end function
@@ -481,6 +485,30 @@ function CreateAudioPlayerGroup(audiodata)
return group
end function
+' Play Instant Mix
+function CreateInstantMixGroup(audiodata)
+
+ songList = CreateInstantMix(audiodata[0].id)
+
+ group = CreateObject("roSGNode", "NowPlaying")
+ group.observeField("state", m.port)
+ songIDArray = CreateObject("roArray", 0, true)
+
+ ' All we need is an array of Song IDs the user selected to play.
+ for each song in songList.items
+ songIDArray.push(song.id)
+ end for
+
+ songIDArray.shift()
+
+ group.pageContent = songIDArray
+ group.musicArtistAlbumData = songList.items
+
+ m.global.sceneManager.callFunc("pushScene", group)
+
+ return group
+end function
+
function CreatePersonView(personData as object) as object
person = CreateObject("roSGNode", "PersonDetails")
m.global.SceneManager.callFunc("pushScene", person)
diff --git a/source/api/Items.brs b/source/api/Items.brs
index 9359c335..2d0bd418 100644
--- a/source/api/Items.brs
+++ b/source/api/Items.brs
@@ -209,6 +209,17 @@ function AudioItem(id as string)
return getJson(resp)
end function
+' Get Instant Mix based on item
+function CreateInstantMix(id as string)
+ url = Substitute("/Items/{0}/InstantMix", id)
+ resp = APIRequest(url, {
+ "UserId": get_setting("active_user"),
+ "Limit": 201
+ })
+
+ return getJson(resp)
+end function
+
function AudioStream(id as string)
songData = AudioItem(id)
From 07d5d19bac40abe4cff9b36a7249e0d7cef9a654 Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Wed, 8 Jun 2022 10:28:18 -0400
Subject: [PATCH 4/9] Allow navigation when Play Album is hidden
---
components/music/MusicAlbumDetails.brs | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/components/music/MusicAlbumDetails.brs b/components/music/MusicAlbumDetails.brs
index e4784842..1c39b7e0 100644
--- a/components/music/MusicAlbumDetails.brs
+++ b/components/music/MusicAlbumDetails.brs
@@ -100,11 +100,6 @@ function onKeyEvent(key as string, press as boolean) as boolean
if m.spinner.visible then return false
- ' Play Album is hidden, so there are no navigation needs here
- if m.top.pageContent.json.ChildCount = 1
- return false
- end if
-
if key = "options"
if m.dscr.isTextEllipsized
createFullDscrDlg()
@@ -119,7 +114,13 @@ function onKeyEvent(key as string, press as boolean) as boolean
return true
end if
else if key = "left" and m.songList.hasFocus()
- m.playAlbum.setFocus(true)
+ if m.playAlbum.visible
+ m.playAlbum.setFocus(true)
+ else if m.instantMix.visible
+ m.instantMix.setFocus(true)
+ else
+ return false
+ end if
return true
else if key = "down" and m.playAlbum.hasFocus()
m.instantMix.setFocus(true)
From 863a5498760c910a181bf28e14e4f68bb2d82103 Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Thu, 9 Jun 2022 16:51:04 -0400
Subject: [PATCH 5/9] Add Random Play to TV Season
---
components/tvshows/TVEpisodeRow.brs | 12 +++++-------
components/tvshows/TVEpisodes.brs | 27 +++++++++++++++++++++++++++
components/tvshows/TVEpisodes.xml | 5 +++++
components/tvshows/TVListDetails.xml | 8 ++++----
source/api/Items.brs | 4 ++--
5 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/components/tvshows/TVEpisodeRow.brs b/components/tvshows/TVEpisodeRow.brs
index 480cd307..a87ad259 100644
--- a/components/tvshows/TVEpisodeRow.brs
+++ b/components/tvshows/TVEpisodeRow.brs
@@ -12,18 +12,16 @@ sub init()
end sub
sub updateSize()
- dimensions = m.top.getScene().currentDesignResolution
+ m.top.translation = [450, 180]
- border = 96
- m.top.translation = [border, 75 + 115]
-
- itemWidth = (dimensions["width"] - border * 2)
- itemHeight = 400
+ itemWidth = 1360
+ itemHeight = 250
m.top.visible = true
' Size of the individual rows
- m.top.itemSize = [dimensions["width"] - border * 2, itemHeight]
+ m.top.itemSize = [itemWidth, itemHeight]
+
' Spacing between Rows
m.top.itemSpacing = [0, 40]
diff --git a/components/tvshows/TVEpisodes.brs b/components/tvshows/TVEpisodes.brs
index 72f6e95f..e2e750f3 100644
--- a/components/tvshows/TVEpisodes.brs
+++ b/components/tvshows/TVEpisodes.brs
@@ -2,6 +2,11 @@ sub init()
m.top.optionsAvailable = false
m.rows = m.top.findNode("picker")
+ m.poster = m.top.findNode("seasonPoster")
+ m.Random = m.top.findNode("Random")
+ m.tvEpisodeRow = m.top.findNode("tvEpisodeRow")
+
+
m.rows.observeField("doneLoading", "updateSeason")
end sub
@@ -10,12 +15,34 @@ sub setSeasonLoading()
end sub
sub updateSeason()
+ imgParams = { "maxHeight": 450, "maxWidth": 300 }
+ m.poster.uri = ImageURL(m.top.seasonData.Id, "Primary", imgParams)
m.top.overhangTitle = m.top.seasonData.SeriesName + " - " + m.top.seasonData.name
end sub
function onKeyEvent(key as string, press as boolean) as boolean
handled = false
+ if key = "left" and not m.Random.hasFocus()
+ m.Random.setFocus(true)
+ return true
+ end if
+
+ if key = "right" and not m.tvEpisodeRow.hasFocus()
+ m.tvEpisodeRow.setFocus(true)
+ return true
+ end if
+
+
+ if key = "OK" or key = "play"
+ if m.Random.hasFocus()
+ randomEpisode = Rnd(m.rows.getChild(0).objects.items.count()) - 1
+ m.top.quickPlayNode = m.rows.getChild(0).objects.items[randomEpisode]
+ return true
+ end if
+ end if
+
+
focusedChild = m.top.focusedChild.focusedChild
if focusedChild.content = invalid then return handled
diff --git a/components/tvshows/TVEpisodes.xml b/components/tvshows/TVEpisodes.xml
index 1d95ddc3..fd8c9fc3 100644
--- a/components/tvshows/TVEpisodes.xml
+++ b/components/tvshows/TVEpisodes.xml
@@ -1,6 +1,8 @@
+
+
@@ -10,4 +12,7 @@
+
+
+
diff --git a/components/tvshows/TVListDetails.xml b/components/tvshows/TVListDetails.xml
index efd686c9..e50d97e7 100644
--- a/components/tvshows/TVListDetails.xml
+++ b/components/tvshows/TVListDetails.xml
@@ -3,11 +3,11 @@
-
+
-
+
@@ -16,8 +16,8 @@
-
-
+
+
diff --git a/source/api/Items.brs b/source/api/Items.brs
index 9359c335..6c7b7d6b 100644
--- a/source/api/Items.brs
+++ b/source/api/Items.brs
@@ -264,7 +264,7 @@ function TVEpisodes(show_id as string, season_id as string)
data = getJson(resp)
results = []
for each item in data.Items
- imgParams = { "AddPlayedIndicator": item.UserData.Played, "maxWidth": 712, "maxheight": 400 }
+ imgParams = { "AddPlayedIndicator": item.UserData.Played, "maxWidth": 400, "maxheight": 250 }
if item.UserData.PlayedPercentage <> invalid
param = { "PercentPlayed": item.UserData.PlayedPercentage }
imgParams.Append(param)
@@ -272,7 +272,7 @@ function TVEpisodes(show_id as string, season_id as string)
tmp = CreateObject("roSGNode", "TVEpisodeData")
tmp.image = PosterImage(item.id, imgParams)
if tmp.image <> invalid
- tmp.image.posterDisplayMode = "scaleToFit"
+ tmp.image.posterDisplayMode = "scaleToZoom"
end if
tmp.json = item
tmp.overview = ItemMetaData(item.id).overview
From b697d26a06e814ed7de62f319c1e2d74f6726057 Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Sat, 11 Jun 2022 09:42:43 -0400
Subject: [PATCH 6/9] Remove unused fallbacktype code
---
components/ItemGrid/LoadItemsTask2.brs | 11 -----------
components/ItemGrid/LoadItemsTask2.xml | 1 -
2 files changed, 12 deletions(-)
diff --git a/components/ItemGrid/LoadItemsTask2.brs b/components/ItemGrid/LoadItemsTask2.brs
index a0dd279e..f91802ca 100644
--- a/components/ItemGrid/LoadItemsTask2.brs
+++ b/components/ItemGrid/LoadItemsTask2.brs
@@ -59,17 +59,6 @@ sub loadItems()
if data.TotalRecordCount <> invalid then m.top.totalRecordCount = data.TotalRecordCount
- ' When loading a collection, if no results are found, try searching by fallback type
- if data.TotalRecordCount = 0
- if m.top.FallbackType <> ""
- ' Ensure we didn't just search by the fallback type - prevent infinite loop
- if m.top.ItemType <> m.top.FallbackType
- m.top.ItemType = m.top.FallbackType
- loadItems()
- end if
- end if
- end if
-
for each item in data.Items
tmp = invalid
if item.Type = "Movie"
diff --git a/components/ItemGrid/LoadItemsTask2.xml b/components/ItemGrid/LoadItemsTask2.xml
index e955e54c..91780ea1 100644
--- a/components/ItemGrid/LoadItemsTask2.xml
+++ b/components/ItemGrid/LoadItemsTask2.xml
@@ -5,7 +5,6 @@
-
From 20b5efd6d6138ef51a1c448fd31ea677dc1dd9fe Mon Sep 17 00:00:00 2001
From: 1hitsong <3330318+1hitsong@users.noreply.github.com>
Date: Sat, 11 Jun 2022 10:04:53 -0400
Subject: [PATCH 7/9] Add codec info back to tv episode rows
---
components/tvshows/TVEpisodeRow.brs | 2 +-
components/tvshows/TVListDetails.xml | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/components/tvshows/TVEpisodeRow.brs b/components/tvshows/TVEpisodeRow.brs
index a87ad259..5782723f 100644
--- a/components/tvshows/TVEpisodeRow.brs
+++ b/components/tvshows/TVEpisodeRow.brs
@@ -15,7 +15,7 @@ sub updateSize()
m.top.translation = [450, 180]
itemWidth = 1360
- itemHeight = 250
+ itemHeight = 300
m.top.visible = true
diff --git a/components/tvshows/TVListDetails.xml b/components/tvshows/TVListDetails.xml
index e50d97e7..5e231804 100644
--- a/components/tvshows/TVListDetails.xml
+++ b/components/tvshows/TVListDetails.xml
@@ -3,7 +3,7 @@
-
+
@@ -16,10 +16,10 @@
-
-
-
-
+
+
+
+
From c1fed4ce37b07c923a50c15a3ed00448d599ebc4 Mon Sep 17 00:00:00 2001
From: Jimi
Date: Sat, 11 Jun 2022 16:55:31 -0600
Subject: [PATCH 8/9] Update components/tvshows/TVEpisodes.xml
---
components/tvshows/TVEpisodes.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/tvshows/TVEpisodes.xml b/components/tvshows/TVEpisodes.xml
index fd8c9fc3..f1522694 100644
--- a/components/tvshows/TVEpisodes.xml
+++ b/components/tvshows/TVEpisodes.xml
@@ -2,7 +2,7 @@
-
+
From 69da853ffd81f06ce5f4d3a019b7b5bfac00bc72 Mon Sep 17 00:00:00 2001
From: Jimi
Date: Sat, 11 Jun 2022 16:55:36 -0600
Subject: [PATCH 9/9] Update components/tvshows/TVEpisodes.brs
---
components/tvshows/TVEpisodes.brs | 1 +
1 file changed, 1 insertion(+)
diff --git a/components/tvshows/TVEpisodes.brs b/components/tvshows/TVEpisodes.brs
index e2e750f3..915aeb97 100644
--- a/components/tvshows/TVEpisodes.brs
+++ b/components/tvshows/TVEpisodes.brs
@@ -17,6 +17,7 @@ end sub
sub updateSeason()
imgParams = { "maxHeight": 450, "maxWidth": 300 }
m.poster.uri = ImageURL(m.top.seasonData.Id, "Primary", imgParams)
+ m.Random.visible = true
m.top.overhangTitle = m.top.seasonData.SeriesName + " - " + m.top.seasonData.name
end sub