fixes #283 - LastFM Album Fetcher? imports strange genres

pull/702/head
Luke Pulverenti 12 years ago
parent b0c484e160
commit 58a5ad852b

@ -2,6 +2,7 @@
using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using System; using System;
using System.Linq;
namespace MediaBrowser.Controller.Providers.Music namespace MediaBrowser.Controller.Providers.Music
{ {
@ -30,7 +31,7 @@ namespace MediaBrowser.Controller.Providers.Music
artist.ProductionYear = yearFormed; artist.ProductionYear = yearFormed;
if (data.tags != null) if (data.tags != null)
{ {
AddGenres(artist, data.tags); AddTags(artist, data.tags);
} }
var entity = artist as Artist; var entity = artist as Artist;
@ -55,21 +56,15 @@ namespace MediaBrowser.Controller.Providers.Music
item.ProductionYear = release.Year; item.ProductionYear = release.Year;
if (data.toptags != null) 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) item.Tags = itemTags;
{
if (!string.IsNullOrEmpty(tag.name))
{
item.AddGenre(tag.name);
}
}
} }
} }
} }

Loading…
Cancel
Save