* slightly improved matching for special cases

This commit is contained in:
Reinhard Pointner 2012-06-28 04:04:37 +00:00
parent 3e197b2263
commit 473cc6bd44
2 changed files with 9 additions and 4 deletions

View File

@ -169,11 +169,16 @@ def detectSeriesName(files, locale = Locale.ENGLISH) {
return names == null || names.isEmpty() ? null : names.toList()[0]
}
def detectMovie(movieFile, strict = true, locale = Locale.ENGLISH) {
def movies = MediaDetection.detectMovie(movieFile, OpenSubtitles, TheMovieDB, locale, strict)
def detectMovie(movieFile, strict = true, locale = Locale.ENGLISH, hashLookupService = OpenSubtitles, queryLookupService = TheMovieDB) {
def movies = MediaDetection.detectMovie(movieFile, hashLookupService, queryLookupService, locale, strict)
return movies == null || movies.isEmpty() ? null : movies.toList()[0]
}
def matchMovie(movieFile, strict = false) { // same as detectMovie() using only the local movie index making it VERY FAST
return detectMovie(movieFile, strict, Locale.ENGLISH, null, null)
}
def similarity(o1, o2) {
return new NameSimilarityMetric().getSimilarity(o1, o2)
}

View File

@ -29,7 +29,7 @@ public class SeasonEpisodeMatcher {
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})");
// match patterns like S01E01, s01e02, ... [s01]_[e02], s01.e02, s01e02a, s2010e01 ... s01e01-02-03-04, [s01]_[e01-02-03-04] ...
patterns[1] = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})[Ss](\\d{1,2}|\\d{4})[^\\p{Alnum}]{0,3}[Ee](((?<=[^._ ])\\d{1,2}(\\D|$))+)") {
patterns[1] = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})[Ss](\\d{1,2}|\\d{4})[^\\p{Alnum}]{0,3}[Ee](((?<=[^._ ])\\d{1,3}(\\D|$))+)") {
@Override
protected Collection<SxE> process(MatchResult match) {
@ -57,7 +57,7 @@ public class SeasonEpisodeMatcher {
};
// match patterns like ep1, ep.1, ...
patterns[3] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(?i:ep|episode)[^\\p{Alnum}]{0,3}(\\d{1,3})(?!\\p{Digit})") {
patterns[3] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(?i:e|ep|episode)[^\\p{Alnum}]{0,3}(\\d{1,3})(?!\\p{Digit})") {
@Override
protected Collection<SxE> process(MatchResult match) {