* support parsing .nfo from video folders

This commit is contained in:
Reinhard Pointner 2012-07-26 03:52:11 +00:00
parent 9ac886f214
commit 165c66a319
1 changed files with 12 additions and 5 deletions

View File

@ -566,12 +566,19 @@ public class MediaDetection {
public static Set<Integer> grepImdbIdFor(File file) throws Exception { public static Set<Integer> grepImdbIdFor(File file) throws Exception {
Set<Integer> collection = new LinkedHashSet<Integer>(); Set<Integer> collection = new LinkedHashSet<Integer>();
if (file.exists()) { List<File> nfoFiles = new ArrayList<File>();
for (File nfo : file.getParentFile().listFiles(NFO_FILES)) { if (file.isDirectory()) {
String text = new String(readFile(nfo), "UTF-8"); nfoFiles.addAll(listFiles(singleton(file), 10, false));
collection.addAll(grepImdbId(text)); } 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; return collection;
} }