* make sure to ignore any file/subtitle SxE mismatches
This commit is contained in:
parent
e3ba7b79e3
commit
a45c86b94a
|
@ -25,7 +25,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.sourceforge.filebot.similarity.EpisodeMetrics;
|
|
||||||
import net.sourceforge.filebot.similarity.Match;
|
import net.sourceforge.filebot.similarity.Match;
|
||||||
import net.sourceforge.filebot.similarity.Matcher;
|
import net.sourceforge.filebot.similarity.Matcher;
|
||||||
import net.sourceforge.filebot.similarity.MetricAvg;
|
import net.sourceforge.filebot.similarity.MetricAvg;
|
||||||
|
@ -49,12 +48,21 @@ public final class SubtitleUtilities {
|
||||||
// optimize for generic media <-> subtitle matching
|
// optimize for generic media <-> subtitle matching
|
||||||
SimilarityMetric[] metrics = new SimilarityMetric[] { EpisodeFunnel, EpisodeBalancer, SubstringSequence, new MetricCascade(SubstringSequence, Name), Numeric, new NameSimilarityMetric() };
|
SimilarityMetric[] metrics = new SimilarityMetric[] { EpisodeFunnel, EpisodeBalancer, SubstringSequence, new MetricCascade(SubstringSequence, Name), Numeric, new NameSimilarityMetric() };
|
||||||
|
|
||||||
|
// subtitle verification metric specifically excluding SxE mismatches
|
||||||
|
SimilarityMetric absoluteSeasonEpisode = new SimilarityMetric() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSimilarity(Object o1, Object o2) {
|
||||||
|
return SeasonEpisode.getSimilarity(o1, o2) < 1 ? -1 : 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
SimilarityMetric sanity = new MetricCascade(FileSize, FileName, absoluteSeasonEpisode, AirDate, Title, Name);
|
||||||
|
|
||||||
// first match everything as best as possible, then filter possibly bad matches
|
// first match everything as best as possible, then filter possibly bad matches
|
||||||
Matcher<File, SubtitleDescriptor> matcher = new Matcher<File, SubtitleDescriptor>(files, subtitles, false, metrics);
|
Matcher<File, SubtitleDescriptor> matcher = new Matcher<File, SubtitleDescriptor>(files, subtitles, false, metrics);
|
||||||
SimilarityMetric sanity = EpisodeMetrics.verificationMetric();
|
|
||||||
|
|
||||||
for (Match<File, SubtitleDescriptor> it : matcher.match()) {
|
for (Match<File, SubtitleDescriptor> it : matcher.match()) {
|
||||||
if (sanity.getSimilarity(it.getValue(), it.getCandidate()) >= (strict ? 0.9f : 0.5f)) {
|
if (sanity.getSimilarity(it.getValue(), it.getCandidate()) >= (strict ? 0.9f : 0.6f)) {
|
||||||
subtitleByVideo.put(it.getValue(), it.getCandidate());
|
subtitleByVideo.put(it.getValue(), it.getCandidate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -794,7 +794,7 @@ class SubtitleAutoMatchDialog extends JDialog {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// log and ignore
|
// log and ignore
|
||||||
Logger.getLogger(SubtitleAutoMatchDialog.class.getName()).log(Level.WARNING, e.getMessage(), e);
|
Logger.getLogger(SubtitleAutoMatchDialog.class.getName()).log(Level.WARNING, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue