Refactor
This commit is contained in:
parent
5bc9a3737c
commit
439ebe322b
|
@ -778,7 +778,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
private final String languageCode = Language.getStandardLanguageCode(getLanguage(languageName).getName());
|
private final String languageCode = Language.getStandardLanguageCode(getLanguage(languageName).getName());
|
||||||
|
|
||||||
public boolean matchesLanguageCode(File f) {
|
public boolean matchesLanguageCode(File f) {
|
||||||
Locale languageSuffix = MediaDetection.releaseInfo.getLanguageTag(FileUtilities.getName(f));
|
Locale languageSuffix = MediaDetection.releaseInfo.getSubtitleLanguageTag(FileUtilities.getName(f));
|
||||||
Language language = Language.getLanguage(languageSuffix);
|
Language language = Language.getLanguage(languageSuffix);
|
||||||
if (language != null) {
|
if (language != null) {
|
||||||
return language.getISO3().equalsIgnoreCase(languageCode);
|
return language.getISO3().equalsIgnoreCase(languageCode);
|
||||||
|
|
|
@ -539,7 +539,7 @@ public class MediaBindingBean {
|
||||||
|
|
||||||
@Define("lang")
|
@Define("lang")
|
||||||
public Language getLanguageTag() throws Exception {
|
public Language getLanguageTag() throws Exception {
|
||||||
Locale languageSuffix = releaseInfo.getLanguageTag(FileUtilities.getName(getMediaFile()), getOriginalFileName(getMediaFile()));
|
Locale languageSuffix = releaseInfo.getSubtitleLanguageTag(FileUtilities.getName(getMediaFile()), getOriginalFileName(getMediaFile()));
|
||||||
if (languageSuffix != null) {
|
if (languageSuffix != null) {
|
||||||
return Language.getLanguage(languageSuffix);
|
return Language.getLanguage(languageSuffix);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class MediaDetection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Locale guessLanguageFromSuffix(File file) {
|
public static Locale guessLanguageFromSuffix(File file) {
|
||||||
return releaseInfo.getLanguageTag(getName(file));
|
return releaseInfo.getSubtitleLanguageTag(getName(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final SeasonEpisodeMatcher seasonEpisodeMatcherStrict = new SmartSeasonEpisodeMatcher(SeasonEpisodeMatcher.DEFAULT_SANITY, true);
|
private static final SeasonEpisodeMatcher seasonEpisodeMatcherStrict = new SmartSeasonEpisodeMatcher(SeasonEpisodeMatcher.DEFAULT_SANITY, true);
|
||||||
|
@ -1089,7 +1089,7 @@ public class MediaDetection {
|
||||||
|
|
||||||
// allow extended extensions for subtitles files, for example name.eng.srt => map by en.srt
|
// allow extended extensions for subtitles files, for example name.eng.srt => map by en.srt
|
||||||
if (key != null && SUBTITLE_FILES.accept(file)) {
|
if (key != null && SUBTITLE_FILES.accept(file)) {
|
||||||
Locale locale = releaseInfo.getLanguageTag(getName(file));
|
Locale locale = releaseInfo.getSubtitleLanguageTag(getName(file));
|
||||||
if (locale != null) {
|
if (locale != null) {
|
||||||
key = locale.getLanguage() + '.' + key;
|
key = locale.getLanguage() + '.' + key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class ReleaseInfo {
|
||||||
|
|
||||||
private Pattern languageTag;
|
private Pattern languageTag;
|
||||||
|
|
||||||
public Locale getLanguageTag(CharSequence... name) {
|
public Locale getSubtitleLanguageTag(CharSequence... name) {
|
||||||
// match locale identifier and lookup Locale object
|
// match locale identifier and lookup Locale object
|
||||||
if (languageTag == null) {
|
if (languageTag == null) {
|
||||||
languageTag = getSubtitleLanguageTagPattern(getDefaultLanguageMap().keySet());
|
languageTag = getSubtitleLanguageTagPattern(getDefaultLanguageMap().keySet());
|
||||||
|
|
Loading…
Reference in New Issue