public bool UpdateSongPositionInPlaylist(
            string userEmail,
            string playlistId,
            YouTubeSong song,
            int position)
        {
            var isSuccessfullyUpdated = false;

            try
            {
                var 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);
        }
        public List <IYouTubeSong> GetPlayListSongs(string userEmail, string playListId)
        {
            var playListSongs = new List <IYouTubeSong>();

            try
            {
                var service = new YouTubeServiceClient();
                service.GetPlayListSongsInternalAsync(userEmail, playListId, playListSongs).Wait();
            }
            catch (AggregateException ex)
            {
                foreach (var e in ex.InnerExceptions)
                {
                    //TODO: Add Logging
                }
            }

            return(playListSongs);
        }
        public List <YouTubePlayList> GetUserPlayLists(string userEmail)
        {
            var playLists = new List <YouTubePlayList>();

            try
            {
                var service = new YouTubeServiceClient();
                service.GetUserPlayListsAsync(userEmail, playLists).Wait();
            }
            catch (AggregateException ex)
            {
                foreach (var e in ex.InnerExceptions)
                {
                    //TODO: Add Logging
                }
            }

            return(playLists);
        }
        public bool AddSongToPlaylist(string userEmail, string songId, string playlistId)
        {
            var isSuccessfullyAdded = false;

            try
            {
                var service = new YouTubeServiceClient();
                service.AddSongToPlaylistAsync(userEmail, songId, playlistId).Wait();
                isSuccessfullyAdded = true;
            }
            catch (AggregateException ex)
            {
                foreach (var e in ex.InnerExceptions)
                {
                    //TODO: Add Logging
                    isSuccessfullyAdded = false;
                }
            }

            return(isSuccessfullyAdded);
        }
Example #5
0
        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);
        }