* make sure specials can't take priority over normal episodes

This commit is contained in:
Reinhard Pointner 2012-07-21 15:47:49 +00:00
parent a15ee1dd98
commit ffa1783e30
1 changed files with 9 additions and 13 deletions

View File

@ -43,19 +43,15 @@ public enum EpisodeMetrics implements SimilarityMetric {
if (object instanceof Episode) {
Episode episode = (Episode) object;
if (episode.getSpecial() == null) {
// get SxE from episode, both SxE for season/episode numbering and SxE for absolute episode numbering
SxE sxe = new SxE(episode.getSeason(), episode.getEpisode());
SxE abs = new SxE(null, episode.getAbsolute());
result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs);
} else {
// special handling
SxE sxe = new SxE(0, episode.getSpecial());
SxE sne = new SxE(episode.getSeason(), null);
return asList(sxe, sne);
if (episode.getSpecial() != null) {
return emptySet(); // make sure specials can't take priority over normal episodes
}
// get SxE from episode, both SxE for season/episode numbering and SxE for absolute episode numbering
SxE sxe = new SxE(episode.getSeason(), episode.getEpisode());
SxE abs = new SxE(null, episode.getAbsolute());
result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs);
} else {
result = super.parse(object);
}
@ -227,6 +223,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
// Match by generic numeric similarity
Numeric(new NumericSimilarityMetric() {
@Override
public float getSimilarity(Object o1, Object o2) {
String[] f1 = fields(o1);
String[] f2 = fields(o2);
@ -304,7 +301,6 @@ public enum EpisodeMetrics implements SimilarityMetric {
return metric.getSimilarity(o1, o2);
}
private static final Map<Object, String> transformCache = synchronizedMap(new WeakHashMap<Object, String>(64, 4));