mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-11 05:48:01 -05:00
* fix bugs in the multi-episode logic
This commit is contained in:
parent
3326a30735
commit
8ea81bfa68
@ -52,7 +52,10 @@ names += anime.findResults{ it.getPrimaryTitle() }
|
|||||||
names += anime.findResults{ it.getOfficialTitle('en') }
|
names += anime.findResults{ it.getOfficialTitle('en') }
|
||||||
|
|
||||||
names = names.findAll{ it =~ /^[A-Z0-9]/ && it =~ /[\p{Alpha}]{3}/}.findResults{ net.sourceforge.filebot.similarity.Normalization.normalizePunctuation(it) }
|
names = names.findAll{ it =~ /^[A-Z0-9]/ && it =~ /[\p{Alpha}]{3}/}.findResults{ net.sourceforge.filebot.similarity.Normalization.normalizePunctuation(it) }
|
||||||
names = names.sort().unique()
|
|
||||||
|
def unique = new TreeSet(String.CASE_INSENSITIVE_ORDER)
|
||||||
|
unique.addAll(names)
|
||||||
|
names = unique as List
|
||||||
|
|
||||||
|
|
||||||
gz(s_out, names)
|
gz(s_out, names)
|
||||||
|
@ -9,7 +9,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -49,19 +48,33 @@ public class EpisodeMatcher extends Matcher<File, Object> {
|
|||||||
episodeIdentifierSets.put(it.getKey(), sxe);
|
episodeIdentifierSets.put(it.getKey(), sxe);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator<Match<File, Object>> itr = possibleMatches.iterator(); itr.hasNext();) {
|
boolean modified = false;
|
||||||
File file = itr.next().getValue();
|
for (Match<File, Object> it : possibleMatches) {
|
||||||
|
File file = it.getValue();
|
||||||
Set<SxE> uniqueFiles = parseEpisodeIdentifer(file);
|
Set<SxE> uniqueFiles = parseEpisodeIdentifer(file);
|
||||||
Set<SxE> uniqueEpisodes = episodeIdentifierSets.get(file);
|
Set<SxE> uniqueEpisodes = episodeIdentifierSets.get(file);
|
||||||
|
|
||||||
if (uniqueFiles.equals(uniqueEpisodes)) {
|
if (uniqueFiles.equals(uniqueEpisodes)) {
|
||||||
MultiEpisode episode = new MultiEpisode(episodeSets.get(file).toArray(new Episode[0]));
|
Episode[] episodes = episodeSets.get(file).toArray(new Episode[0]);
|
||||||
disjointMatchCollection.add(new Match<File, Object>(file, episode));
|
Set<String> seriesNames = new HashSet<String>();
|
||||||
itr.remove();
|
for (Episode ep : episodes) {
|
||||||
|
seriesNames.add(ep.getSeriesName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seriesNames.size() == 1) {
|
||||||
|
MultiEpisode episode = new MultiEpisode(episodes);
|
||||||
|
disjointMatchCollection.add(new Match<File, Object>(file, episode));
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modified) {
|
||||||
|
removeCollected(possibleMatches);
|
||||||
|
}
|
||||||
|
|
||||||
super.deepMatch(possibleMatches, level);
|
super.deepMatch(possibleMatches, level);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,8 +96,9 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
|||||||
Episode e = (Episode) object;
|
Episode e = (Episode) object;
|
||||||
|
|
||||||
// don't use title for matching if title equals series name
|
// don't use title for matching if title equals series name
|
||||||
if (!e.getSeriesName().toLowerCase().contains(e.getTitle().toLowerCase())) {
|
String normalizedToken = normalizeObject(e.getTitle());
|
||||||
object = e.getTitle();
|
if (normalizedToken.length() >= 3 && !normalizeObject(e.getSeriesName()).contains(normalizedToken)) {
|
||||||
|
return normalizedToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user