From 20ed98147f7701fb412cc5cea3c3ab7dbde705d2 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 21 Jul 2012 15:54:39 +0000 Subject: [PATCH] * connect nfo files to video files as well just like subtitles to make media info bindings match --- .../sourceforge/filebot/format/MediaBindingBean.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index 7d4fd7a5..d146c516 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -485,14 +485,14 @@ public class MediaBindingBean { // make sure media file is defined checkMediaFile(); - if (SUBTITLE_FILES.accept(mediaFile)) { + if (SUBTITLE_FILES.accept(mediaFile) || getDefaultFilter("application/nfo").accept(mediaFile)) { // file is a subtitle - String name = FileUtilities.getName(mediaFile).toLowerCase(); + String baseName = stripReleaseInfo(FileUtilities.getName(mediaFile).toLowerCase()); // find corresponding movie file - for (File movie : mediaFile.getParentFile().listFiles(VIDEO_FILES)) { - if (name.startsWith(FileUtilities.getName(movie).toLowerCase())) { - return movie; + for (File movieFile : mediaFile.getParentFile().listFiles(VIDEO_FILES)) { + if (baseName.startsWith(stripReleaseInfo(FileUtilities.getName(movieFile)).toLowerCase())) { + return movieFile; } } } @@ -523,7 +523,7 @@ public class MediaBindingBean { mediaInfo = newMediaInfo; } - return (MediaInfo) mediaInfo; + return mediaInfo; }