Added ILastFmObject interface to simplify some object management scenarios. YEAH

Also added ArtistMbid property to Track.cs
This commit is contained in:
Rikki Tooley 2013-07-04 22:08:44 +01:00
parent 08411cd7ac
commit 6c3e6d25ac
6 changed files with 14 additions and 5 deletions

View File

@ -70,6 +70,7 @@
<Compile Include="Objects\Artist.cs" /> <Compile Include="Objects\Artist.cs" />
<Compile Include="Objects\BuyLink.cs" /> <Compile Include="Objects\BuyLink.cs" />
<Compile Include="Objects\CountryCode.cs" /> <Compile Include="Objects\CountryCode.cs" />
<Compile Include="Objects\ILastFmObject.cs" />
<Compile Include="Objects\LastImageCollection.cs" /> <Compile Include="Objects\LastImageCollection.cs" />
<Compile Include="Objects\Shout.cs" /> <Compile Include="Objects\Shout.cs" />
<Compile Include="Objects\Station.cs" /> <Compile Include="Objects\Station.cs" />

View File

@ -6,7 +6,7 @@
namespace IF.Lastfm.Core.Objects namespace IF.Lastfm.Core.Objects
{ {
public class Album public class Album : ILastFmObject
{ {
#region Properties #region Properties

View File

@ -10,7 +10,7 @@ namespace IF.Lastfm.Core.Objects
/// <summary> /// <summary>
/// Todo bio, tour, similar, stats, streamable /// Todo bio, tour, similar, stats, streamable
/// </summary> /// </summary>
public class Artist public class Artist : ILastFmObject
{ {
#region Properties #region Properties

View File

@ -0,0 +1,7 @@
namespace IF.Lastfm.Core.Objects
{
public interface ILastFmObject
{
}
}

View File

@ -3,8 +3,7 @@
namespace IF.Lastfm.Core.Objects namespace IF.Lastfm.Core.Objects
{ {
public class Station : ILastFmObject
public class Station
{ {
public string Name { get; set; } public string Name { get; set; }
public Uri Url { get; set; } public Uri Url { get; set; }

View File

@ -9,7 +9,7 @@ namespace IF.Lastfm.Core.Objects
/// <summary> /// <summary>
/// TODO Wiki, Stream availability /// TODO Wiki, Stream availability
/// </summary> /// </summary>
public class Track public class Track : ILastFmObject
{ {
#region Properties #region Properties
@ -17,6 +17,7 @@ public class Track
public TimeSpan Duration { get; set; } public TimeSpan Duration { get; set; }
public string Mbid { get; set; } public string Mbid { get; set; }
public string ArtistName { get; set; } public string ArtistName { get; set; }
public string ArtistMbid { get; set; }
public Uri Url { get; set; } public Uri Url { get; set; }
public LastImageCollection Images { get; set; } public LastImageCollection Images { get; set; }
@ -48,6 +49,7 @@ internal static Track ParseJToken(JToken token)
if (artistToken != null) if (artistToken != null)
{ {
t.ArtistName = Artist.GetNameFromJToken(artistToken); t.ArtistName = Artist.GetNameFromJToken(artistToken);
t.ArtistMbid = artistToken.Value<string>("mbid");
} }
var albumToken = token.SelectToken("album"); var albumToken = token.SelectToken("album");