[Android] src: Exclude .nomedia folders from library

Edward Wang git at videolan.org
Sat Jul 7 14:36:11 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Jul  7 08:35:32 2012 -0400| [7712cab81382a1a79fedc1054e8268884971c1ec] | committer: Edward Wang

src: Exclude .nomedia folders from library

Close #7053

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=7712cab81382a1a79fedc1054e8268884971c1ec
---

 vlc-android/src/org/videolan/vlc/MediaLibrary.java |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index d4dcec1..d19dfea 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -216,6 +216,15 @@ public class MediaLibrary {
             while (!directories.isEmpty()) {
                 File dir = directories.pop();
                 File[] f = null;
+                /* .nomedia tells media players on Android to skip the
+                 * folder in the media library because they don't contain
+                 * useful music, such as notification sounds,
+                 * navigation voice phrases etc.
+                 */
+                if(new File(dir.getAbsolutePath() + "/.nomedia").exists()) {
+                    continue;
+                }
+
                 if ((f = dir.listFiles(mediaFileFilter)) != null) {
                     for (int i = 0; i < f.length; i++) {
                         File file = f[i];



More information about the Android mailing list