* try simplification by separator (for name - title naming style)

This commit is contained in:
Reinhard Pointner 2014-07-21 03:47:55 +00:00
parent 1d19965e72
commit 0415ceb37a
2 changed files with 20 additions and 0 deletions

View File

@ -394,6 +394,15 @@ public class MediaDetection {
for (File path : listPathTail(f, 2, true)) {
String sn = seriesNameMatcher.matchByEpisodeIdentifier(getName(path));
if (sn != null && sn.length() > 0) {
// try simplification by separator (for name - title naming style)
if (!strict) {
String snbs = seriesNameMatcher.matchBySeparator(getName(path));
if (snbs != null && snbs.length() > 0) {
if (snbs.length() < sn.length()) {
sn = snbs;
}
}
}
matches.add(sn);
break;
}

View File

@ -204,6 +204,17 @@ public class SeriesNameMatcher {
return null;
}
public String matchBySeparator(String name) {
Pattern separator = Pattern.compile("[\\s]+[-]+[\\s]+");
Matcher matcher = separator.matcher(name);
if (matcher.find() && matcher.start() > 0) {
return normalizePunctuation(name.substring(0, matcher.start()));
}
return null;
}
/**
* Try to match a series name from the first common word sequence.
*