* guess movie name from folder only 2 levels deep

This commit is contained in:
Reinhard Pointner 2012-06-15 12:11:28 +00:00
parent c67b0d0d47
commit 31d7141b41
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -305,7 +305,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
// multiple results have been found, user must select one
SelectDialog<Movie> selectDialog = new SelectDialog<Movie>(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();