mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 00:15:02 -04:00
Check if file name matches a language name (e.g. English.srt)
This commit is contained in:
parent
81d9b6a2f6
commit
0472084dc7
@ -120,8 +120,12 @@ public class ReleaseInfo {
|
||||
if (languageTag == null) {
|
||||
languageTag = getSubtitleLanguageTagPattern(getDefaultLanguageMap().keySet());
|
||||
}
|
||||
|
||||
String lang = matchLast(languageTag, null, name);
|
||||
return lang == null ? null : getDefaultLanguageMap().get(lang);
|
||||
if (lang != null) {
|
||||
return getDefaultLanguageMap().get(lang);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Pattern categoryTag;
|
||||
|
@ -444,6 +444,12 @@ public final class SubtitleUtilities {
|
||||
return Language.getLanguage(languageTag);
|
||||
}
|
||||
|
||||
// check if file name matches a language name (e.g. English.srt)
|
||||
Language languageName = Language.findLanguage(getName(file));
|
||||
if (languageName != null) {
|
||||
return languageName;
|
||||
}
|
||||
|
||||
// detect language from subtitle text content
|
||||
MemoryFile data = new MemoryFile(file.getName(), ByteBuffer.wrap(readFile(file)));
|
||||
List<DetectedLanguage> options = detectSubtitleLanguage(data);
|
||||
|
Loading…
Reference in New Issue
Block a user