1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-17 06:45:06 -05:00

* connect nfo files to video files as well just like subtitles to make media info bindings match

This commit is contained in:
Reinhard Pointner 2012-07-21 15:54:39 +00:00
parent 425902f15d
commit 20ed98147f

View File

@ -485,14 +485,14 @@ public class MediaBindingBean {
// make sure media file is defined // make sure media file is defined
checkMediaFile(); checkMediaFile();
if (SUBTITLE_FILES.accept(mediaFile)) { if (SUBTITLE_FILES.accept(mediaFile) || getDefaultFilter("application/nfo").accept(mediaFile)) {
// file is a subtitle // file is a subtitle
String name = FileUtilities.getName(mediaFile).toLowerCase(); String baseName = stripReleaseInfo(FileUtilities.getName(mediaFile).toLowerCase());
// find corresponding movie file // find corresponding movie file
for (File movie : mediaFile.getParentFile().listFiles(VIDEO_FILES)) { for (File movieFile : mediaFile.getParentFile().listFiles(VIDEO_FILES)) {
if (name.startsWith(FileUtilities.getName(movie).toLowerCase())) { if (baseName.startsWith(stripReleaseInfo(FileUtilities.getName(movieFile)).toLowerCase())) {
return movie; return movieFile;
} }
} }
} }
@ -523,7 +523,7 @@ public class MediaBindingBean {
mediaInfo = newMediaInfo; mediaInfo = newMediaInfo;
} }
return (MediaInfo) mediaInfo; return mediaInfo;
} }