fixes #283 - LastFM Album Fetcher? imports strange genres

This commit is contained in:
Luke Pulverenti 2013-05-17 11:22:08 -04:00
parent b0c484e160
commit 58a5ad852b

View File

@ -2,6 +2,7 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Entities;
using System;
using System.Linq;
namespace MediaBrowser.Controller.Providers.Music
{
@ -30,7 +31,7 @@ namespace MediaBrowser.Controller.Providers.Music
artist.ProductionYear = yearFormed;
if (data.tags != null)
{
AddGenres(artist, data.tags);
AddTags(artist, data.tags);
}
var entity = artist as Artist;
@ -55,21 +56,15 @@ namespace MediaBrowser.Controller.Providers.Music
item.ProductionYear = release.Year;
if (data.toptags != null)
{
AddGenres(item, data.toptags);
AddTags(item, data.toptags);
}
}
private static void AddGenres(BaseItem item, LastfmTags tags)
private static void AddTags(BaseItem item, LastfmTags tags)
{
item.Genres.Clear();
var itemTags = (from tag in tags.tag where !string.IsNullOrEmpty(tag.name) select tag.name).ToList();
foreach (var tag in tags.tag)
{
if (!string.IsNullOrEmpty(tag.name))
{
item.AddGenre(tag.name);
}
}
item.Tags = itemTags;
}
}
}