This commit is contained in:
LukePulverenti 2013-03-12 11:18:00 -04:00
commit 33c8de1ecd
2 changed files with 35 additions and 3 deletions

View File

@ -50,6 +50,22 @@ namespace MediaBrowser.Controller.Providers.Music
HttpClient = httpClient; HttpClient = httpClient;
} }
protected override string ProviderVersion
{
get
{
return "3-12-13.2";
}
}
protected override bool RefreshOnVersionChange
{
get
{
return true;
}
}
/// <summary> /// <summary>
/// Gets the json serializer. /// Gets the json serializer.
/// </summary> /// </summary>
@ -171,6 +187,12 @@ namespace MediaBrowser.Controller.Providers.Music
return true; return true;
} }
if (RefreshOnVersionChange && ProviderVersion != providerInfo.ProviderVersion)
{
Logger.Debug("LastfmProvider version change re-running for {0}", item.Path);
return true;
}
var downloadDate = providerInfo.LastRefreshed; var downloadDate = providerInfo.LastRefreshed;
if (ConfigurationManager.Configuration.MetadataRefreshDays == -1 && downloadDate != DateTime.MinValue) if (ConfigurationManager.Configuration.MetadataRefreshDays == -1 && downloadDate != DateTime.MinValue)
@ -206,7 +228,7 @@ namespace MediaBrowser.Controller.Providers.Music
cancellationToken.ThrowIfCancellationRequested(); 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 try
{ {

View File

@ -16,7 +16,15 @@ namespace MediaBrowser.Controller.Providers.Music
public static void ProcessArtistData(BaseItem artist, LastfmArtist data) 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; var yearFormed = 0;
try try
{ {
@ -31,7 +39,8 @@ namespace MediaBrowser.Controller.Providers.Music
catch (OverflowException) 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) if (data.tags != null)
{ {
AddGenres(artist, data.tags); AddGenres(artist, data.tags);
@ -54,6 +63,7 @@ namespace MediaBrowser.Controller.Providers.Music
var release = DateTime.MinValue; var release = DateTime.MinValue;
DateTime.TryParse(data.releasedate, out release); DateTime.TryParse(data.releasedate, out release);
item.PremiereDate = release; item.PremiereDate = release;
item.ProductionYear = release.Year;
if (data.toptags != null) if (data.toptags != null)
{ {
AddGenres(item, data.toptags); AddGenres(item, data.toptags);