* better detect subtitles linked to movie files

This commit is contained in:
Reinhard Pointner 2011-12-07 06:33:14 +00:00
parent 3ac1f8f532
commit 34b4630f68
2 changed files with 3 additions and 8 deletions

View File

@ -257,6 +257,7 @@ public class CmdlineOperations implements CmdlineInterface {
// allow subtitles without video files
movieDescriptors = new Movie[subtitleFiles.length];
movieFiles = subtitleFiles;
subtitleFiles = new File[0];
}
// fill in movie information from nfo file imdb when necessary
@ -306,10 +307,7 @@ public class CmdlineOperations implements CmdlineInterface {
// check if subtitle corresponds to a movie file (same name, different extension)
for (int i = 0; i < movieDescriptors.length; i++) {
if (movieDescriptors != null) {
String subtitleName = getName(subtitleFile);
String movieName = getName(movieFiles[i]);
if (subtitleName.equalsIgnoreCase(movieName)) {
if (isDerived(subtitleFile, movieFiles[i])) {
File movieDestination = renameMap.get(movieFiles[i]);
File subtitleDestination = new File(movieDestination.getParentFile(), getName(movieDestination) + "." + getExtension(subtitleFile));
renameMap.put(subtitleFile, subtitleDestination);

View File

@ -111,10 +111,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
for (File subtitle : filter(files, SUBTITLE_FILES)) {
// check if subtitle corresponds to a movie file (same name, different extension)
for (Match<File, ?> movieMatch : matches) {
String subtitleName = getName(subtitle);
String movieName = getName(movieMatch.getValue());
if (subtitleName.equalsIgnoreCase(movieName)) {
if (isDerived(getName(subtitle), movieMatch.getValue())) {
matches.add(new Match<File, Object>(subtitle, movieMatch.getCandidate()));
// movie match found, we're done
break;