From be4056eedcfdbe6e7aaa081eb2028f4e4518f577 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sun, 11 Apr 2021 11:57:41 +0000
Subject: [PATCH] Dateifilter fuer Kataloge

---
 src/de/uhilger/mediaz/api/ListFileHandler.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/de/uhilger/mediaz/api/ListFileHandler.java b/src/de/uhilger/mediaz/api/ListFileHandler.java
index 864e45b..0b780aa 100644
--- a/src/de/uhilger/mediaz/api/ListFileHandler.java
+++ b/src/de/uhilger/mediaz/api/ListFileHandler.java
@@ -28,6 +28,7 @@
 import de.uhilger.mediaz.store.StorageFile;
 import de.uhilger.mediaz.store.Track;
 import java.io.File;
+import java.io.FileFilter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
@@ -35,6 +36,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -81,7 +83,16 @@
       logger.fine(fName);
       File dir = new File(fileBase, fName);
       logger.fine(dir.getAbsolutePath());
-      File[] files = dir.listFiles();
+      File[] files = dir.listFiles(new FileFilter() {
+        @Override
+        public boolean accept(File pathname) {
+          Set keys = extMap.keySet();
+          String fname = pathname.getName();
+          int pos = fname.lastIndexOf(".");
+          String ext = fname.substring(pos+1);          
+          return keys.contains(ext) || pathname.isDirectory();
+        }
+      });
       Arrays.sort(files);      
       ArrayList list = new ArrayList();
       if(files != null) {

--
Gitblit v1.9.3