From 7385a8d307f2eaf77222ac2f5272165b9cba63d8 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 17 Jul 2014 07:50:30 +0000 Subject: [PATCH] * helper method that could be useful in scripts and otherwise --- source/net/filebot/media/MediaDetection.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index b00c45a7..de45e348 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -1371,6 +1371,21 @@ public class MediaDetection { } }; + public static List getMediaUnits(File folder) { + if (folder.isHidden()) { + return emptyList(); + } + + if (folder.isDirectory() && !isDiskFolder(folder)) { + List children = new ArrayList(); + for (File f : getChildren(folder)) { + children.addAll(getMediaUnits(f)); + } + } + + return singletonList(folder); + } + public static Object readMetaInfo(File file) { if (useExtendedFileAttributes()) { try {