mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -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 = 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)
|
||||
|
@ -9,7 +9,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@ -49,19 +48,33 @@ public class EpisodeMatcher extends Matcher<File, Object> {
|
||||
episodeIdentifierSets.put(it.getKey(), sxe);
|
||||
}
|
||||
|
||||
for (Iterator<Match<File, Object>> itr = possibleMatches.iterator(); itr.hasNext();) {
|
||||
File file = itr.next().getValue();
|
||||
boolean modified = false;
|
||||
for (Match<File, Object> it : possibleMatches) {
|
||||
File file = it.getValue();
|
||||
Set<SxE> uniqueFiles = parseEpisodeIdentifer(file);
|
||||
Set<SxE> uniqueEpisodes = episodeIdentifierSets.get(file);
|
||||
|
||||
if (uniqueFiles.equals(uniqueEpisodes)) {
|
||||
MultiEpisode episode = new MultiEpisode(episodeSets.get(file).toArray(new Episode[0]));
|
||||
disjointMatchCollection.add(new Match<File, Object>(file, episode));
|
||||
itr.remove();
|
||||
Episode[] episodes = episodeSets.get(file).toArray(new Episode[0]);
|
||||
Set<String> seriesNames = new HashSet<String>();
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,8 +96,9 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
||||
Episode e = (Episode) object;
|
||||
|
||||
// don't use title for matching if title equals series name
|
||||
if (!e.getSeriesName().toLowerCase().contains(e.getTitle().toLowerCase())) {
|
||||
object = e.getTitle();
|
||||
String normalizedToken = normalizeObject(e.getTitle());
|
||||
if (normalizedToken.length() >= 3 && !normalizeObject(e.getSeriesName()).contains(normalizedToken)) {
|
||||
return normalizedToken;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user