private void ProcessArtistData(MusicArtist artist, LastfmArtist data, string musicBrainzId) { var yearFormed = 0; if (data.bio != null) { Int32.TryParse(data.bio.yearformed, out yearFormed); if (!artist.LockedFields.Contains(MetadataFields.Overview)) { artist.Overview = (data.bio.content ?? string.Empty).StripHtml(); } if (!string.IsNullOrEmpty(data.bio.placeformed) && !artist.LockedFields.Contains(MetadataFields.ProductionLocations)) { artist.ProductionLocations = new[] { data.bio.placeformed }; } } if (yearFormed > 0) { artist.PremiereDate = new DateTime(yearFormed, 1, 1, 0, 0, 0, DateTimeKind.Utc); artist.ProductionYear = yearFormed; } string imageSize; var url = LastfmHelper.GetImageUrl(data, out imageSize); if (!string.IsNullOrEmpty(musicBrainzId) && !string.IsNullOrEmpty(url)) { try { LastfmHelper.SaveImageInfo(_config.ApplicationPaths, musicBrainzId, url, imageSize); } catch (Exception e) { _logger.LogError("Failed to save image information {0}", e); } } }
private void ProcessArtistData(MusicArtist artist, LastfmArtist data, string musicBrainzId) { var yearFormed = 0; if (data.bio != null) { Int32.TryParse(data.bio.yearformed, out yearFormed); if (!artist.LockedFields.Contains(MetadataField.Overview)) { artist.Overview = (data.bio.content ?? string.Empty).StripHtml(); } if (!string.IsNullOrEmpty(data.bio.placeformed) && !artist.LockedFields.Contains(MetadataField.ProductionLocations)) { artist.ProductionLocations = new[] { data.bio.placeformed }; } } if (yearFormed > 0) { artist.PremiereDate = new DateTime(yearFormed, 1, 1, 0, 0, 0, DateTimeKind.Utc); artist.ProductionYear = yearFormed; } }