mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-16 14:25:02 -05:00
* improved series detection
e.g. spincity/season5/01-episodename love in it
This commit is contained in:
parent
2e71d710e3
commit
444ddd8883
@ -2,7 +2,6 @@
|
|||||||
package net.sourceforge.filebot.media;
|
package net.sourceforge.filebot.media;
|
||||||
|
|
||||||
|
|
||||||
import static java.util.Arrays.*;
|
|
||||||
import static java.util.Collections.*;
|
import static java.util.Collections.*;
|
||||||
import static java.util.regex.Pattern.*;
|
import static java.util.regex.Pattern.*;
|
||||||
import static net.sourceforge.filebot.MediaTypes.*;
|
import static net.sourceforge.filebot.MediaTypes.*;
|
||||||
@ -298,26 +297,26 @@ public class MediaDetection {
|
|||||||
matches.addAll(matchSeriesByName(stripReleaseInfo(filenames, false), 0));
|
matches.addAll(matchSeriesByName(stripReleaseInfo(filenames, false), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// use lenient sub sequence matching only as fallback
|
// use lenient sub sequence matching only as fallback and try name without spacing logic that may mess up any lookup
|
||||||
if (matches.isEmpty()) {
|
|
||||||
matches.addAll(matchSeriesByName(folders, 3));
|
|
||||||
matches.addAll(matchSeriesByName(filenames, 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
// assume name without spacing will mess up any lookup
|
|
||||||
if (matches.isEmpty()) {
|
if (matches.isEmpty()) {
|
||||||
// try to narrow down file to series name as best as possible
|
// try to narrow down file to series name as best as possible
|
||||||
SeriesNameMatcher snm = new SeriesNameMatcher();
|
SeriesNameMatcher snm = new SeriesNameMatcher();
|
||||||
String[] sns = filenames.toArray(new String[0]);
|
List<String> sns = new ArrayList<String>();
|
||||||
for (int i = 0; i < sns.length; i++) {
|
sns.addAll(folders);
|
||||||
String sn = snm.matchByEpisodeIdentifier(sns[i]);
|
sns.addAll(filenames);
|
||||||
|
for (int i = 0; i < sns.size(); i++) {
|
||||||
|
String sn = snm.matchByEpisodeIdentifier(sns.get(i));
|
||||||
if (sn != null) {
|
if (sn != null) {
|
||||||
sns[i] = sn;
|
sns.set(i, sn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (SearchResult it : matchSeriesFromStringWithoutSpacing(stripReleaseInfo(asList(sns), false), true)) {
|
for (SearchResult it : matchSeriesFromStringWithoutSpacing(stripReleaseInfo(sns, false), true)) {
|
||||||
matches.add(it.getName());
|
matches.add(it.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// less reliable CWS deep matching
|
||||||
|
matches.addAll(matchSeriesByName(folders, 2));
|
||||||
|
matches.addAll(matchSeriesByName(filenames, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass along only valid terms
|
// pass along only valid terms
|
||||||
|
@ -8,6 +8,7 @@ import static net.sourceforge.filebot.Settings.*;
|
|||||||
import static net.sourceforge.filebot.media.MediaDetection.*;
|
import static net.sourceforge.filebot.media.MediaDetection.*;
|
||||||
import static net.sourceforge.filebot.similarity.Normalization.*;
|
import static net.sourceforge.filebot.similarity.Normalization.*;
|
||||||
import static net.sourceforge.tuned.FileUtilities.*;
|
import static net.sourceforge.tuned.FileUtilities.*;
|
||||||
|
import static net.sourceforge.tuned.StringUtilities.*;
|
||||||
import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
import static net.sourceforge.tuned.ui.TunedUtilities.*;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
@ -44,7 +45,6 @@ import net.sourceforge.filebot.similarity.CommonSequenceMatcher;
|
|||||||
import net.sourceforge.filebot.similarity.EpisodeMatcher;
|
import net.sourceforge.filebot.similarity.EpisodeMatcher;
|
||||||
import net.sourceforge.filebot.similarity.Match;
|
import net.sourceforge.filebot.similarity.Match;
|
||||||
import net.sourceforge.filebot.similarity.NameSimilarityMetric;
|
import net.sourceforge.filebot.similarity.NameSimilarityMetric;
|
||||||
import net.sourceforge.filebot.similarity.SeriesNameMatcher;
|
|
||||||
import net.sourceforge.filebot.similarity.SimilarityMetric;
|
import net.sourceforge.filebot.similarity.SimilarityMetric;
|
||||||
import net.sourceforge.filebot.ui.SelectDialog;
|
import net.sourceforge.filebot.ui.SelectDialog;
|
||||||
import net.sourceforge.filebot.web.Episode;
|
import net.sourceforge.filebot.web.Episode;
|
||||||
@ -285,24 +285,15 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
|||||||
|
|
||||||
// require user input if auto-detection has failed or has been disabled
|
// require user input if auto-detection has failed or has been disabled
|
||||||
if (episodes.isEmpty()) {
|
if (episodes.isEmpty()) {
|
||||||
String suggestion = new SeriesNameMatcher(locale).matchByEpisodeIdentifier(getName(files.get(0)));
|
List<String> detectedSeriesNames = detectSeriesNames(files, locale);
|
||||||
if (suggestion != null) {
|
String parentPathHint = normalizePathSeparators(getRelativePathTail(files.get(0).getParentFile(), 2).getPath());
|
||||||
// clean media info / release group info / etc
|
String suggestion = detectedSeriesNames.size() > 0 ? join(detectedSeriesNames, ", ") : parentPathHint;
|
||||||
try {
|
|
||||||
suggestion = stripReleaseInfo(suggestion);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// use folder name
|
|
||||||
suggestion = files.get(0).getParentFile().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> input = emptyList();
|
List<String> input = emptyList();
|
||||||
synchronized (inputMemory) {
|
synchronized (inputMemory) {
|
||||||
input = inputMemory.get(suggestion);
|
input = inputMemory.get(suggestion);
|
||||||
if (input == null || suggestion == null || suggestion.isEmpty()) {
|
if (input == null || suggestion == null || suggestion.isEmpty()) {
|
||||||
input = showMultiValueInputDialog("Enter series name:", suggestion, files.get(0).getParentFile().getName(), parent);
|
input = showMultiValueInputDialog("Enter series name:", suggestion, parentPathHint, parent);
|
||||||
inputMemory.put(suggestion, input);
|
inputMemory.put(suggestion, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
epl English Premier League
|
||||||
HIMYM How I Met your Mother
|
HIMYM How I Met your Mother
|
||||||
Hml8p Homeland
|
Hml8p Homeland
|
||||||
hoc House of Cards
|
hoc House of Cards
|
||||||
|
Loading…
Reference in New Issue
Block a user