mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-22 07:48:52 -05:00
More lenient XEM series name matching
This commit is contained in:
parent
53323a8dfa
commit
ffa0690bfc
@ -285,16 +285,12 @@ public class EpisodeMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String[] getNormalizedEffectiveIdentifiers(Object object) {
|
protected String[] getNormalizedEffectiveIdentifiers(Object object) {
|
||||||
List<?> identifiers = getEffectiveIdentifiers(object);
|
return getEffectiveIdentifiers(object).stream().map(it -> {
|
||||||
String[] names = new String[identifiers.size()];
|
return normalizeObject(it);
|
||||||
|
}).toArray(String[]::new);
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
names[i] = normalizeObject(identifiers.get(i));
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<?> getEffectiveIdentifiers(Object object) {
|
protected Collection<?> getEffectiveIdentifiers(Object object) {
|
||||||
if (object instanceof Episode) {
|
if (object instanceof Episode) {
|
||||||
return ((Episode) object).getSeriesNames();
|
return ((Episode) object).getSeriesNames();
|
||||||
} else if (object instanceof Movie) {
|
} else if (object instanceof Movie) {
|
||||||
@ -302,7 +298,7 @@ public class EpisodeMetrics {
|
|||||||
} else if (object instanceof File) {
|
} else if (object instanceof File) {
|
||||||
return listPathTail((File) object, 3, true);
|
return listPathTail((File) object, 3, true);
|
||||||
}
|
}
|
||||||
return singletonList(object);
|
return singleton(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.filebot.web;
|
package net.filebot.web;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -95,7 +94,7 @@ public class Episode implements Serializable {
|
|||||||
return Arrays.asList(season, episode, special, absolute);
|
return Arrays.asList(season, episode, special, absolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSeriesNames() {
|
public Set<String> getSeriesNames() {
|
||||||
Set<String> names = new LinkedHashSet<String>();
|
Set<String> names = new LinkedHashSet<String>();
|
||||||
if (seriesName != null) {
|
if (seriesName != null) {
|
||||||
names.add(seriesName);
|
names.add(seriesName);
|
||||||
@ -110,7 +109,7 @@ public class Episode implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ArrayList<String>(names);
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,13 +49,14 @@ public enum XEM {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
String seriesName = episode.getSeriesName();
|
Set<String> seriesNames = episode.getSeriesNames();
|
||||||
Integer season = getSeason(episode.getSeason());
|
Integer season = getSeason(episode.getSeason());
|
||||||
|
|
||||||
Map<String, List<String>> names = getNames(seriesId);
|
Map<String, List<String>> names = getNames(seriesId);
|
||||||
|
debug.finest(format("[XEM] %s", names));
|
||||||
|
|
||||||
Integer mappedSeason = names.entrySet().stream().filter(it -> {
|
Integer mappedSeason = names.entrySet().stream().filter(it -> {
|
||||||
return it.getValue().contains(seriesName);
|
return it.getValue().stream().anyMatch(seriesNames::contains);
|
||||||
}).map(it -> {
|
}).map(it -> {
|
||||||
return matchInteger(it.getKey());
|
return matchInteger(it.getKey());
|
||||||
}).filter(Objects::nonNull).findFirst().orElse(season);
|
}).filter(Objects::nonNull).findFirst().orElse(season);
|
||||||
|
Loading…
Reference in New Issue
Block a user