* infer media info bindings from just any video file if necessary
This commit is contained in:
parent
100d5c5a4f
commit
f56010bcd1
|
@ -367,7 +367,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase();
|
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase();
|
||||||
|
|
||||||
for (File movieFile : siblingMovieFiles) {
|
for (File movieFile : siblingMovieFiles) {
|
||||||
if (stripReleaseInfo(getName(movieFile)).toLowerCase().startsWith(baseName)) {
|
if (!baseName.isEmpty() && stripReleaseInfo(getName(movieFile)).toLowerCase().startsWith(baseName)) {
|
||||||
movieByFile.put(movieFile, movie);
|
movieByFile.put(movieFile, movie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,13 +526,19 @@ public class MediaBindingBean {
|
||||||
} else if (!VIDEO_FILES.accept(mediaFile)) {
|
} else if (!VIDEO_FILES.accept(mediaFile)) {
|
||||||
// file is a subtitle, or nfo, etc
|
// file is a subtitle, or nfo, etc
|
||||||
String baseName = stripReleaseInfo(FileUtilities.getName(mediaFile)).toLowerCase();
|
String baseName = stripReleaseInfo(FileUtilities.getName(mediaFile)).toLowerCase();
|
||||||
|
File[] videos = mediaFile.getParentFile().listFiles(VIDEO_FILES);
|
||||||
|
|
||||||
// find corresponding movie file
|
// find corresponding movie file
|
||||||
for (File movieFile : mediaFile.getParentFile().listFiles(VIDEO_FILES)) {
|
for (File movieFile : videos) {
|
||||||
if (stripReleaseInfo(FileUtilities.getName(movieFile)).toLowerCase().startsWith(baseName)) {
|
if (!baseName.isEmpty() && stripReleaseInfo(FileUtilities.getName(movieFile)).toLowerCase().startsWith(baseName)) {
|
||||||
return movieFile;
|
return movieFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// still no good match found -> just take any video from the same folder
|
||||||
|
if (videos.length > 0) {
|
||||||
|
return videos[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mediaFile;
|
return mediaFile;
|
||||||
|
|
|
@ -144,7 +144,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
||||||
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase();
|
String baseName = stripReleaseInfo(getName(nfo)).toLowerCase();
|
||||||
|
|
||||||
for (File movieFile : siblingMovieFiles) {
|
for (File movieFile : siblingMovieFiles) {
|
||||||
if (stripReleaseInfo(getName(movieFile)).toLowerCase().startsWith(baseName)) {
|
if (!baseName.isEmpty() && stripReleaseInfo(getName(movieFile)).toLowerCase().startsWith(baseName)) {
|
||||||
movieByFile.put(movieFile, movie);
|
movieByFile.put(movieFile, movie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue