From 31d7141b41c92b5278a768e0f3846cdf6665fc45 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 15 Jun 2012 12:11:28 +0000 Subject: [PATCH] * guess movie name from folder only 2 levels deep --- source/net/sourceforge/filebot/media/MediaDetection.java | 5 +++-- .../net/sourceforge/filebot/ui/rename/MovieHashMatcher.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index 39537f93..139c40bb 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -339,8 +339,9 @@ public class MediaDetection { public static File guessMovieFolder(File movieFile) throws IOException { - // first meaningful parent folder - for (File f = movieFile.getParentFile(); f != null; f = f.getParentFile()) { + // first meaningful parent folder (max 2 levels deep) + File f = movieFile.getParentFile(); + for (int i = 0; f != null && i < 2; f = f.getParentFile(), i++) { String term = stripReleaseInfo(f.getName()); if (term.length() > 0) { return f; diff --git a/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java b/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java index a2c21e42..305b155a 100644 --- a/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java +++ b/source/net/sourceforge/filebot/ui/rename/MovieHashMatcher.java @@ -305,7 +305,7 @@ class MovieHashMatcher implements AutoCompleteMatcher { // multiple results have been found, user must select one SelectDialog selectDialog = new SelectDialog(parent, options); - selectDialog.setTitle(String.format("%s / %s", folderQuery, fileQuery)); + selectDialog.setTitle(folderQuery.isEmpty() ? fileQuery : String.format("%s / %s", folderQuery, fileQuery)); selectDialog.getHeaderLabel().setText(String.format("Movies matching '%s':", fileQuery.length() >= 2 || folderQuery.length() <= 2 ? fileQuery : folderQuery)); selectDialog.getCancelAction().putValue(Action.NAME, "Ignore"); selectDialog.pack();