From e036b2c416f9b6655ed668701a7aeb63653e4e23 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 21 May 2013 12:53:03 -0400 Subject: [PATCH] verify last fm data a little better --- .../Providers/Music/FanArtAlbumProvider.cs | 2 +- .../Providers/Music/LastfmArtistProvider.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs index 1744e96e63..5364ce541d 100644 --- a/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs @@ -220,7 +220,7 @@ namespace MediaBrowser.Controller.Providers.Music { Url = url, CancellationToken = cancellationToken, - UserAgent = "MediaBrowserServer/www.mediabrowser3.com", + UserAgent = Environment.MachineName + "-" + Environment.UserName, EnableResponseCache = true }).ConfigureAwait(false)) diff --git a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs index ed2a09a4ff..8461b84bbf 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs @@ -117,8 +117,13 @@ namespace MediaBrowser.Controller.Providers.Music if (searchResult != null && searchResult.results != null && searchResult.results.artistmatches != null && searchResult.results.artistmatches.artist.Count > 0) { - var artist = searchResult.results.artistmatches.artist.FirstOrDefault(i => i.name != null && string.Compare(i.name, item.Name, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) == 0) ?? - searchResult.results.artistmatches.artist.First(); + var artist = searchResult.results.artistmatches.artist + .FirstOrDefault(i => i.name != null && string.Compare(i.name, item.Name, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols) == 0); + + if (artist == null) + { + return null; + } return artist.mbid; }