[Android] Save media title sooner for external medias

Nicolas Pomepuy git at videolan.org
Thu Apr 1 13:23:02 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Apr  1 14:54:55 2021 +0200| [c56203addd87489df11dc761806cd657d2890467] | committer: Nicolas Pomepuy

Save media title sooner for external medias

Fixes #1434

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

 application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index f4b16da56..355601cd4 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -450,7 +450,6 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
             val media = medialibrary.findMedia(currentMedia) ?: return at launch
             if (media.id == 0L) return at launch
             if (titleIdx > 0) media.setLongMeta(MediaWrapper.META_TITLE, titleIdx.toLong())
-            if (media.title != currentMedia.title) media.rename(currentMedia.title)
             if (media.type == MediaWrapper.TYPE_VIDEO || canSwitchToVideo || media.isPodcast) {
                 var progress = time / length.toFloat()
                 if (progress > 0.95f || length - time < 10000) {
@@ -888,6 +887,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                             entryUrl = null
                         }
                     } else medialibrary.addMedia(mw.uri.toString(), mw.length)
+                    getCurrentMedia()?.let {currentMedia -> if (internalMedia.title != currentMedia.title) internalMedia.rename(currentMedia.title) }
                     if (internalMedia != null) id = internalMedia.id
                 }
             }



More information about the Android mailing list