mirror of
https://github.com/Sarsoo/IF.Lastfm.git
synced 2024-10-17 07:13:09 +01:00
Exposing track.isnowplaying property
Probably more reliable than testing if datetime is null
This commit is contained in:
parent
f342bd0757
commit
ab9f873342
@ -29,6 +29,7 @@ public class Track : ILastFmObject
|
||||
|
||||
public DateTime? TimePlayed { get; set; }
|
||||
public bool? IsLoved { get; set; }
|
||||
public bool? IsNowPlaying { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -85,6 +86,12 @@ internal static Track ParseJToken(JToken token)
|
||||
t.IsLoved = Convert.ToBoolean(lovedToken.Value<int>());
|
||||
}
|
||||
|
||||
var attrToken = token.SelectToken("@attr");
|
||||
if (attrToken != null && attrToken.HasValues)
|
||||
{
|
||||
t.IsNowPlaying = attrToken.Value<bool>("nowplaying");
|
||||
}
|
||||
|
||||
// api returns milliseconds when track.getInfo is called directly
|
||||
var secs = token.Value<double>("duration");
|
||||
if (Math.Abs(secs - default(double)) > double.Epsilon)
|
||||
|
Loading…
Reference in New Issue
Block a user