Commit 3d7c425d authored by Geoffrey Métais's avatar Geoffrey Métais Committed by Nicolas Pomepuy
Browse files

Fix same name directories having the same thumb

Fix #925
parent a3483a72
Pipeline #16268 passed with stage
in 3 minutes and 35 seconds
......@@ -25,6 +25,7 @@ import androidx.leanback.widget.ImageCardView
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import kotlinx.coroutines.*
import org.videolan.medialibrary.interfaces.Medialibrary
import org.videolan.medialibrary.interfaces.media.Folder
import org.videolan.medialibrary.interfaces.media.MediaWrapper
import org.videolan.medialibrary.media.MediaLibraryItem
import org.videolan.resources.AppContextProvider
......@@ -33,6 +34,7 @@ import org.videolan.resources.HEADER_TV_SHOW
import org.videolan.tools.BitmapCache
import org.videolan.tools.HttpImageLoader
import org.videolan.tools.Settings
import org.videolan.tools.sanitizePath
import org.videolan.vlc.BR
import org.videolan.vlc.R
import org.videolan.vlc.util.ThumbnailsProvider
......@@ -72,7 +74,7 @@ fun loadImage(v: View, item: MediaLibraryItem?, imageWidth: Int = 0, tv: Boolean
val isFolder = !isMedia && item.itemType == MediaLibraryItem.TYPE_FOLDER
val cacheKey = when {
isGroup -> "videogroup:${item.title}"
isFolder -> "folder:${item.title}"
isFolder -> "folder:${(item as Folder).mMrl.sanitizePath()}"
else -> ThumbnailsProvider.getMediaCacheKey(isMedia, item, imageWidth.toString())
}
val bitmap = if (cacheKey !== null) BitmapCache.getBitmapFromMemCache(cacheKey) else null
......
......@@ -22,6 +22,7 @@ import org.videolan.medialibrary.media.MediaLibraryItem
import org.videolan.resources.AppContextProvider
import org.videolan.tools.BitmapCache
import org.videolan.tools.CloseableUtils
import org.videolan.tools.sanitizePath
import org.videolan.vlc.gui.helpers.AudioUtil.readCoverBitmap
import org.videolan.vlc.gui.helpers.BitmapUtil
import org.videolan.vlc.gui.helpers.UiTools
......@@ -45,7 +46,7 @@ object ThumbnailsProvider {
@WorkerThread
fun getFolderThumbnail(folder: Folder, width: Int): Bitmap? {
val media = folder.media(Folder.TYPE_FOLDER_VIDEO, Medialibrary.SORT_DEFAULT, true, 4, 0).filterNotNull()
return getComposedImage("folder:${folder.title}", media, width)
return getComposedImage("folder:${folder.mMrl.sanitizePath()}", media, width)
}
@WorkerThread
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment