[Android] Create isSD / isOTG extensions on the video folders

Nicolas Pomepuy git at videolan.org
Wed Nov 27 10:40:57 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 27 09:23:58 2024 +0100| [cb1eac603204c1a1af815770a668862556ebd28f] | committer: Duncan McNamara

Create isSD / isOTG extensions on the video folders

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

 .../vlc-android/src/org/videolan/vlc/media/MediaUtils.kt  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
index 099d726998..8e6c94a1cd 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/MediaUtils.kt
@@ -503,6 +503,21 @@ object MediaUtils {
     }
 }
 
+fun Folder.isOTG(): Boolean {
+    try {
+        return Uri.parse(mMrl).isOTG()
+    } catch (_: Exception) {
+    }
+    return false
+}
+fun Folder.isSD(): Boolean {
+    try {
+        return Uri.parse(mMrl).isSD()
+    } catch (_: Exception) {
+    }
+    return false
+}
+
 @WorkerThread
 fun Folder.getAll(type: Int = Folder.TYPE_FOLDER_VIDEO, sort: Int = Medialibrary.SORT_DEFAULT, desc: Boolean = false, includeMissing:Boolean = true, onlyFavorites:Boolean = false): List<MediaWrapper> {
     var index = 0



More information about the Android mailing list