public async Task <bool> SendTrackLoveAsync(PlayableTrack track, bool love) { bool isSuccess = false; // We can't send track love for an unknown track if (track.ArtistName == Defaults.UnknownArtistText | string.IsNullOrEmpty(track.TrackTitle)) { return(false); } if (this.SignInState == SignInState.SignedIn) { if (love) { try { isSuccess = await LastfmApi.TrackLove(this.sessionKey, track.ArtistName, track.TrackTitle); } catch (Exception ex) { LogClient.Error("Could not send track.love to Last.fm. Exception: {0}", ex.Message); } } else { try { isSuccess = await LastfmApi.TrackUnlove(this.sessionKey, track.ArtistName, track.TrackTitle); } catch (Exception ex) { LogClient.Error("Could not send track.unlove to Last.fm. Exception: {0}", ex.Message); } } } return(isSuccess); }
public async Task SendTrackLoveAsync(TrackViewModel track, bool love) { // We can't send track love for an unknown track if (string.IsNullOrEmpty(track.TrackTitle)) { return; } if (this.SignInState == SignInState.SignedIn) { foreach (string artist in DataUtils.SplitAndTrimColumnMultiValue(track.Track.Artists)) { if (love) { try { await LastfmApi.TrackLove(this.sessionKey, artist, track.TrackTitle); } catch (Exception ex) { LogClient.Error("Could not send track.love to Last.fm. Exception: {0}", ex.Message); } } else { try { await LastfmApi.TrackUnlove(this.sessionKey, artist, track.TrackTitle); } catch (Exception ex) { LogClient.Error("Could not send track.unlove to Last.fm. Exception: {0}", ex.Message); } } } } }