update language normalization

pull/702/head
Luke Pulverenti 8 years ago
parent 2c78e43aad
commit 35acc01e03

@ -691,17 +691,17 @@ namespace MediaBrowser.Providers.Manager
}
var orderedResults = new List<MetadataResult<TItemType>>();
var preferredLanguage = NormalizeLanguage(id.MetadataLanguage);
if (string.IsNullOrEmpty(id.MetadataLanguage))
{
orderedResults.AddRange(results);
}
else
{
// prioritize results with matching ResultLanguage
foreach (var result in results)
{
if (!string.IsNullOrEmpty(result.ResultLanguage) && result.ResultLanguage == id.MetadataLanguage && result.QueriedById)
if (!result.QueriedById)
{
break;
}
if (string.Equals(NormalizeLanguage(result.ResultLanguage), preferredLanguage, StringComparison.OrdinalIgnoreCase) && result.QueriedById)
{
orderedResults.Add(result);
}
@ -715,7 +715,6 @@ namespace MediaBrowser.Providers.Manager
orderedResults.Add(result);
}
}
}
foreach (var result in results)
{
@ -725,6 +724,15 @@ namespace MediaBrowser.Providers.Manager
return refreshResult;
}
private string NormalizeLanguage(string language)
{
if (string.IsNullOrWhiteSpace(language))
{
return "en-us";
}
return language;
}
private void MergeNewData(TItemType source, TIdType lookupInfo)
{
// Copy new provider id's that may have been obtained

Loading…
Cancel
Save