* improved new funnel/balance episode matching logic
This commit is contained in:
parent
33d0f25fa7
commit
6171dac38f
|
@ -147,7 +147,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
// similarity metrics for matching
|
||||
SimilarityMetric[] sequence;
|
||||
if (strict) {
|
||||
sequence = new SimilarityMetric[] { StrictMetric.EpisodeIdentifier, StrictMetric.Title, StrictMetric.Name }; // use SEI for matching and SN for excluding false positives
|
||||
sequence = new SimilarityMetric[] { StrictMetric.EpisodeIdentifier, StrictMetric.SubstringFields, StrictMetric.Name }; // use SEI for matching and SN for excluding false positives
|
||||
} else {
|
||||
sequence = MatchSimilarityMetric.defaultSequence(false); // same as in GUI
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import net.sourceforge.filebot.ui.rename.MatchSimilarityMetric;
|
|||
|
||||
public enum StrictMetric implements SimilarityMetric {
|
||||
|
||||
EpisodeIdentifier(MatchSimilarityMetric.StrictEpisodeIdentifier, 1), // only allow 0 or 1
|
||||
Title(MatchSimilarityMetric.SubstringFields, 2), // allow 0 or .5 or 1
|
||||
EpisodeIdentifier(MatchSimilarityMetric.EpisodeIdentifier, 1), // only allow 0 or 1
|
||||
SubstringFields(MatchSimilarityMetric.SubstringFields, 2), // allow 0 or .5 or 1
|
||||
Name(MatchSimilarityMetric.Name, 2); // allow 0 or .5 or 1
|
||||
|
||||
// inner metric
|
||||
|
|
|
@ -21,7 +21,7 @@ public class MetricCascade implements SimilarityMetric {
|
|||
for (SimilarityMetric metric : cascade) {
|
||||
f = max(f, metric.getSimilarity(o1, o2));
|
||||
|
||||
// is match, ignore remaining metrics
|
||||
// perfect match, ignore remaining metrics
|
||||
if (f >= 1) {
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -111,9 +111,22 @@ public enum MatchSimilarityMetric implements SimilarityMetric {
|
|||
}
|
||||
}),
|
||||
|
||||
// Match by combining season/episode, episode airdate and movie/episode title
|
||||
GeneralEpisodeIdentifier(new MetricCascade(SeasonEpisode, AirDate, Title)),
|
||||
StrictEpisodeIdentifier(new MetricCascade(SeasonEpisode, AirDate)),
|
||||
// Match by SxE and airdate
|
||||
EpisodeIdentifier(new MetricCascade(SeasonEpisode, AirDate)),
|
||||
|
||||
// Advanced episode<->file matching
|
||||
EpisodeFunnel(new MetricCascade(SeasonEpisode, AirDate, Title)),
|
||||
EpisodeBalancer(new SimilarityMetric() {
|
||||
|
||||
@Override
|
||||
public float getSimilarity(Object o1, Object o2) {
|
||||
float sxe = EpisodeIdentifier.getSimilarity(o1, o2);
|
||||
float title = Title.getSimilarity(o1, o2);
|
||||
|
||||
// 1:SxE && Title, 2:SxE
|
||||
return (sxe * title) + (sxe / 10f);
|
||||
}
|
||||
}),
|
||||
|
||||
// Match series title and episode title against folder structure and file name
|
||||
SubstringFields(new SubstringMetric() {
|
||||
|
@ -259,9 +272,9 @@ public enum MatchSimilarityMetric implements SimilarityMetric {
|
|||
// 4. pass: match by generic name similarity (slow, but most matches will have been determined in second pass)
|
||||
// 5. pass: match by generic numeric similarity
|
||||
if (includeFileMetrics) {
|
||||
return new SimilarityMetric[] { FileSize, GeneralEpisodeIdentifier, StrictEpisodeIdentifier, SubstringFields, Name, Numeric };
|
||||
return new SimilarityMetric[] { FileSize, EpisodeFunnel, EpisodeBalancer, SubstringFields, Name, Numeric };
|
||||
} else {
|
||||
return new SimilarityMetric[] { GeneralEpisodeIdentifier, StrictEpisodeIdentifier, SubstringFields, Name, Numeric };
|
||||
return new SimilarityMetric[] { EpisodeFunnel, EpisodeBalancer, SubstringFields, Name, Numeric };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MatchSimilarityMetricTest {
|
|||
episodes.add(new Episode("Veronica Mars", null, 1, 19, "Hot Dogs"));
|
||||
episodes.add(new Episode("Greek", null, 1, 19, "No Campus for Old Rules"));
|
||||
|
||||
SimilarityMetric[] metrics = new SimilarityMetric[] { GeneralEpisodeIdentifier, SubstringFields };
|
||||
SimilarityMetric[] metrics = new SimilarityMetric[] { EpisodeIdentifier, SubstringFields };
|
||||
List<Match<File, Episode>> m = new Matcher<File, Episode>(files, episodes, true, metrics).match();
|
||||
|
||||
assertEquals("Greek - S01E19 - No Campus for Old Rules", m.get(0).getValue().getName());
|
||||
|
|
Loading…
Reference in New Issue