don't split artists by commas

pull/702/head
Luke Pulverenti 11 years ago
parent 9566876da4
commit 6d099c63d8

@ -114,7 +114,7 @@ namespace MediaBrowser.Providers.MediaInfo
if (!string.IsNullOrWhiteSpace(composer))
{
foreach (var person in Split(composer))
foreach (var person in Split(composer, true))
{
audio.AddPerson(new PersonInfo { Name = person, Type = PersonType.Composer });
}
@ -131,7 +131,7 @@ namespace MediaBrowser.Providers.MediaInfo
}
else
{
audio.Artists = Split(artist)
audio.Artists = Split(artist, false)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
@ -181,12 +181,13 @@ namespace MediaBrowser.Providers.MediaInfo
/// Splits the specified val.
/// </summary>
/// <param name="val">The val.</param>
/// <param name="allowSplitByComma">if set to <c>true</c> [allow split by comma].</param>
/// <returns>System.String[][].</returns>
private IEnumerable<string> Split(string val)
private IEnumerable<string> Split(string val, bool allowSplitByComma)
{
// 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 = _nameDelimiters.Any(i => val.IndexOf(i) != -1) ? _nameDelimiters : new[] { ',' };
var delimeter = allowSplitByComma ? (_nameDelimiters.Any(i => val.IndexOf(i) != -1) ? _nameDelimiters : new[] { ',' }) : _nameDelimiters;
return val.Split(delimeter, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
@ -206,7 +207,7 @@ namespace MediaBrowser.Providers.MediaInfo
if (!string.IsNullOrEmpty(val))
{
// Sometimes the artist name is listed here, account for that
var studios = Split(val).Where(i => !audio.HasArtist(i));
var studios = Split(val, true).Where(i => !audio.HasArtist(i));
foreach (var studio in studios)
{
@ -228,7 +229,7 @@ namespace MediaBrowser.Providers.MediaInfo
{
audio.Genres.Clear();
foreach (var genre in Split(val))
foreach (var genre in Split(val, true))
{
audio.AddGenre(genre);
}

Loading…
Cancel
Save