diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index bb8c5d3c..ae80782b 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -566,12 +566,19 @@ public class MediaDetection { public static Set grepImdbIdFor(File file) throws Exception { Set collection = new LinkedHashSet(); - if (file.exists()) { - for (File nfo : file.getParentFile().listFiles(NFO_FILES)) { - String text = new String(readFile(nfo), "UTF-8"); - collection.addAll(grepImdbId(text)); - } + List nfoFiles = new ArrayList(); + if (file.isDirectory()) { + nfoFiles.addAll(listFiles(singleton(file), 10, false)); + } else { + addAll(nfoFiles, file.getParentFile().listFiles(NFO_FILES)); } + + // parse ids from nfo files + for (File nfo : nfoFiles) { + String text = new String(readFile(nfo), "UTF-8"); + collection.addAll(grepImdbId(text)); + } + return collection; }