diff --git a/source/net/sourceforge/filebot/MediaTypes.java b/source/net/sourceforge/filebot/MediaTypes.java index 743b6e21..0b2e7974 100644 --- a/source/net/sourceforge/filebot/MediaTypes.java +++ b/source/net/sourceforge/filebot/MediaTypes.java @@ -13,11 +13,11 @@ import java.util.Map.Entry; import javax.xml.parsers.DocumentBuilderFactory; +import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter; + import org.w3c.dom.Document; import org.w3c.dom.Node; -import net.sourceforge.tuned.FileUtilities.ExtensionFileFilter; - public class MediaTypes { @@ -44,7 +44,6 @@ public class MediaTypes { } } - private Map> types; private Map filters = synchronizedMap(new HashMap()); @@ -88,9 +87,9 @@ public class MediaTypes { return defaultInstance.getFilter(name); } - // some convenience filters public static final ExtensionFileFilter AUDIO_FILES = getDefaultFilter("audio"); public static final ExtensionFileFilter VIDEO_FILES = getDefaultFilter("video"); public static final ExtensionFileFilter SUBTITLE_FILES = getDefaultFilter("subtitle"); + public static final ExtensionFileFilter NFO_FILES = getDefaultFilter("application/nfo"); } diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index 225c557e..bb8c5d3c 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -4,6 +4,7 @@ package net.sourceforge.filebot.media; import static java.util.Collections.*; import static java.util.regex.Pattern.*; +import static net.sourceforge.filebot.MediaTypes.*; import static net.sourceforge.filebot.similarity.CommonSequenceMatcher.*; import static net.sourceforge.filebot.similarity.Normalization.*; import static net.sourceforge.tuned.FileUtilities.*; @@ -36,7 +37,6 @@ import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.sourceforge.filebot.MediaTypes; import net.sourceforge.filebot.WebServices; import net.sourceforge.filebot.similarity.CommonSequenceMatcher; import net.sourceforge.filebot.similarity.DateMatcher; @@ -567,7 +567,7 @@ public class MediaDetection { public static Set grepImdbIdFor(File file) throws Exception { Set collection = new LinkedHashSet(); if (file.exists()) { - for (File nfo : file.getParentFile().listFiles(MediaTypes.getDefaultFilter("application/nfo"))) { + for (File nfo : file.getParentFile().listFiles(NFO_FILES)) { String text = new String(readFile(nfo), "UTF-8"); collection.addAll(grepImdbId(text)); } @@ -584,7 +584,7 @@ public class MediaDetection { if (!folder.exists()) continue; - for (File nfo : folder.listFiles(MediaTypes.getDefaultFilter("application/nfo"))) { + for (File nfo : folder.listFiles(NFO_FILES)) { String text = new String(readFile(nfo), "UTF-8"); for (int imdbid : grepImdbId(text)) { diff --git a/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java b/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java index f0836725..1f934885 100644 --- a/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java +++ b/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java @@ -45,7 +45,6 @@ import javax.swing.JComponent; import javax.swing.SwingUtilities; import net.sourceforge.filebot.Analytics; -import net.sourceforge.filebot.MediaTypes; import net.sourceforge.filebot.ResourceManager; import net.sourceforge.filebot.similarity.Match; import net.sourceforge.filebot.similarity.NameSimilarityMetric; @@ -75,7 +74,7 @@ class MovieHashMatcher implements AutoCompleteMatcher { // handle movie files Set movieFiles = new TreeSet(filter(fileset, VIDEO_FILES)); - Set nfoFiles = new TreeSet(filter(fileset, MediaTypes.getDefaultFilter("application/nfo"))); + Set nfoFiles = new TreeSet(filter(fileset, NFO_FILES)); List orphanedFiles = new ArrayList(filter(fileset, FILES)); orphanedFiles.removeAll(movieFiles); @@ -112,7 +111,7 @@ class MovieHashMatcher implements AutoCompleteMatcher { // collect useful nfo files even if they are not part of the selected fileset Set effectiveNfoFileSet = new TreeSet(nfoFiles); for (File dir : mapByFolder(movieFiles).keySet()) { - addAll(effectiveNfoFileSet, dir.listFiles(MediaTypes.getDefaultFilter("application/nfo"))); + addAll(effectiveNfoFileSet, dir.listFiles(NFO_FILES)); } for (File nfo : effectiveNfoFileSet) { try {