cache MusicBrainzReleaseGroupId

pull/702/head
Luke Pulverenti 12 years ago
parent 19a95edf58
commit b79840e20f

@ -150,6 +150,10 @@ namespace MediaBrowser.Controller.Entities.Audio
return RecursiveChildren.OfType<Audio>().Any(i => i.HasArtist(artist));
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
@ -164,6 +168,10 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
/// <summary>
/// Gets or sets the display type of the media.
/// </summary>
/// <value>The display type of the media.</value>
public override string DisplayMediaType
{
get
@ -175,5 +183,11 @@ namespace MediaBrowser.Controller.Entities.Audio
base.DisplayMediaType = value;
}
}
/// <summary>
/// Gets or sets the music brainz release group id.
/// </summary>
/// <value>The music brainz release group id.</value>
public string MusicBrainzReleaseGroupId { get; set; }
}
}

@ -116,16 +116,22 @@ namespace MediaBrowser.Controller.Providers.Music
{
cancellationToken.ThrowIfCancellationRequested();
var releaseGroupId = await GetReleaseGroupId(item.GetProviderId(MetadataProviders.Musicbrainz), cancellationToken).ConfigureAwait(false);
var album = (MusicAlbum)item;
if (string.IsNullOrEmpty(releaseGroupId))
if (string.IsNullOrEmpty(album.MusicBrainzReleaseGroupId))
{
album.MusicBrainzReleaseGroupId = await GetReleaseGroupId(item.GetProviderId(MetadataProviders.Musicbrainz), cancellationToken).ConfigureAwait(false);
}
// If still empty there's nothing more we can do
if (string.IsNullOrEmpty(album.MusicBrainzReleaseGroupId))
{
SetLastRefreshed(item, DateTime.UtcNow);
return true;
}
var url = string.Format("http://api.fanart.tv/webservice/album/{0}/{1}/xml/all/1/1", APIKey, releaseGroupId);
var url = string.Format("http://api.fanart.tv/webservice/album/{0}/{1}/xml/all/1/1", APIKey, album.MusicBrainzReleaseGroupId);
var doc = new XmlDocument();

Loading…
Cancel
Save