* fetch missing subtitles for language

This commit is contained in:
Reinhard Pointner 2012-03-27 15:26:00 +00:00
parent 2b5de3cf81
commit 1e583d46fe
1 changed files with 5 additions and 2 deletions

View File

@ -595,12 +595,15 @@ public class CmdlineOperations implements CmdlineInterface {
} }
public List<File> getMissingSubtitles(Collection<File> files, String query, String languageName, String output, String csn, boolean strict) throws Exception { public List<File> getMissingSubtitles(Collection<File> files, String query, final String languageName, String output, String csn, boolean strict) throws Exception {
List<File> videoFiles = filter(filter(files, VIDEO_FILES), new FileFilter() { List<File> videoFiles = filter(filter(files, VIDEO_FILES), new FileFilter() {
// save time on repeating filesystem calls // save time on repeating filesystem calls
private final Map<File, File[]> cache = new HashMap<File, File[]>(); private final Map<File, File[]> cache = new HashMap<File, File[]>();
// get language code suffix for given language (.eng)
private final String languageCodeSuffix = "." + Language.getISO3LanguageCodeByName(getLanguage(languageName).getName());
@Override @Override
public boolean accept(File video) { public boolean accept(File video) {
@ -611,7 +614,7 @@ public class CmdlineOperations implements CmdlineInterface {
} }
for (File subtitle : subtitlesByFolder) { for (File subtitle : subtitlesByFolder) {
if (isDerived(subtitle, video)) if (isDerived(subtitle, video) && (subtitle.getName().contains(languageCodeSuffix)))
return false; return false;
} }