private void Update(Responses.Status status) { if (status == null || status.track == null || status.track.track_resource == null) { return; } if (_spotifyStatus == null) { _spotifyStatus = new SpotifyStatus(); } if ((_spotifyStatus.Uri ?? "") == status.track.track_resource.uri) { return; } _spotifyStatus.Uri = status.track.track_resource.uri; _spotifyStatus.Artist = status.track.artist_resource.name; _spotifyStatus.Album = status.track.album_resource.name; _spotifyStatus.Track = status.track.track_resource.name; _statusModel.UpdateSongInfo(_spotifyStatus); //TODO: Send _spotifyStatus as json to webservice var data = JsonConvert.SerializeObject(_spotifyStatus); if (!Settings.Default.UrlEncoded) { WebClientHelper.DoAsyncJsonRequest(Settings.Default.ScrobbleUrl, data); } else { WebClientHelper.DoAsyncUrlEncodedRequest(Settings.Default.ScrobbleUrl, data); } }
public void UpdateSongInfo(Resources.SpotifyStatus spotifyStatus) { if (spotifyStatus == null) { return; } SongInfo = string.Format("Scrobbling: {0} - {1}", spotifyStatus.Artist, spotifyStatus.Track); }
private void StartScrobble() { _spotifyStatus = null; _timer.Start(); BtnStartScrobble.IsEnabled = false; BtnStopScrobble.IsEnabled = true; _statusModel.SongInfo = "Scrobbling: waiting for songinfo"; }