[Android] Save the stream title when adding to a playlist

Nicolas Pomepuy git at videolan.org
Mon May 13 11:54:36 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon May 13 09:39:27 2024 +0200| [6967753e150da5f726f93eb336d0f4c8fa580e53] | committer: Duncan McNamara

Save the stream title when adding to a playlist

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

 .../src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
index 562b26a8e2..d68ba05e35 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
@@ -56,6 +56,7 @@ import org.videolan.vlc.gui.dialogs.DuplicationWarningDialog.Companion.REQUEST_K
 import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.gui.helpers.UiTools.showPinIfNeeded
 import org.videolan.vlc.providers.FileBrowserProvider
+import org.videolan.vlc.util.isSchemeStreaming
 import org.videolan.vlc.viewmodels.browser.TYPE_FILE
 import org.videolan.vlc.viewmodels.browser.getBrowserModel
 import java.util.*
@@ -260,10 +261,14 @@ class SavePlaylistDialog : VLCBottomSheetDialogFragment(), View.OnClickListener,
                 val id = mw.id
                 if (id == 0L) {
                     var media = medialibrary.getMedia(mw.uri)
-                    if (media != null)
+                    if (media != null) {
                         ids.add(media.id)
-                    else {
-                        media = medialibrary.addMedia(mw.location, -1L)
+                        media.title = mw.title
+                    } else {
+                        media = if (isSchemeStreaming(mw.location))
+                            medialibrary.addStream(mw.location, mw.title)
+                        else
+                            medialibrary.addMedia(mw.location, -1L)
                         if (media != null) ids.add(media.id)
                     }
                 } else



More information about the Android mailing list