public void RunAfterPlayCountUp(int rating) { if (_scrobbler == null) { return; } _scrobbler.Scrobble(CurrentTrack); if (rating == 9) { _scrobbler.Love(CurrentTrack); } else { _scrobbler.UnLove(CurrentTrack); } }
public void LoveTrackOnLastFM(DateTime whenStartedPlaying, Domain.Objects.Track info, bool love) { Console.WriteLine("Love/unlove track on last FM"); if (System.Diagnostics.Debugger.IsAttached) { return; } lock (scrobbler) // make sure no requests are run at the same time { var track = GetLastFmTrackFromAudioInfo(info); track.WhenStartedPlaying = whenStartedPlaying; var response = love ? scrobbler.Love(track) : scrobbler.UnLove(track); if (response.ErrorCode > 0) { Console.Error.WriteLine("Unable to love track " + info.Artists.FirstOrDefault() + " - " + info.Title + " on Last FM" + ": " + response.Exception.Message); throw response.Exception; } } }