From c033fa565ccf639a0f8c063a126fbe28d1475201 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 27 Nov 2011 15:41:42 +0000 Subject: [PATCH] * improved matching / mismatch highlighting --- .../net/sourceforge/filebot/similarity/EpisodeMetrics.java | 6 +++--- .../sourceforge/filebot/similarity/SeasonEpisodeMetric.java | 4 ++-- .../filebot/ui/rename/RenameListCellRenderer.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java index 519d5897..b620aef6 100644 --- a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java +++ b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java @@ -43,10 +43,10 @@ public enum EpisodeMetrics implements SimilarityMetric { Episode episode = (Episode) object; // get SxE from episode, both SxE for season/episode numbering and SxE for absolute episode numbering - SxE seasonEpisode = new SxE(episode.getSeason(), episode.getEpisode()); - SxE absoluteEpisode = new SxE(null, episode.getAbsolute()); + SxE sxe = new SxE(episode.getSeason(), episode.getEpisode()); + SxE abs = new SxE(null, episode.getAbsolute()); - result = seasonEpisode.equals(absoluteEpisode) ? singleton(absoluteEpisode) : asList(seasonEpisode, absoluteEpisode); + result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs); } else { result = super.parse(object); } diff --git a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMetric.java b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMetric.java index f1594549..4903ccad 100644 --- a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMetric.java +++ b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMetric.java @@ -26,12 +26,12 @@ public class SeasonEpisodeMetric implements SimilarityMetric { float similarity = -1; for (SxE sxe1 : sxeVector1) { for (SxE sxe2 : sxeVector2) { - if (sxe1.season >= 0 && sxe1.season == sxe2.season && sxe1.episode >= 0 && sxe1.episode == sxe2.episode) { + if (sxe1.season == sxe2.season && sxe1.episode == sxe2.episode) { // vectors have at least one perfect episode match in common return 1; } - if ((sxe1.season >= 0 && sxe1.season == sxe2.season) || (sxe1.episode >= 0 && sxe1.episode == sxe2.episode)) { + if (sxe1.season == sxe2.season || sxe1.episode == sxe2.episode) { // at least we have a partial match similarity = 0.5f; } diff --git a/source/net/sourceforge/filebot/ui/rename/RenameListCellRenderer.java b/source/net/sourceforge/filebot/ui/rename/RenameListCellRenderer.java index 4ba46964..4f805e05 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenameListCellRenderer.java +++ b/source/net/sourceforge/filebot/ui/rename/RenameListCellRenderer.java @@ -112,7 +112,7 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer { if (formattedFuture.isComplexFormat()) { typeRenderer.setVisible(true); typeRenderer.setAlpha(1.0f); - typeRenderer.setText(formattedFuture.preview()); + typeRenderer.setText(formattedFuture.getMatch().getValue().toString()); } }