* 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,21 +338,39 @@ 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);
} }
// match movie info to movie files that match the nfo file name if (isDiskFolder(nfo.getParentFile())) {
SortedSet<File> siblingMovieFiles = new TreeSet<File>(filter(movieFiles, new ParentFilter(nfo.getParentFile()))); // special handling for disk folders
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase(); for (File folder : fileset) {
if (nfo.getParentFile().equals(folder)) {
for (File movieFile : siblingMovieFiles) { movieByFile.put(folder, movie);
if (stripReleaseInfo(getName(movieFile)).toLowerCase().startsWith(baseName)) { }
movieByFile.put(movieFile, movie); }
} else {
// match movie info to movie files that match the nfo file name
SortedSet<File> siblingMovieFiles = new TreeSet<File>(filter(movieFiles, new ParentFilter(nfo.getParentFile())));
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase();
for (File movieFile : siblingMovieFiles) {
if (stripReleaseInfo(getName(movieFile)).toLowerCase().startsWith(baseName)) {
movieByFile.put(movieFile, movie);
}
} }
} }
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {