/// <summary> /// Updates the song position in playlist. /// </summary> /// <param name="userEmail">The user email.</param> /// <param name="songId">The song identifier.</param> /// <param name="playlistId">The playlist identifier.</param> /// <param name="position">The position.</param> /// <returns>is the song updated</returns> public bool UpdateSongPositionInPlaylist( string userEmail, string playlistId, YouTubeSong song, int position) { bool isSuccessfullyUpdated = false; try { YouTubeServiceClient service = new YouTubeServiceClient(); service.UpdatePlaylistItemAsync(userEmail, song.SongId, playlistId, song.PlayListItemId, position).Wait(); isSuccessfullyUpdated = true; } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging isSuccessfullyUpdated = false; } } return(isSuccessfullyUpdated); }
/// <summary> /// Gets the play list songs. /// </summary> /// <param name="userEmail">The user email.</param> /// <param name="playListId">The play list identifier.</param> /// <returns></returns> public List<IYouTubeSong> GetPlayListSongs(string userEmail, string playListId) { List<IYouTubeSong> playListSongs = new List<IYouTubeSong>(); try { YouTubeServiceClient service = new YouTubeServiceClient(); service.GetPlayListSongsInternalAsync(userEmail, playListId, playListSongs).Wait(); } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging } } return playListSongs; }
/// <summary> /// Gets the user play lists. /// </summary> /// <param name="userEmail">The user email.</param> /// <returns>list of users playlists</returns> public List <YouTubePlayList> GetUserPlayLists(string userEmail) { List <YouTubePlayList> playLists = new List <YouTubePlayList>(); try { YouTubeServiceClient service = new YouTubeServiceClient(); service.GetUserPlayListsAsync(userEmail, playLists).Wait(); } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging } } return(playLists); }
/// <summary> /// Gets the play list songs. /// </summary> /// <param name="userEmail">The user email.</param> /// <param name="playListId">The play list identifier.</param> /// <returns></returns> public List <string> GetPlayListSongs(string userEmail, string playListId) { List <string> playListSongs = new List <string>(); try { YouTubeServiceClient service = new YouTubeServiceClient(); service.GetPlayListSongsInternalAsync(userEmail, playListId, playListSongs).Wait(); } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging } } return(playListSongs); }
/// <summary> /// Gets the user play lists. /// </summary> /// <param name="userEmail">The user email.</param> /// <returns>list of users playlists</returns> public List<YouTubePlayList> GetUserPlayLists(string userEmail) { List<YouTubePlayList> playLists = new List<YouTubePlayList>(); try { YouTubeServiceClient service = new YouTubeServiceClient(); service.GetUserPlayListsAsync(userEmail, playLists).Wait(); } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging } } return playLists; }
/// <summary> /// Removes the song from playlist. /// </summary> /// <param name="userEmail">The user email.</param> /// <param name="playlistItemId">The song identifier.</param> /// <returns>is the song successfully removed</returns> public bool RemoveSongFromPlaylist(string userEmail, string playlistItemId) { bool isSuccessfullyRemoved = false; try { YouTubeServiceClient service = new YouTubeServiceClient(); service.RemoveSongFromPlaylistAsync(userEmail, playlistItemId).Wait(); isSuccessfullyRemoved = true; } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging isSuccessfullyRemoved = false; } } return isSuccessfullyRemoved; }
/// <summary> /// Removes the song from playlist. /// </summary> /// <param name="userEmail">The user email.</param> /// <param name="playlistItemId">The song identifier.</param> /// <returns>is the song successfully removed</returns> public bool RemoveSongFromPlaylist(string userEmail, string playlistItemId) { bool isSuccessfullyRemoved = false; try { YouTubeServiceClient service = new YouTubeServiceClient(); service.RemoveSongFromPlaylistAsync(userEmail, playlistItemId).Wait(); isSuccessfullyRemoved = true; } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging isSuccessfullyRemoved = false; } } return(isSuccessfullyRemoved); }
/// <summary> /// Updates the song position in playlist. /// </summary> /// <param name="userEmail">The user email.</param> /// <param name="songId">The song identifier.</param> /// <param name="playlistId">The playlist identifier.</param> /// <param name="position">The position.</param> /// <returns>is the song updated</returns> public bool UpdateSongPositionInPlaylist( string userEmail, string playlistId, YouTubeSong song, int position) { bool isSuccessfullyUpdated = false; try { YouTubeServiceClient service = new YouTubeServiceClient(); service.UpdatePlaylistItemAsync(userEmail, song.SongId, playlistId, song.PlayListItemId, position).Wait(); isSuccessfullyUpdated = true; } catch (AggregateException ex) { foreach (var e in ex.InnerExceptions) { //TODO: Add Logging isSuccessfullyUpdated = false; } } return isSuccessfullyUpdated; }