trim audio tag values

This commit is contained in:
Luke Pulverenti 2013-09-05 18:59:07 -04:00
parent e22b696d96
commit 5c908c1f05

View File

@ -116,12 +116,7 @@ namespace MediaBrowser.Providers.MediaInfo
{ {
foreach (var person in Split(composer)) foreach (var person in Split(composer))
{ {
var name = person.Trim(); audio.AddPerson(new PersonInfo { Name = person, Type = PersonType.Composer });
if (!string.IsNullOrEmpty(name))
{
audio.AddPerson(new PersonInfo { Name = name, Type = PersonType.Composer });
}
} }
} }
} }
@ -194,7 +189,8 @@ namespace MediaBrowser.Providers.MediaInfo
var delimeter = _nameDelimiters.Any(i => val.IndexOf(i) != -1) ? _nameDelimiters : new[] { ',' }; var delimeter = _nameDelimiters.Any(i => val.IndexOf(i) != -1) ? _nameDelimiters : new[] { ',' };
return val.Split(delimeter, StringSplitOptions.RemoveEmptyEntries) return val.Split(delimeter, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i)); .Where(i => !string.IsNullOrWhiteSpace(i))
.Select(i => i.Trim());
} }
/// <summary> /// <summary>
@ -210,14 +206,11 @@ namespace MediaBrowser.Providers.MediaInfo
if (!string.IsNullOrEmpty(val)) if (!string.IsNullOrEmpty(val))
{ {
// Sometimes the artist name is listed here, account for that // Sometimes the artist name is listed here, account for that
var studios = var studios = Split(val).Where(i => !audio.HasArtist(i));
Split(val)
.Where(i => !audio.HasArtist(i));
foreach (var studio in studios) foreach (var studio in studios)
{ {
// Account for sloppy tags by trimming audio.AddStudio(studio);
audio.AddStudio(studio.Trim());
} }
} }
} }
@ -235,11 +228,9 @@ namespace MediaBrowser.Providers.MediaInfo
{ {
audio.Genres.Clear(); audio.Genres.Clear();
foreach (var genre in Split(val) foreach (var genre in Split(val))
.Where(i => !string.IsNullOrWhiteSpace(i)))
{ {
// Account for sloppy tags by trimming audio.AddGenre(genre);
audio.AddGenre(genre.Trim());
} }
} }
} }