[Android] Fix default artist not retrieved for remote access albums

Nicolas Pomepuy git at videolan.org
Mon Mar 18 14:37:34 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Mar 14 08:00:05 2024 +0100| [a760a34525bc67ae1bd68005e68b31c5d21b750c] | committer: Duncan McNamara

Fix default artist not retrieved for remote access albums

> https://code.videolan.org/videolan/vlc-android/commit/a760a34525bc67ae1bd68005e68b31c5d21b750c
---

 .../src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
index a57da8474a..f125e1d970 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
@@ -511,7 +511,7 @@ fun Route.setupRouting(appContext: Context, scope: CoroutineScope) {
 
             val list = ArrayList<RemoteAccessServer.PlayQueueItem>()
             album.tracks.forEach { track ->
-                list.add(track.toPlayQueueItem())
+                list.add(track.toPlayQueueItem(album.albumArtist))
             }
             val result= RemoteAccessServer.AlbumResult(list, album.title)
             val gson = Gson()
@@ -1235,8 +1235,7 @@ fun Genre.toPlayQueueItem(appContext: Context) = RemoteAccessServer.PlayQueueIte
 fun Playlist.toPlayQueueItem(appContext: Context) = RemoteAccessServer.PlayQueueItem(id, title, appContext.resources.getQuantityString(R.plurals.track_quantity, tracksCount, tracksCount), 0, artworkMrl
         ?: "", false, "")
 
-fun MediaWrapper.toPlayQueueItem() = RemoteAccessServer.PlayQueueItem(id, title, artist
-        ?: "", length, artworkMrl
+fun MediaWrapper.toPlayQueueItem(defaultArtist: String = "") = RemoteAccessServer.PlayQueueItem(id, title, artist?.ifEmpty { defaultArtist } ?: defaultArtist, length, artworkMrl
         ?: "", false, generateResolutionClass(width, height) ?: "", progress = time, played = seen > 0)
 
 fun Folder.toPlayQueueItem(context: Context) = RemoteAccessServer.PlayQueueItem(id, title, context.resources.getQuantityString(org.videolan.vlc.R.plurals.videos_quantity, mediaCount(Folder.TYPE_FOLDER_VIDEO), mediaCount(Folder.TYPE_FOLDER_VIDEO))



More information about the Android mailing list