From 806b8b2fe6aa8c14704654c6bdd4737314cf8420 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Tue, 12 Mar 2013 10:09:29 -0400 Subject: [PATCH 1/2] Needed more work on #22 strip html tags from overviews --- .../Providers/Music/LastfmBaseProvider.cs | 24 ++++++++++++++++++- .../Providers/Music/LastfmHelper.cs | 10 +++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs index 26817a41c..4654a3767 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs @@ -50,6 +50,22 @@ namespace MediaBrowser.Controller.Providers.Music HttpClient = httpClient; } + protected override string ProviderVersion + { + get + { + return "3-12-13"; + } + } + + protected override bool RefreshOnVersionChange + { + get + { + return true; + } + } + /// /// Gets the json serializer. /// @@ -171,6 +187,12 @@ namespace MediaBrowser.Controller.Providers.Music return true; } + if (RefreshOnVersionChange && ProviderVersion != providerInfo.ProviderVersion) + { + Logger.Debug("LastfmProvider version change re-running for {0}", item.Path); + return true; + } + var downloadDate = providerInfo.LastRefreshed; if (ConfigurationManager.Configuration.MetadataRefreshDays == -1 && downloadDate != DateTime.MinValue) @@ -206,7 +228,7 @@ namespace MediaBrowser.Controller.Providers.Music cancellationToken.ThrowIfCancellationRequested(); - if (!ConfigurationManager.Configuration.SaveLocalMeta || !HasLocalMeta(item) || (force && !HasLocalMeta(item))) + if (!ConfigurationManager.Configuration.SaveLocalMeta || !HasLocalMeta(item) || (force && !HasLocalMeta(item)) || (RefreshOnVersionChange && item.ProviderData[Id].ProviderVersion != ProviderVersion)) { try { diff --git a/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs b/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs index 4e30319e3..13adfcb17 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs @@ -16,7 +16,15 @@ namespace MediaBrowser.Controller.Providers.Music public static void ProcessArtistData(BaseItem artist, LastfmArtist data) { - artist.Overview = data.bio != null ? data.bio.content : null; + var overview = data.bio != null ? data.bio.content : null; + + if (!string.IsNullOrEmpty(overview)) + { + overview = StripHtml(overview); + } + + artist.Overview = overview; + var yearFormed = 0; try { From 23a72fc74c991daa7b8a0e319b67aa4efa76314d Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Tue, 12 Mar 2013 10:27:37 -0400 Subject: [PATCH 2/2] Fix some date problems in lastfm providers --- MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs | 2 +- MediaBrowser.Controller/Providers/Music/LastfmHelper.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs index 4654a3767..c3ff411ef 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs @@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Providers.Music { get { - return "3-12-13"; + return "3-12-13.2"; } } diff --git a/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs b/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs index 13adfcb17..8c80b4ef1 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs @@ -39,7 +39,8 @@ namespace MediaBrowser.Controller.Providers.Music catch (OverflowException) { } - artist.PremiereDate = new DateTime(yearFormed, 1,1); + artist.PremiereDate = yearFormed > 0 ? new DateTime(yearFormed, 1,1) : DateTime.MinValue; + artist.ProductionYear = yearFormed; if (data.tags != null) { AddGenres(artist, data.tags); @@ -62,6 +63,7 @@ namespace MediaBrowser.Controller.Providers.Music var release = DateTime.MinValue; DateTime.TryParse(data.releasedate, out release); item.PremiereDate = release; + item.ProductionYear = release.Year; if (data.toptags != null) { AddGenres(item, data.toptags);