* improved support for crappy short-hand numbering styles

@see http://www.filebot.net/forums/viewtopic.php?f=6&t=1013
This commit is contained in:
Reinhard Pointner 2013-10-15 03:22:47 +00:00
parent 4ef6b02903
commit a130725d74
3 changed files with 11 additions and 3 deletions

View File

@ -381,7 +381,9 @@ public enum EpisodeMetrics implements SimilarityMetric {
float max = 0;
for (String s1 : f1) {
for (String s2 : f2) {
max = max(super.getSimilarity(s1, s2), max);
if (s1 != null && s2 != null) {
max = max(super.getSimilarity(s1, s2), max);
}
}
}
return max;
@ -390,7 +392,12 @@ public enum EpisodeMetrics implements SimilarityMetric {
protected String[] fields(Object object) {
if (object instanceof Episode) {
Episode episode = (Episode) object;
return new String[] { episode.getSeriesName(), EpisodeFormat.SeasonEpisode.formatSxE(episode), String.valueOf(episode.getAbsolute()) };
String[] f = new String[4];
f[0] = episode.getSeriesName();
f[1] = EpisodeFormat.SeasonEpisode.formatSxE(episode);
f[2] = episode.getAbsolute() == null ? null : episode.getAbsolute().toString();
f[3] = episode.getSeason() == null || episode.getEpisode() == null ? null : String.format("%02d%02d", episode.getSeason(), episode.getEpisode());
return f;
}
if (object instanceof Movie) {

View File

@ -2155,6 +2155,7 @@ TvNORGE
TVP
TvR
TVS
TVSmash
TvTiME
TVTUPA
TW

View File

@ -156,7 +156,7 @@ def groups = input.groupBy{ f ->
**/
// S00E00 | 2012.07.21 | One Piece 217 | Firefly - Serenity | [Taken 1, Taken 2, Taken 3, Taken 4, ..., Taken 10]
if ((parseEpisodeNumber(fn, true) || parseDate(fn) || ([dn, fn].find{ it =~ sn && matchMovie(it, true) == null } && (parseEpisodeNumber(stripReleaseInfo(fn.after(sn), false), false) || fn.after(sn) =~ /\D\d{1,2}\D{1,3}\d{1,2}\D/) && matchMovie(fn, true) == null) || (fn.after(sn) ==~ /.{0,3} - .+/ && matchMovie(fn, true) == null) || f.dir.listFiles{ it.isVideo() && (dn =~ sn || norm(it.name) =~ sn) && it.name =~ /\b\d{1,3}\b/}.size() >= 10 || mov.year < 1900) && !( (mov.year >= 1950 && f.listPath().reverse().take(3).find{ it.name =~ mov.year }) || (mn =~ sn && [dn, fn].find{ it =~ /(19|20)\d{2}/ }) ) ) {
if ((parseEpisodeNumber(fn, true) || parseDate(fn) || ([dn, fn].find{ it =~ sn && matchMovie(it, true) == null } && (parseEpisodeNumber(stripReleaseInfo(fn.after(sn), false), false) || fn.after(sn) =~ /\D\d{1,2}\D{1,3}\d{1,2}\D/) && matchMovie(fn, true) == null) || (fn.after(sn) ==~ /.{0,3} - .+/ && matchMovie(fn, true) == null) || f.dir.listFiles{ it.isVideo() && (dn =~ sn || norm(it.name) =~ sn) && it.name =~ /\d{1,3}\b/}.size() >= 10 || mov.year < 1900) && !( (mov.year >= 1950 && f.listPath().reverse().take(3).find{ it.name =~ mov.year }) || (mn =~ sn && [dn, fn].find{ it =~ /(19|20)\d{2}/ }) ) ) {
_log.fine("Exclude Movie: $mov")
mov = null
} else if (similarity(mn, fn) >= 0.8 || [dn, fn].find{ it =~ /\b/+mov.year+/\b/ } || [dn, fn].find{ it =~ mn && !(it.after(mn) =~ /\b\d{1,3}\b/) && !(it.before(mn).contains(sn)) } || (detectMovie(f, true) && [dn, fn].find{ it =~ /(19|20)\d{2}/ })) {