update language normalization
This commit is contained in:
parent
2c78e43aad
commit
35acc01e03
|
@ -691,29 +691,28 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
var orderedResults = new List<MetadataResult<TItemType>>();
|
var orderedResults = new List<MetadataResult<TItemType>>();
|
||||||
|
var preferredLanguage = NormalizeLanguage(id.MetadataLanguage);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(id.MetadataLanguage))
|
// prioritize results with matching ResultLanguage
|
||||||
|
foreach (var result in results)
|
||||||
{
|
{
|
||||||
orderedResults.AddRange(results);
|
if (!result.QueriedById)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// prioritize results with matching ResultLanguage
|
|
||||||
foreach (var result in results)
|
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(result.ResultLanguage) && result.ResultLanguage == id.MetadataLanguage && result.QueriedById)
|
break;
|
||||||
{
|
|
||||||
orderedResults.Add(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all other results
|
if (string.Equals(NormalizeLanguage(result.ResultLanguage), preferredLanguage, StringComparison.OrdinalIgnoreCase) && result.QueriedById)
|
||||||
foreach (var result in results)
|
|
||||||
{
|
{
|
||||||
if (!orderedResults.Contains(result))
|
orderedResults.Add(result);
|
||||||
{
|
}
|
||||||
orderedResults.Add(result);
|
}
|
||||||
}
|
|
||||||
|
// add all other results
|
||||||
|
foreach (var result in results)
|
||||||
|
{
|
||||||
|
if (!orderedResults.Contains(result))
|
||||||
|
{
|
||||||
|
orderedResults.Add(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -725,6 +724,15 @@ namespace MediaBrowser.Providers.Manager
|
||||||
return refreshResult;
|
return refreshResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string NormalizeLanguage(string language)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(language))
|
||||||
|
{
|
||||||
|
return "en-us";
|
||||||
|
}
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
private void MergeNewData(TItemType source, TIdType lookupInfo)
|
private void MergeNewData(TItemType source, TIdType lookupInfo)
|
||||||
{
|
{
|
||||||
// Copy new provider id's that may have been obtained
|
// Copy new provider id's that may have been obtained
|
||||||
|
|
Loading…
Reference in New Issue
Block a user