* 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;
|
||||
|
||||
// check for double nested structures
|
||||
if (matchMovieFile(f.getParentFile()) != null && matchMovieFile(f) == null) {
|
||||
if (checkMovie(f.getParentFile()) != null && checkMovie(f) == null) {
|
||||
return f.getParentFile();
|
||||
} else {
|
||||
return f;
|
||||
|
@ -514,7 +514,7 @@ public class MediaDetection {
|
|||
String term = stripReleaseInfo(f.getName());
|
||||
if (term.length() > 0) {
|
||||
// check for double nested structures
|
||||
if (matchMovieFile(f.getParentFile()) != null && matchMovieFile(f) == null) {
|
||||
if (checkMovie(f.getParentFile()) != null && checkMovie(f) == null) {
|
||||
return f.getParentFile();
|
||||
} else {
|
||||
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;
|
||||
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 {
|
||||
// 1. movie by filename
|
||||
final String fileQuery = stripReleaseInfo(getName(movieFile));
|
||||
final String fileQuery = checkedStripReleaseInfo(movieFile);
|
||||
|
||||
// 2. movie by directory
|
||||
final File movieFolder = guessMovieFolder(movieFile);
|
||||
final String folderQuery = (movieFolder == null) ? "" : stripReleaseInfo(movieFolder.getName());
|
||||
final String folderQuery = (movieFolder == null) ? "" : checkedStripReleaseInfo(movieFolder);
|
||||
|
||||
// auto-ignore invalid files
|
||||
if (fileQuery.length() < 2 && folderQuery.length() < 2) {
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
^other$
|
||||
^Romance$
|
||||
^Science.Fiction$
|
||||
^Scratch$
|
||||
^Season.[0-9]+
|
||||
^Seeding$
|
||||
^Seeds$
|
||||
|
|
Loading…
Reference in New Issue