* balance out misleading numbers in the series name
This commit is contained in:
parent
5b11e05619
commit
e7d67b3ed7
|
@ -324,13 +324,36 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
||||||
|
|
||||||
NumericSequence(new SequenceMatchSimilarity() {
|
NumericSequence(new SequenceMatchSimilarity() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSimilarity(Object o1, Object o2) {
|
||||||
|
float lowerBound = super.getSimilarity(normalize(o1, true), normalize(o2, true));
|
||||||
|
float upperBound = super.getSimilarity(normalize(o1, false), normalize(o2, false));
|
||||||
|
|
||||||
|
return max(lowerBound, upperBound);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String normalize(Object object) {
|
protected String normalize(Object object) {
|
||||||
|
return object.toString();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
protected String normalize(Object object, boolean numbersOnly) {
|
||||||
if (object instanceof Episode) {
|
if (object instanceof Episode) {
|
||||||
Episode e = (Episode) object;
|
Episode e = (Episode) object;
|
||||||
|
if (numbersOnly) {
|
||||||
object = EpisodeFormat.SeasonEpisode.formatSxE(e);
|
object = EpisodeFormat.SeasonEpisode.formatSxE(e);
|
||||||
|
} else {
|
||||||
|
object = String.format("%s %s", e.getSeriesName(), EpisodeFormat.SeasonEpisode.formatSxE(e));
|
||||||
|
}
|
||||||
} else if (object instanceof Movie) {
|
} else if (object instanceof Movie) {
|
||||||
object = ((Movie) object).getYear();
|
Movie m = (Movie) object;
|
||||||
|
if (numbersOnly) {
|
||||||
|
object = m.getYear();
|
||||||
|
} else {
|
||||||
|
object = String.format("%s %s", m.getName(), m.getYear());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// simplify file name if possible and extract numbers
|
// simplify file name if possible and extract numbers
|
||||||
|
|
Loading…
Reference in New Issue