* special handling for disk folders

This commit is contained in:
Reinhard Pointner 2012-07-28 10:57:50 +00:00
parent 07f44e13c9
commit d9d8e5ab75
1 changed files with 26 additions and 7 deletions

View File

@ -42,6 +42,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.sourceforge.filebot.Analytics; import net.sourceforge.filebot.Analytics;
@ -337,14 +338,31 @@ public class CmdlineOperations implements CmdlineInterface {
for (File dir : mapByFolder(movieFiles).keySet()) { for (File dir : mapByFolder(movieFiles).keySet()) {
addAll(effectiveNfoFileSet, dir.listFiles(NFO_FILES)); addAll(effectiveNfoFileSet, dir.listFiles(NFO_FILES));
} }
for (File dir : filter(fileset, FOLDERS)) {
addAll(effectiveNfoFileSet, dir.listFiles(NFO_FILES));
}
for (File nfo : effectiveNfoFileSet) { for (File nfo : effectiveNfoFileSet) {
try { try {
Movie movie = grepMovie(nfo, service, locale); Movie movie = grepMovie(nfo, service, locale);
// ignore illegal nfos
if (movie == null) {
continue;
}
if (nfoFiles.contains(nfo)) { if (nfoFiles.contains(nfo)) {
movieByFile.put(nfo, movie); movieByFile.put(nfo, movie);
} }
if (isDiskFolder(nfo.getParentFile())) {
// special handling for disk folders
for (File folder : fileset) {
if (nfo.getParentFile().equals(folder)) {
movieByFile.put(folder, movie);
}
}
} else {
// match movie info to movie files that match the nfo file name // match movie info to movie files that match the nfo file name
SortedSet<File> siblingMovieFiles = new TreeSet<File>(filter(movieFiles, new ParentFilter(nfo.getParentFile()))); SortedSet<File> siblingMovieFiles = new TreeSet<File>(filter(movieFiles, new ParentFilter(nfo.getParentFile())));
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase(); String baseName = stripReleaseInfo(getName(nfo)).toLowerCase();
@ -354,6 +372,7 @@ public class CmdlineOperations implements CmdlineInterface {
movieByFile.put(movieFile, movie); movieByFile.put(movieFile, movie);
} }
} }
}
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
CLILogger.warning("Failed to grep IMDbID: " + nfo.getName()); CLILogger.warning("Failed to grep IMDbID: " + nfo.getName());
} }