From 9aa97268c55869926fc4bd625ec3e678c4f1d2ae Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 13 Apr 2014 19:42:41 +0000 Subject: [PATCH] * improve series detection, and make sure to not scrub things too aggressively as not to loose information * skip search if all files are tagged already --- source/net/sourceforge/filebot/media/MediaDetection.java | 9 +++++++-- .../filebot/similarity/SeriesNameMatcher.java | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index db4dbe6f..3f846c42 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -305,6 +305,11 @@ public class MediaDetection { } } + // completely trust xattr metadata if all files are tagged + if (names.size() == files.size()) { + return getUniqueQuerySet(names); + } + // try to detect series name via nfo files try { for (SearchResult it : lookupSeriesNameByInfoFile(files, locale)) { @@ -338,7 +343,7 @@ public class MediaDetection { fn = sn; } - (i == 0 ? filenames : folders).add(normalizeBrackets(fn)); + (i == 0 ? filenames : folders).add(fn); // keep series name unique with year } } @@ -1364,7 +1369,7 @@ public class MediaDetection { } else if (model instanceof Movie) { Movie movie = (Movie) model; if (movie.getYear() > 0 && movie.getTmdbId() > 0) { - Date releaseDate = WebServices.TMDb.getMovieInfo(movie, Locale.ENGLISH, false).getReleased(); + Date releaseDate = WebServices.TheMovieDB.getMovieInfo(movie, Locale.ENGLISH, false).getReleased(); xattr.setCreationDate(releaseDate.getTimeStamp()); } } diff --git a/source/net/sourceforge/filebot/similarity/SeriesNameMatcher.java b/source/net/sourceforge/filebot/similarity/SeriesNameMatcher.java index a38373e2..46d045d0 100644 --- a/source/net/sourceforge/filebot/similarity/SeriesNameMatcher.java +++ b/source/net/sourceforge/filebot/similarity/SeriesNameMatcher.java @@ -192,13 +192,13 @@ public class SeriesNameMatcher { int seasonEpisodePosition = seasonEpisodeMatcher.find(name, 0); if (seasonEpisodePosition > 0) { // series name ends at the first season episode pattern - return normalize(name.substring(0, seasonEpisodePosition)); + return name.substring(0, seasonEpisodePosition).trim(); } int datePosition = dateMatcher.find(name, 0); if (datePosition > 0) { // series name ends at the first season episode pattern - return normalize(name.substring(0, datePosition)); + return name.substring(0, datePosition).trim(); } return null;