support audio db language choice

This commit is contained in:
Luke Pulverenti 2016-08-04 12:39:19 -04:00
parent 329ec93499
commit be6e9b2957
2 changed files with 96 additions and 31 deletions

View File

@ -61,14 +61,14 @@ namespace MediaBrowser.Providers.Music
{
result.Item = new MusicAlbum();
result.HasMetadata = true;
ProcessResult(result.Item, obj.album[0]);
ProcessResult(result.Item, obj.album[0], info.MetadataLanguage);
}
}
return result;
}
private void ProcessResult(MusicAlbum item, Album result)
private void ProcessResult(MusicAlbum item, Album result, string preferredLanguage)
{
if (!string.IsNullOrWhiteSpace(result.strArtist))
{
@ -91,7 +91,39 @@ namespace MediaBrowser.Providers.Music
item.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, result.strMusicBrainzArtistID);
item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, result.strMusicBrainzID);
item.Overview = (result.strDescriptionEN ?? string.Empty).StripHtml();
string overview = null;
if (string.Equals(preferredLanguage, "de", StringComparison.OrdinalIgnoreCase))
{
overview = result.strDescriptionDE;
}
else if (string.Equals(preferredLanguage, "fr", StringComparison.OrdinalIgnoreCase))
{
overview = result.strDescriptionFR;
}
else if (string.Equals(preferredLanguage, "nl", StringComparison.OrdinalIgnoreCase))
{
overview = result.strDescriptionNL;
}
else if (string.Equals(preferredLanguage, "ru", StringComparison.OrdinalIgnoreCase))
{
overview = result.strDescriptionRU;
}
else if (string.Equals(preferredLanguage, "it", StringComparison.OrdinalIgnoreCase))
{
overview = result.strDescriptionIT;
}
else if ((preferredLanguage ?? string.Empty).StartsWith("pt", StringComparison.OrdinalIgnoreCase))
{
overview = result.strDescriptionPT;
}
if (string.IsNullOrWhiteSpace(overview))
{
overview = result.strDescriptionEN;
}
item.Overview = (overview ?? string.Empty).StripHtml();
}
public string Name
@ -186,20 +218,20 @@ namespace MediaBrowser.Providers.Music
public string strAlbumThumb { get; set; }
public string strAlbumCDart { get; set; }
public string strDescriptionEN { get; set; }
public object strDescriptionDE { get; set; }
public object strDescriptionFR { get; set; }
public object strDescriptionCN { get; set; }
public object strDescriptionIT { get; set; }
public object strDescriptionJP { get; set; }
public object strDescriptionRU { get; set; }
public object strDescriptionES { get; set; }
public object strDescriptionPT { get; set; }
public object strDescriptionSE { get; set; }
public object strDescriptionNL { get; set; }
public object strDescriptionHU { get; set; }
public object strDescriptionNO { get; set; }
public object strDescriptionIL { get; set; }
public object strDescriptionPL { get; set; }
public string strDescriptionDE { get; set; }
public string strDescriptionFR { get; set; }
public string strDescriptionCN { get; set; }
public string strDescriptionIT { get; set; }
public string strDescriptionJP { get; set; }
public string strDescriptionRU { get; set; }
public string strDescriptionES { get; set; }
public string strDescriptionPT { get; set; }
public string strDescriptionSE { get; set; }
public string strDescriptionNL { get; set; }
public string strDescriptionHU { get; set; }
public string strDescriptionNO { get; set; }
public string strDescriptionIL { get; set; }
public string strDescriptionPL { get; set; }
public object intLoved { get; set; }
public object intScore { get; set; }
public string strReview { get; set; }

View File

@ -61,17 +61,16 @@ namespace MediaBrowser.Providers.Music
{
result.Item = new MusicArtist();
result.HasMetadata = true;
ProcessResult(result.Item, obj.artists[0]);
ProcessResult(result.Item, obj.artists[0], info.MetadataLanguage);
}
}
return result;
}
private void ProcessResult(MusicArtist item, Artist result)
private void ProcessResult(MusicArtist item, Artist result, string preferredLanguage)
{
item.HomePageUrl = result.strWebsite;
item.Overview = (result.strBiographyEN ?? string.Empty).StripHtml();
if (!string.IsNullOrEmpty(result.strGenre))
{
@ -80,6 +79,40 @@ namespace MediaBrowser.Providers.Music
item.SetProviderId(MetadataProviders.AudioDbArtist, result.idArtist);
item.SetProviderId(MetadataProviders.MusicBrainzArtist, result.strMusicBrainzID);
string overview = null;
if (string.Equals(preferredLanguage, "de", StringComparison.OrdinalIgnoreCase))
{
overview = result.strBiographyDE;
}
else if (string.Equals(preferredLanguage, "fr", StringComparison.OrdinalIgnoreCase))
{
overview = result.strBiographyFR;
}
else if (string.Equals(preferredLanguage, "nl", StringComparison.OrdinalIgnoreCase))
{
overview = result.strBiographyNL;
}
else if (string.Equals(preferredLanguage, "ru", StringComparison.OrdinalIgnoreCase))
{
overview = result.strBiographyRU;
}
else if (string.Equals(preferredLanguage, "it", StringComparison.OrdinalIgnoreCase))
{
overview = result.strBiographyIT;
}
else if ((preferredLanguage ?? string.Empty).StartsWith("pt", StringComparison.OrdinalIgnoreCase))
{
overview = result.strBiographyPT;
}
if (string.IsNullOrWhiteSpace(overview))
{
overview = result.strBiographyEN;
}
item.Overview = (overview ?? string.Empty).StripHtml();
}
public string Name
@ -180,18 +213,18 @@ namespace MediaBrowser.Providers.Music
public string strBiographyEN { get; set; }
public string strBiographyDE { get; set; }
public string strBiographyFR { get; set; }
public object strBiographyCN { get; set; }
public string strBiographyCN { get; set; }
public string strBiographyIT { get; set; }
public object strBiographyJP { get; set; }
public object strBiographyRU { get; set; }
public object strBiographyES { get; set; }
public object strBiographyPT { get; set; }
public object strBiographySE { get; set; }
public object strBiographyNL { get; set; }
public object strBiographyHU { get; set; }
public object strBiographyNO { get; set; }
public object strBiographyIL { get; set; }
public object strBiographyPL { get; set; }
public string strBiographyJP { get; set; }
public string strBiographyRU { get; set; }
public string strBiographyES { get; set; }
public string strBiographyPT { get; set; }
public string strBiographySE { get; set; }
public string strBiographyNL { get; set; }
public string strBiographyHU { get; set; }
public string strBiographyNO { get; set; }
public string strBiographyIL { get; set; }
public string strBiographyPL { get; set; }
public string strGender { get; set; }
public string intMembers { get; set; }
public string strCountry { get; set; }