* try simplification by separator (for name - title naming style)
This commit is contained in:
parent
1d19965e72
commit
0415ceb37a
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue