mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 16:58:51 -05:00
* combine stripReleaseInfo & checkMovie to redeem false negative matches that would otherwise be ignored
This commit is contained in:
parent
16eca618f5
commit
8f1b21a02b
@ -501,7 +501,7 @@ public class MediaDetection {
|
|||||||
File f = movieFile;
|
File f = movieFile;
|
||||||
|
|
||||||
// check for double nested structures
|
// check for double nested structures
|
||||||
if (matchMovieFile(f.getParentFile()) != null && matchMovieFile(f) == null) {
|
if (checkMovie(f.getParentFile()) != null && checkMovie(f) == null) {
|
||||||
return f.getParentFile();
|
return f.getParentFile();
|
||||||
} else {
|
} else {
|
||||||
return f;
|
return f;
|
||||||
@ -514,7 +514,7 @@ public class MediaDetection {
|
|||||||
String term = stripReleaseInfo(f.getName());
|
String term = stripReleaseInfo(f.getName());
|
||||||
if (term.length() > 0) {
|
if (term.length() > 0) {
|
||||||
// check for double nested structures
|
// check for double nested structures
|
||||||
if (matchMovieFile(f.getParentFile()) != null && matchMovieFile(f) == null) {
|
if (checkMovie(f.getParentFile()) != null && checkMovie(f) == null) {
|
||||||
return f.getParentFile();
|
return f.getParentFile();
|
||||||
} else {
|
} else {
|
||||||
return f;
|
return f;
|
||||||
@ -526,7 +526,7 @@ public class MediaDetection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Movie matchMovieFile(File file) throws Exception {
|
public static Movie checkMovie(File file) throws Exception {
|
||||||
List<Movie> matches = file != null ? matchMovieName(singleton(file.getName()), false, 0) : null;
|
List<Movie> matches = file != null ? matchMovieName(singleton(file.getName()), false, 0) : null;
|
||||||
return matches != null && matches.size() > 0 ? matches.get(0) : null;
|
return matches != null && matches.size() > 0 ? matches.get(0) : null;
|
||||||
}
|
}
|
||||||
|
@ -289,13 +289,28 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected String checkedStripReleaseInfo(File file) throws Exception {
|
||||||
|
String name = stripReleaseInfo(getName(file));
|
||||||
|
|
||||||
|
// try to redeem possible false negative matches
|
||||||
|
if (name.length() < 2) {
|
||||||
|
Movie match = checkMovie(file);
|
||||||
|
if (match != null) {
|
||||||
|
return match.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Movie selectMovie(final File movieFile, final Collection<Movie> options, final Map<String, Object> memory, final Component parent) throws Exception {
|
protected Movie selectMovie(final File movieFile, final Collection<Movie> options, final Map<String, Object> memory, final Component parent) throws Exception {
|
||||||
// 1. movie by filename
|
// 1. movie by filename
|
||||||
final String fileQuery = stripReleaseInfo(getName(movieFile));
|
final String fileQuery = checkedStripReleaseInfo(movieFile);
|
||||||
|
|
||||||
// 2. movie by directory
|
// 2. movie by directory
|
||||||
final File movieFolder = guessMovieFolder(movieFile);
|
final File movieFolder = guessMovieFolder(movieFile);
|
||||||
final String folderQuery = (movieFolder == null) ? "" : stripReleaseInfo(movieFolder.getName());
|
final String folderQuery = (movieFolder == null) ? "" : checkedStripReleaseInfo(movieFolder);
|
||||||
|
|
||||||
// auto-ignore invalid files
|
// auto-ignore invalid files
|
||||||
if (fileQuery.length() < 2 && folderQuery.length() < 2) {
|
if (fileQuery.length() < 2 && folderQuery.length() < 2) {
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
^other$
|
^other$
|
||||||
^Romance$
|
^Romance$
|
||||||
^Science.Fiction$
|
^Science.Fiction$
|
||||||
|
^Scratch$
|
||||||
^Season.[0-9]+
|
^Season.[0-9]+
|
||||||
^Seeding$
|
^Seeding$
|
||||||
^Seeds$
|
^Seeds$
|
||||||
|
Loading…
Reference in New Issue
Block a user