1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 17:28:51 -05:00

* fine-tune series detection and SxE matching

@see http://www.filebot.net/forums/viewtopic.php?f=6&p=6353
This commit is contained in:
Reinhard Pointner 2013-10-20 13:06:58 +00:00
parent 86d448a5d8
commit c7e25998fb
2 changed files with 25 additions and 8 deletions

View File

@ -332,10 +332,13 @@ public class MediaDetection {
// less reliable CWS deep matching // less reliable CWS deep matching
matches.addAll(matchSeriesByName(folders, 2)); matches.addAll(matchSeriesByName(folders, 2));
matches.addAll(matchSeriesByName(filenames, 2)); matches.addAll(matchSeriesByName(filenames, 2));
}
// pass along only valid terms // pass along only valid terms
names.addAll(stripBlacklistedTerms(matches)); names.addAll(stripBlacklistedTerms(matches));
} else {
// trust terms matched by 0-stance
names.addAll(matches);
}
} catch (Exception e) { } catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match folder structure: " + e.getMessage(), e); Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match folder structure: " + e.getMessage(), e);
} }

View File

@ -24,7 +24,7 @@ public class SeasonEpisodeMatcher {
private Pattern seasonPattern; private Pattern seasonPattern;
public SeasonEpisodeMatcher(SeasonEpisodeFilter sanity, boolean strict) { public SeasonEpisodeMatcher(SeasonEpisodeFilter sanity, boolean strict) {
patterns = new SeasonEpisodePattern[5]; patterns = new SeasonEpisodePattern[6];
// match patterns like Season 01 Episode 02, ... // match patterns like Season 01 Episode 02, ...
patterns[0] = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})(?i:season|series)[^\\p{Alnum}]{0,3}(\\d{1,4})[^\\p{Alnum}]{0,3}(?i:episode)[^\\p{Alnum}]{0,3}(\\d{1,4})[^\\p{Alnum}]{0,3}(?!\\p{Digit})"); patterns[0] = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})(?i:season|series)[^\\p{Alnum}]{0,3}(\\d{1,4})[^\\p{Alnum}]{0,3}(?i:episode)[^\\p{Alnum}]{0,3}(\\d{1,4})[^\\p{Alnum}]{0,3}(?!\\p{Digit})");
@ -44,7 +44,21 @@ public class SeasonEpisodeMatcher {
}; };
// match patterns like 1x01, 1.02, ..., 1x01a, 10x01, 10.02, ... 1x01-02-03-04, 1x01x02x03x04 ... // match patterns like 1x01, 1.02, ..., 1x01a, 10x01, 10.02, ... 1x01-02-03-04, 1x01x02x03x04 ...
patterns[2] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum}|\\d{4}[.])(\\d{1,2})[xe.](((?<=[^._ ])\\d{2,3}(\\D|$))+)") { patterns[2] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(\\d{1,2})[xe](((?<=[^._ ])\\d{2,3}(\\D|$))+)") {
@Override
protected Collection<SxE> process(MatchResult match) {
List<SxE> matches = new ArrayList<SxE>(2);
Scanner epno = new Scanner(match.group(2)).useDelimiter("\\D+");
while (epno.hasNext()) {
matches.add(new SxE(match.group(1), epno.next()));
}
return matches;
}
};
// match patterns 1.02, ..., 10.02, ...
patterns[3] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum}|\\d{4}[.])(\\d{1,2})[.](((?<=[^._ ])\\d{2}(\\D|$))+)") {
@Override @Override
protected Collection<SxE> process(MatchResult match) { protected Collection<SxE> process(MatchResult match) {
@ -58,7 +72,7 @@ public class SeasonEpisodeMatcher {
}; };
// match patterns like ep1, ep.1, ... // match patterns like ep1, ep.1, ...
patterns[3] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(?i:e|ep|episode)[^\\p{Alnum}]{0,3}(\\d{1,3})(?!\\p{Digit})") { patterns[4] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(?i:e|ep|episode)[^\\p{Alnum}]{0,3}(\\d{1,3})(?!\\p{Digit})") {
@Override @Override
protected Collection<SxE> process(MatchResult match) { protected Collection<SxE> process(MatchResult match) {
@ -68,7 +82,7 @@ public class SeasonEpisodeMatcher {
}; };
// match patterns like 01, 102, 1003, 10102 (enclosed in separators) // match patterns like 01, 102, 1003, 10102 (enclosed in separators)
patterns[4] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})([0-2]?\\d?)(\\d{2})(\\d{2})?(?!\\p{Alnum})") { patterns[5] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})([0-2]?\\d?)(\\d{2})(\\d{2})?(?!\\p{Alnum})") {
@Override @Override
protected Collection<SxE> process(MatchResult match) { protected Collection<SxE> process(MatchResult match) {
@ -93,7 +107,7 @@ public class SeasonEpisodeMatcher {
// only use S00E00 and SxE pattern in strict mode // only use S00E00 and SxE pattern in strict mode
if (strict) { if (strict) {
patterns = new SeasonEpisodePattern[] { patterns[0], patterns[1], patterns[2] }; patterns = new SeasonEpisodePattern[] { patterns[0], patterns[1], patterns[2], patterns[3] };
} }
// season folder pattern for complementing partial sxe info from filename // season folder pattern for complementing partial sxe info from filename