using System; using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace IF.Lastfm.Core.Objects { public class Album { #region Properties public string Name { get; set; } public IEnumerable Tracks { get; set; } public string ArtistName { get; set; } public string ArtistId { get; set; } public DateTime ReleaseDateUtc { get; set; } public int ListenerCount { get; set; } public int TotalPlayCount { get; set; } public string Mbid { get; set; } public IEnumerable TopTags { get; set; } public Uri Url { get; set; } #endregion /// /// TODO datetime parsing /// TODO images /// TODO tags /// TODO tracks /// /// /// public static Album ParseJToken(JToken token) { var a = new Album(); a.ArtistName = token.Value("artist"); a.ArtistId = token.Value("id"); a.ListenerCount = token.Value("listeners"); a.Mbid = token.Value("mbid"); a.Name = token.Value("name"); a.TotalPlayCount = token.Value("playcount"); a.Url = new Uri(token.Value("url"), UriKind.Absolute); return a; } } }