made Audio.Artist plural and removed duplicated of artists into the people collection

This commit is contained in:
Luke Pulverenti
2013-04-20 21:02:16 -04:00
parent 04030ffb65
commit 19d21a246d
14 changed files with 178 additions and 34 deletions

View File

@@ -96,11 +96,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
if (!string.IsNullOrWhiteSpace(composer))
{
// Only use the comma as a delimeter if there are no slashes or pipes.
// We want to be careful not to split names that have commas in them
var delimeter = composer.IndexOf('/') == -1 && composer.IndexOf('|') == -1 ? new[] { ',' } : new[] { '/', '|' };
foreach (var person in composer.Split(delimeter, StringSplitOptions.RemoveEmptyEntries))
foreach (var person in Split(composer))
{
var name = person.Trim();
@@ -112,12 +108,19 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
}
audio.Album = GetDictionaryValue(tags, "album");
audio.Artist = GetDictionaryValue(tags, "artist");
if (!string.IsNullOrWhiteSpace(audio.Artist))
var artists = GetDictionaryValue(tags, "artist");
if (!string.IsNullOrWhiteSpace(artists))
{
// Add to people too
audio.AddPerson(new PersonInfo {Name = audio.Artist, Type = PersonType.MusicArtist});
foreach (var artist in Split(artists))
{
var name = artist.Trim();
if (!string.IsNullOrEmpty(name))
{
audio.AddArtist(name);
}
}
}
// Several different forms of albumartist
@@ -150,6 +153,20 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
FetchStudios(audio, tags, "publisher");
}
/// <summary>
/// Splits the specified val.
/// </summary>
/// <param name="val">The val.</param>
/// <returns>System.String[][].</returns>
private string[] Split(string val)
{
// Only use the comma as a delimeter if there are no slashes or pipes.
// We want to be careful not to split names that have commas in them
var delimeter = val.IndexOf('/') == -1 && val.IndexOf('|') == -1 ? new[] { ',' } : new[] { '/', '|' };
return val.Split(delimeter, StringSplitOptions.RemoveEmptyEntries);
}
/// <summary>
/// Gets the studios from the tags collection
/// </summary>