//Removes current playing song then adds to play history. private Song DequeueToHistory(PlayOperation operationType) { if (_playlist.Count > 0) { var song = _playlist.Dequeue(); _history.AddSong(song, operationType); if (_playlist.Count == 1) { PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.PlayingLast, CurrentChannel, CurrentSong); var resp = request.GetResponse(); ExtractPlaylist(resp, false); } return(song); } else { return(null); } }
/// <summary> /// Indicates user unmark current song as a liked-song. /// </summary> public void Unlike() { PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.Unlike, CurrentChannel, CurrentSong); request.GetResponse(); }
/// <summary> /// Gets a new playlist. /// </summary> public void NewList() { PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.NewList, CurrentChannel, null); var resp = request.GetResponse(); ExtractPlaylist(resp, true); }
/// <summary> /// Notifies server that current song plays to end, then play next song. /// </summary> public void Next() { var song = DequeueToHistory(PlayOperation.PlaysToEnd); PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.PlaysToEnd, CurrentChannel, song); request.GetResponse(); }
/// <summary> /// Indicates do not play current song any more. /// </summary> public void PlayNoMore() { var song = DequeueToHistory(PlayOperation.Bin); PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.Bin, CurrentChannel, song); var resp = request.GetResponse(); ExtractPlaylist(resp, true); }
/// <summary> /// Switches to another channel, playlist will be updated. /// </summary> /// <param name="newChannel"></param> public void SwitchChannel(Channel newChannel) { var song = DequeueToHistory(PlayOperation.Skip); CurrentChannel = newChannel; PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.Skip, CurrentChannel, song); var resp = request.GetResponse(); ExtractPlaylist(resp, true); }
//Removes current playing song then adds to play history. private Song DequeueToHistory(PlayOperation operationType) { if (_playlist.Count > 0) { var song = _playlist.Dequeue(); _history.AddSong(song, operationType); if (_playlist.Count == 1) { PlaylistRequest request = new PlaylistRequest( _status, _history, PlayOperation.PlayingLast, CurrentChannel, CurrentSong); var resp = request.GetResponse(); ExtractPlaylist(resp, false); } return song; } else { return null; } }