From 165c66a31958d7b5838d52ea4ee909f600e27737 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 26 Jul 2012 03:52:11 +0000 Subject: [PATCH] * support parsing .nfo from video folders --- .../filebot/media/MediaDetection.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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; }