修复外部输入文件language code丢失问题
This commit is contained in:
parent
ef94ab0adf
commit
6cc466f8a3
|
@ -514,11 +514,9 @@ sr;srp
|
||||||
/// <param name="outputFile"></param>
|
/// <param name="outputFile"></param>
|
||||||
public static void ConvertLangCodeAndDisplayName(OutputFile outputFile)
|
public static void ConvertLangCodeAndDisplayName(OutputFile outputFile)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(outputFile.LangCode) || outputFile.MediaType == null) return;
|
if (string.IsNullOrEmpty(outputFile.LangCode)) return;
|
||||||
var originalLangCode = outputFile.LangCode;
|
var originalLangCode = outputFile.LangCode;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(outputFile.Description))
|
|
||||||
{
|
|
||||||
//先直接查找
|
//先直接查找
|
||||||
var lang = ALL_LANGS.FirstOrDefault(a => a.ExtendCode.Equals(outputFile.LangCode, StringComparison.OrdinalIgnoreCase) || a.Code.Equals(outputFile.LangCode, StringComparison.OrdinalIgnoreCase));
|
var lang = ALL_LANGS.FirstOrDefault(a => a.ExtendCode.Equals(outputFile.LangCode, StringComparison.OrdinalIgnoreCase) || a.Code.Equals(outputFile.LangCode, StringComparison.OrdinalIgnoreCase));
|
||||||
//处理特殊的扩展语言标记
|
//处理特殊的扩展语言标记
|
||||||
|
@ -532,13 +530,13 @@ sr;srp
|
||||||
if (lang != null)
|
if (lang != null)
|
||||||
{
|
{
|
||||||
outputFile.LangCode = lang.Code;
|
outputFile.LangCode = lang.Code;
|
||||||
|
if (string.IsNullOrEmpty(outputFile.Description))
|
||||||
outputFile.Description = outputFile.MediaType == Common.Enum.MediaType.SUBTITLES ? lang.Description : lang.DescriptionAudio;
|
outputFile.Description = outputFile.MediaType == Common.Enum.MediaType.SUBTITLES ? lang.Description : lang.DescriptionAudio;
|
||||||
}
|
}
|
||||||
else
|
else if (outputFile.LangCode == null)
|
||||||
{
|
{
|
||||||
outputFile.LangCode = "und"; //无法识别直接置为und
|
outputFile.LangCode = "und"; //无法识别直接置为und
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//无描述,则把LangCode当作描述
|
//无描述,则把LangCode当作描述
|
||||||
if (string.IsNullOrEmpty(outputFile.Description)) outputFile.Description = originalLangCode;
|
if (string.IsNullOrEmpty(outputFile.Description)) outputFile.Description = originalLangCode;
|
||||||
|
|
Loading…
Reference in New Issue