Playlist

Namespace: SharpKml.Core
We found 10 examples in language CSharp for this search. You will see 33 fragments of code.

Other methods


        public async Task EditPlaylist(int id, string name)
        {
            Playlist playlist = await dataService.Get<Playlist>(item => item.Id == id);

            playlist.Name = name;
            await dataService.Update(playlist);
        }


        [TestMethod]
        public void LoadByIdTest()
        {
            TWDP.Playlist.BL.Playlist playlist = new TWDP.Playlist.BL.Playlist();

            playlist.LoadById(Guid.Parse("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"));

            string expected = "Queens of the Stone Age: Greatest Hits";
            string actual = playlist.SuggestedPlaylistTitle;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void LoadPlaylistTest()
        {
            TWDP.Playlist.BL.Playlist playlist = new TWDP.Playlist.BL.Playlist();

            playlist.LoadPlaylist(Guid.Parse("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"));

            int expected = 2;
            int actual = playlist.playlistList.Count();

            Assert.AreEqual(expected, actual);
        }

/*

using System;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.Upload;
using Google.Apis.Util.Store;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;

namespace Google.Apis.YouTube.Samples
{
  /// <summary>
  /// YouTube Data API v3 sample: create a playlist.
  /// Relies on the Google APIs Client Library for .NET, v1.7.0 or higher.
  /// See https://developers.google.com/api-client-library/dotnet/get_started
  /// </summary>
  internal class PlaylistUpdates
  {
    [STAThread]
    static void Main(string[] args)
    {
      Console.WriteLine("YouTube Data API: Playlist Updates");
      Console.WriteLine("==================================");

      try
      {
        new PlaylistUpdates().Run().Wait();
      }
      catch (AggregateException ex)
      {
        foreach (var e in ex.InnerExceptions)
        {
          Console.WriteLine("Error: " + e.Message);
        }
      }

      Console.WriteLine("Press any key to continue...");
      Console.ReadKey();
    }

    private async Task Run()
    {
      UserCredential credential;
      using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
      {
        credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
            GoogleClientSecrets.Load(stream).Secrets,
            // This OAuth 2.0 access scope allows for full read/write access to the
            // authenticated user's account.
            new[] { YouTubeService.Scope.Youtube },
            "user",
            CancellationToken.None,
            new FileDataStore(this.GetType().ToString())
        );
      }

      var youtubeService = new YouTubeService(new BaseClientService.Initializer()
      {
        HttpClientInitializer = credential,
        ApplicationName = this.GetType().ToString()
      });

      // Create a new, private playlist in the authorized user's channel.
      var newPlaylist = new Playlist();
      newPlaylist.Snippet = new PlaylistSnippet();
      newPlaylist.Snippet.Title = "Test Playlist";
      newPlaylist.Snippet.Description = "A playlist created with the YouTube API v3";
      newPlaylist.Status = new PlaylistStatus();
      newPlaylist.Status.PrivacyStatus = "public";
      newPlaylist = await youtubeService.Playlists.Insert(newPlaylist, "snippet,status").ExecuteAsync();

      // Add a video to the newly created playlist.
      var newPlaylistItem = new PlaylistItem();
      newPlaylistItem.Snippet = new PlaylistItemSnippet();
      newPlaylistItem.Snippet.PlaylistId = newPlaylist.Id;
      newPlaylistItem.Snippet.ResourceId = new ResourceId();
      newPlaylistItem.Snippet.ResourceId.Kind = "youtube#video";
      newPlaylistItem.Snippet.ResourceId.VideoId = "GNRMeaz6QRI";
      newPlaylistItem = await youtubeService.PlaylistItems.Insert(newPlaylistItem, "snippet").ExecuteAsync();

      Console.WriteLine("Playlist item id {0} was added to playlist id {1}.", newPlaylistItem.Id, newPlaylist.Id);
    }
  }
}

        //----------------------------------------------------------------------------------------------------------


        //----------------------------------------------------------------------------------------------------------
        public int AddNewPlaylist(Playlist playlist)
        {
            hyDB.Playlists.AddObject(playlist);
            hyDB.SaveChanges();

            return playlist.id;
        }
        //----------------------------------------------------------------------------------------------------------



        public List<sp_Playlist_GetPlaylistById_Admin_Result> GetPlaylistById(int playlist_id)
        {
            List<sp_Playlist_GetPlaylistById_Admin_Result> playlist = new List<sp_Playlist_GetPlaylistById_Admin_Result>();

            playlist = hyDB.sp_Playlist_GetPlaylistById_Admin(playlist_id).ToList();

            return playlist;
        }


        //----------------------------------------------------------------------------------------------------------
        public List<Playlist> GetWithDescPlaylists()
        {
            List<Playlist> model = new List<Playlist>();

            model = hyDB.sp_Playlist_GetWithDescPlaylists().ToList();

            return model;
        }
        //----------------------------------------------------------------------------------------------------------





        public List<Playlist> SearchPlaylistByDesc(string search_term)
        {
            List<Playlist> model = new List<Playlist>();

            model = hyDB.sp_Playlist_SearchPlaylistByDesc(search_term).ToList();

            return model;
        }


        public void DeletePlayList(string name)
        {
            PlayList playlist = PlayLists.Find(playlist => playlist.Name == name);

            if (playlist == null)
            {
                Console.WriteLine("Album with this name does not exist!");
            }
            else
            {
                Console.WriteLine("Album has been removed succesfully");
                PlayLists.Remove(playlist);
            }
        }

        public void AddSongsToPlaylist(Song songtoAdd, string playlistName)
        {
            PlayList playlist = this.playLists.Find(playlist => playlist.Name == playlistName);

            if (playlist == null)
            {
                Console.Write("There is no album with this name\n");
            }
            else
            {
                playlist.AddSong(songtoAdd);
            }
        }

        public void RemoveSongsFromPlaylist(Song songToRemove, string playlistName)
        {
            PlayList playlist = Storage.Playlists[playlistName];

            if (playlist == null)
            {
                Console.Write("There is no album with this name\n");
            }
            else
            {
                playlist.RemoveSong(songToRemove);
            }
        }


        private void CreateXml(PlaylistHolder? datastream, string path)
        {
            System.IO.Directory.CreateDirectory(path);
            doc = new XDocument(new XElement("Root"));
            if(!datastream.HasValue)
            {
                doc.Save(_filepath);
                return;
            }

            XElement element = new XElement("Playlist", new object[] { new XAttribute("Name", datastream.Value.PlaylistName), new XAttribute("Path", datastream.Value.PlaylistPath) });
            doc.Root.Add(element);
            doc.Save(_filepath);
        }

        /// <summary>
        /// Adds a playlist
        /// </summary>
        /// <param name="OtobeAdded">PlaylistHolder to add</param>
        public void AddItem(object OtobeAdded)
        {
            try
            {
                PlaylistHolder datastream = (PlaylistHolder)OtobeAdded;
                if (Exists(datastream))
                    return;
                XElement element = new XElement("Playlist", new object[] { new XAttribute("Name", datastream.PlaylistName), new XAttribute("Path", datastream.PlaylistPath) });
                doc.Root.Add(element);
                doc.Save(_filepath);
            }
            catch (InvalidCastException ex)
            {
                throw new WrongParametersException("Object is not of type PlaylistHolder", ex.StackTrace);
            }
        }

        /// <summary>
        /// Add a list of PlaylistHolder
        /// </summary>
        /// <param name="OtobeAdded">List of PlaylistHolder to add</param>
        public void AddItems(object OtobeAdded)
        {
            try
            {
                List<PlaylistHolder> datastream = (List<PlaylistHolder>)OtobeAdded;
                foreach (PlaylistHolder data in datastream)
                    AddItem(data);
            }
            catch (InvalidCastException ex)
            {
                throw new WrongParametersException("Object is not of type List<PlaylistHolder>", ex.StackTrace);
            }
        }

        /// <summary>
        /// Releases all associated resources
        /// </summary>
        public void Dispose()
        {
            doc = null;
            _filepath = null;
        }

        /// <summary>
        /// Fetches items from the xml file
        /// </summary>
        /// <returns>List of PlaylistHolder</returns>
        public object FetchItems()
        {
            List<PlaylistHolder> holder = new List<PlaylistHolder>();
            foreach(XElement element in doc.Root.Elements())
                holder.Add(new PlaylistHolder { PlaylistName = (string)element.Attribute("Name"), PlaylistPath = (string)element.Attribute("Path") });

            return holder;
        }

        /// <summary>
        /// Removes a playlist
        /// </summary>
        /// <param name="OtobeRemoved">PlaylistHolder to remove</param>
        public void RemoveItem(object OtobeRemoved)
        {
            try
            {
                PlaylistHolder datastream = (PlaylistHolder)OtobeRemoved;
                if (!Exists(datastream))
                    return;
                doc.Root.Elements("Playlist").Where(x => (string)x.Attribute("Name") == datastream.PlaylistName).Remove();
                doc.Save(_filepath);
            }
            catch(InvalidCastException ex)
            {
                throw new WrongParametersException("Object is not of type PlaylistHolder", ex.StackTrace);
            }
        }

    [STAThread]
    static void Main(string[] args)
    {
      Console.WriteLine("YouTube Data API: Playlist Updates");
      Console.WriteLine("==================================");

      try
      {
        new PlaylistUpdates().Run().Wait();
      }
      catch (AggregateException ex)
      {
        foreach (var e in ex.InnerExceptions)
        {
          Console.WriteLine("Error: " + e.Message);
        }
      }

      Console.WriteLine("Press any key to continue...");
      Console.ReadKey();
    }

    private async Task Run()
    {
      UserCredential credential;
      using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
      {
        credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
            GoogleClientSecrets.Load(stream).Secrets,
            // This OAuth 2.0 access scope allows for full read/write access to the
            // authenticated user's account.
            new[] { YouTubeService.Scope.Youtube },
            "user",
            CancellationToken.None,
            new FileDataStore(this.GetType().ToString())
        );
      }

      var youtubeService = new YouTubeService(new BaseClientService.Initializer()
      {
        HttpClientInitializer = credential,
        ApplicationName = this.GetType().ToString()
      });

      // Create a new, private playlist in the authorized user's channel.
      var newPlaylist = new Playlist();
      newPlaylist.Snippet = new PlaylistSnippet();
      newPlaylist.Snippet.Title = "Test Playlist";
      newPlaylist.Snippet.Description = "A playlist created with the YouTube API v3";
      newPlaylist.Status = new PlaylistStatus();
      newPlaylist.Status.PrivacyStatus = "public";
      newPlaylist = await youtubeService.Playlists.Insert(newPlaylist, "snippet,status").ExecuteAsync();

      // Add a video to the newly created playlist.
      var newPlaylistItem = new PlaylistItem();
      newPlaylistItem.Snippet = new PlaylistItemSnippet();
      newPlaylistItem.Snippet.PlaylistId = newPlaylist.Id;
      newPlaylistItem.Snippet.ResourceId = new ResourceId();
      newPlaylistItem.Snippet.ResourceId.Kind = "youtube#video";
      newPlaylistItem.Snippet.ResourceId.VideoId = "GNRMeaz6QRI";
      newPlaylistItem = await youtubeService.PlaylistItems.Insert(newPlaylistItem, "snippet").ExecuteAsync();

      Console.WriteLine("Playlist item id {0} was added to playlist id {1}.", newPlaylistItem.Id, newPlaylist.Id);
    }

        // GET: Editors/managePlaylist
        [Authorize]
        [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0)]
        public ActionResult Index()
        {
            hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel model = new hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel();
            hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.memberManagement userManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.songsManagement songsManager = new hypster_tv_DAL.songsManagement();
            model.member = memberManager.getMemberByUserName(User.Identity.Name);
            model.playlist = playlistManager.GetUserPlaylists(model.member.id);

            int playlist_id = 0;
            if (Request.QueryString["playlist_id"] != null)
                playlist_id = Convert.ToInt32(Request.QueryString["playlist_id"]);
            else
                playlist_id = model.member.active_playlist;

            foreach (var item in model.playlist)
            {
                if (item.id == playlist_id)
                {
                    ViewBag.ActivePlaylistName = item.name;
                    ViewBag.ActivePlaylistID = item.id;
                }
            }

            if (playlist_id != 0)
                model.playlistData_Song = playlistManager.GetSongsForPlayList(model.member.id, playlist_id);

            hypster_tv_DAL.TagManagement tagManager = new hypster_tv_DAL.TagManagement();
            if (playlist_id != 0)
                model.tags_list = tagManager.GetPlaylistTags(playlist_id);
            else
                model.tags_list = tagManager.GetPlaylistTags(model.member.active_playlist);

            ViewBag.TotalResults = model.playlistData_Song.Count;
            //ViewBag.PageSize = 20;
            return View(model);
        }

        [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0)]
        [HttpPost]
        public ActionResult AddNewPlaylist(string AddPlaylist_Name)
        {
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement();

            if (AddPlaylist_Name != "")
            {
                hypster_tv_DAL.Member member = new hypster_tv_DAL.Member();
                member = memberManager.getMemberByUserName(User.Identity.Name);

                hypster_tv_DAL.Playlist playlist = new hypster_tv_DAL.Playlist();
                playlist.name = AddPlaylist_Name;
                playlist.userid = member.id;

                string crtd = DateTime.Now.ToString("yyyyMMdd");
                int crtd_i = 0;
                Int32.TryParse(crtd, out crtd_i);
                playlist.create_time = crtd_i;

                if (playlist.name.Length > 60)
                    playlist.name = playlist.name.Substring(0, 60);


                hypster_tv_DAL.Hypster_Entities hyDB_man = new hypster_tv_DAL.Hypster_Entities();
                hyDB_man.Playlists.AddObject(playlist);
                hyDB_man.SaveChanges();

                hypster_tv_DAL.playlistManagement playlistManagement = new hypster_tv_DAL.playlistManagement();
                List<hypster_tv_DAL.Playlist> playlists_list = playlistManagement.GetUserPlaylists(member.id);
                if (member.active_playlist == 0 && playlists_list.Count > 0)
                {
                    member.active_playlist = playlists_list[0].id;
                    memberManager.SetUserDefaultPlaylist(User.Identity.Name, member.id, member.active_playlist);
                }
            }
            return RedirectPermanent("/Editors/managePlaylist/");
        }

        [HttpGet]
        public ActionResult addNewSongs()
        {
            hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel model = new ViewModels.PlaylistViewModel();

            hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();

            if (User.Identity.IsAuthenticated == true)
                model.playlist = playlistManager.GetUserPlaylists(memberManager.getMemberByUserName(User.Identity.Name).id);
            ViewBag.playlist_id = Request.QueryString["playlist"].ToString();

            return View(model);
        }

        [Authorize]
        [HttpPost]
        public string SubmitAddNewSong(string Song_Title, string Song_Guid, string Sel_Playlist_ID)
        {
            hypster_tv_DAL.Hypster_Entities hypDB = new hypster_tv_DAL.Hypster_Entities();
            hypster_tv_DAL.songsManagement songsManager = new hypster_tv_DAL.songsManagement();
            hypster_tv_DAL.memberManagement userManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManagement = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.Member curr_user = new hypster_tv_DAL.Member();
            curr_user = userManager.getMemberByUserName(User.Identity.Name);

            if (curr_user.active_playlist == 0)
            {
                hypster_tv_DAL.Playlist create_playlist = new hypster_tv_DAL.Playlist();
                create_playlist.name = curr_user.username + "'s playlist";
                create_playlist.userid = curr_user.id;


                string crtd = DateTime.Now.ToString("yyyyMMdd");
                int crtd_i = 0;
                Int32.TryParse(crtd, out crtd_i);
                create_playlist.create_time = crtd_i;


                if (create_playlist.name.Length > 60)
                    create_playlist.name = create_playlist.name.Substring(0, 60);


                hypDB.Playlists.AddObject(create_playlist);
                hypDB.SaveChanges();

                List<hypster_tv_DAL.Playlist> playlists_list = playlistManagement.GetUserPlaylists(curr_user.id);
                if (playlists_list.Count > 0)
                {
                    curr_user.active_playlist = playlists_list[0].id;
                    userManager.SetUserDefaultPlaylist(User.Identity.Name, curr_user.id, curr_user.active_playlist);
                }
                //else error - need to have dafult playlist
            }
            //-----------------------------------------------------------------------------------------

            //check if user selected playlist
            //-----------------------------------------------------------------------------------------
            if (Sel_Playlist_ID == null)
            {
                Sel_Playlist_ID = curr_user.active_playlist.ToString();
            }
            //-----------------------------------------------------------------------------------------

            // get last sort_number
            //-----------------------------------------------------------------------------------------
            short Sel_Sort_Order = 0;
            playlistManagement.IncrementPlaylistSongOrder(curr_user.id, Convert.ToInt32(Sel_Playlist_ID));
            //set sort order to first position
            Sel_Sort_Order = 1;
            //-----------------------------------------------------------------------------------------

            //get song by guid
            //-----------------------------------------------------------------------------------------
            hypster_tv_DAL.Song song = new hypster_tv_DAL.Song();
            song = songsManager.GetSongByGUID(Song_Guid);
            //-----------------------------------------------------------------------------------------
            if (Song_Title.Length > 75)
            {
                Song_Title = Song_Title.Substring(0, 75);
            }

            //-----------------------------------------------------------------------------------------
            if (song.id == 0) //add new song
            {
                var youtubeService = new YouTubeService(new BaseClientService.Initializer()
                {
                    ApiKey = System.Configuration.ConfigurationManager.AppSettings["YouTubeAPIKEY"],
                    ApplicationName = System.Configuration.ConfigurationManager.AppSettings["YouTubeAPIKEYName"]
                });

                var searchListRequest = youtubeService.Search.List("id,snippet");
                searchListRequest.Q = Song_Guid; // Replace with your search term.
                searchListRequest.MaxResults = 1;

                var searchListResponse = searchListRequest.Execute();
                SearchResult video = new SearchResult();
                foreach (var searchResult in searchListResponse.Items)
                {
                    switch (searchResult.Id.Kind)
                    {
                        case "youtube#video":
                            video = searchResult;
                            break;
                    }
                }

                //need to modify to add more song params
                hypster_tv_DAL.Song new_song = new hypster_tv_DAL.Song();
                new_song.Title = Song_Title;
                new_song.YoutubeId = Song_Guid;
                new_song.adddate = DateTime.Now;
                new_song.YoutubeProcessed = false;

                new_song.Author = "";
                new_song.Rating = 1;
                new_song.Syndication = 1;

                hypDB.Songs.AddObject(new_song);
                hypDB.SaveChanges();

                //get newely added song
                song = songsManager.GetSongByGUID(Song_Guid);

                //add to playlist data
                hypster_tv_DAL.PlaylistData new_playlistData = new hypster_tv_DAL.PlaylistData();
                new_playlistData.playlist_id = Convert.ToInt32(Sel_Playlist_ID);
                new_playlistData.songid = song.id;
                new_playlistData.sortid = Sel_Sort_Order;
                new_playlistData.userid = userManager.getMemberByUserName(User.Identity.Name).id;
                hypDB.PlaylistDatas.AddObject(new_playlistData);
                hypDB.SaveChanges();
            }
            else //if song exist in database
            {
                //add to playlist data
                hypster_tv_DAL.PlaylistData new_playlistData = new hypster_tv_DAL.PlaylistData();
                new_playlistData.playlist_id = Convert.ToInt32(Sel_Playlist_ID);
                new_playlistData.songid = song.id;
                new_playlistData.sortid = Sel_Sort_Order;
                new_playlistData.userid = curr_user.id;
                hypDB.PlaylistDatas.AddObject(new_playlistData);
                hypDB.SaveChanges();
            }
            return "A New Song, " + Song_Title + " (ID: " + Song_Guid + ") has been added to the Playlist, " + playlistManagement.GetPlaylistById(Convert.ToInt32(Sel_Playlist_ID))[0].name;
            //return RedirectPermanent("/Editors/managePlaylist/?playlist_id=" + Sel_Playlist_ID);
        }

        [Authorize]
        [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0)]
        public ActionResult delelePlaylistSong()
        {
            hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel model = new hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel();
            hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.memberManagement userManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.songsManagement songsManager = new hypster_tv_DAL.songsManagement();
            model.member = memberManager.getMemberByUserName(User.Identity.Name);

            if (Request.QueryString["ACT"] != null)
            {

                switch (Request.QueryString["ACT"].ToString())
                {
                    case "delete_playlist":
                        int d_playlist_id = 0;
                        if (Int32.TryParse(Request.QueryString["playlist_id"], out d_playlist_id) == false)
                            d_playlist_id = 0;
                        if (d_playlist_id != 0)
                        {
                            playlistManager.Delete_Playlist(model.member.id, d_playlist_id);
                            //check if this playlist is default
                            if (model.member.active_playlist == d_playlist_id)
                            {
                                memberManager.SetUserDefaultPlaylist(User.Identity.Name, model.member.id, 0);
                            }
                            return RedirectPermanent("/Editors/managePlaylist/");
                        }
                        break;
                    case "delete_song":
                        int d_song_id = 0;
                        if (Int32.TryParse(Request.QueryString["song_id"], out d_song_id) == false)
                            d_song_id = 0;
                        string pl_id = "";
                        if (Request.QueryString["playlist_id"] != null)
                            pl_id = Request.QueryString["playlist_id"].ToString();
                        if (d_song_id != 0)
                        {
                            playlistManager.DeleteSong(model.member.id, d_song_id);
                            return RedirectPermanent("/Editors/managePlaylist/?playlist_id=" + pl_id);
                        }
                        break;
                    case "delete_song_plr":
                        int d_song_id1 = 0;
                        if (Int32.TryParse(Request.QueryString["song_id"], out d_song_id1) == false)
                            d_song_id1 = 0;

                        if (d_song_id1 != 0)
                        {
                            playlistManager.DeleteSong(model.member.id, d_song_id1);
                            return RedirectPermanent("/Editors/managePlaylist/");
                        }
                        break;
                    default:
                        break;
                }
            }

            model.playlist = playlistManager.GetUserPlaylists(model.member.id);

            int playlist_id = 0;
            if (Request.QueryString["playlist_id"] != null)
            {
                if (Int32.TryParse(Request.QueryString["playlist_id"], out playlist_id) == false)
                    playlist_id = 0;
            }
            else
            {
                playlist_id = model.member.active_playlist;
            }

            foreach (var item in model.playlist)
            {
                if (item.id == playlist_id)
                {
                    ViewBag.ActivePlaylistName = item.name;
                    ViewBag.ActivePlaylistID = item.id;
                }
            }

            if (playlist_id != 0)
            {
                model.playlistData_Song = playlistManager.GetSongsForPlayList(model.member.id, playlist_id);
            }
            else
            {
                model.playlistData_Song = playlistManager.GetSongsForPlayList(model.member.id, model.member.active_playlist);
            }

            hypster_tv_DAL.TagManagement tagManager = new hypster_tv_DAL.TagManagement();
            if (playlist_id != 0)
            {
                model.tags_list = tagManager.GetPlaylistTags(playlist_id);
            }
            else
            {
                model.tags_list = tagManager.GetPlaylistTags(model.member.active_playlist);
            }

            return View(model);
        }

        [Authorize]
        [System.Web.Mvc.OutputCache(NoStore = true, Duration = 0)]
        public ActionResult clonePlaylist()
        {
            hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel model = new hypster_admin.Areas.Editors.ViewModels.PlaylistViewModel();
            hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement();
            hypster_tv_DAL.playlistManagement playlistManager = new hypster_tv_DAL.playlistManagement();
            hypster_tv_DAL.TagManagement tagManager = new hypster_tv_DAL.TagManagement();
            string playlistId = Request.QueryString["playlistId"];
            string playlistName = "";
            if (playlistId != "")
            {
                hypster_tv_DAL.Member member = new hypster_tv_DAL.Member();

                if (Request.QueryString["cloneTo"] != "")
                    member = memberManager.getMemberByUserName(Request.QueryString["cloneTo"]);
                else
                    member = memberManager.getMemberByUserName(User.Identity.Name);

                if (Request.QueryString["playlistName"] != "")
                {
                    playlistName = Request.QueryString["playlistName"];
                    hypster_tv_DAL.Playlist playlist = new hypster_tv_DAL.Playlist();
                    playlist.name = playlistName;
                    playlist.userid = member.id;

                    string crtd = DateTime.Now.ToString("yyyyMMdd");
                    int crtd_i = 0;
                    Int32.TryParse(crtd, out crtd_i);
                    playlist.create_time = crtd_i;

                    if (playlist.name.Length > 60)
                        playlist.name = playlist.name.Substring(0, 60);

                    hypster_tv_DAL.Hypster_Entities hyDB = new hypster_tv_DAL.Hypster_Entities();
                    hyDB.Playlists.AddObject(playlist);
                    hyDB.SaveChanges();

                    List<hypster_tv_DAL.Playlist> playlists_list = playlistManager.GetUserPlaylists(member.id);
                    int clLsId = playlists_list[playlists_list.Count - 1].id;
                    int plId = Convert.ToInt32(playlistId);
                    model.playlistData_Song = playlistManager.GetPlayListDataByPlaylistID(plId);
                    model.tags_list = tagManager.GetPlaylistTags(plId);
                    for (int i = 0; i < model.playlistData_Song.Count; i++)
                    {
                        if (model.playlistData_Song[i].id != null)
                        {
                            hypster_tv_DAL.PlaylistData new_playlistData = new hypster_tv_DAL.PlaylistData();
                            new_playlistData.playlist_id = clLsId;
                            new_playlistData.songid = (int)model.playlistData_Song[i].id;
                            new_playlistData.sortid = model.playlistData_Song[i].sortid;
                            new_playlistData.userid = member.id;
                            hyDB.PlaylistDatas.AddObject(new_playlistData);
                            hyDB.SaveChanges();
                        }
                    }
                    
                    for (int j = 0; j < model.tags_list.Count; j++)
                    {
                        if (model.tags_list[j].Tag_ID != null)
                        {
                            hypster_tv_DAL.Tag_Playlist plTag = new hypster_tv_DAL.Tag_Playlist();
                            plTag.Playlist_ID = clLsId;
                            plTag.Tag_ID = model.tags_list[j].Tag_ID;
                            hyDB.Tag_Playlist.AddObject(plTag);
                            hyDB.SaveChanges();
                        }
                    }
                }                
                else
                {
                    Exception PlaylistNameNull = new Exception("The Playlist Name is NULL.\n\n");
                    Response.Write("Error: " + PlaylistNameNull.Message);
                }
            }
            else
            {
                Exception PlaylistIdNull = new Exception("The Playlist ID " + playlistId + " is NULL.\n\n");
                Response.Write("Error: " + PlaylistIdNull.Message);
            }
            return RedirectPermanent("/Editors/managePlaylist/");
        }

    static void Main(string[] args)
    {
      CommandLine.EnableExceptionHandling();
      CommandLine.DisplayGoogleSampleHeader("YouTube Data API: Playlist Updates");

      var credentials = PromptingClientCredentials.EnsureFullClientCredentials();
      var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description)
      {
        ClientIdentifier = credentials.ClientId,
        ClientSecret = credentials.ClientSecret
      };
      var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);

      var youtube = new YoutubeService(new BaseClientService.Initializer()
      {
        Authenticator = auth
      });

      var newPlaylist = new Playlist();
      newPlaylist.Snippet = new PlaylistSnippet();
      newPlaylist.Snippet.Title = "Test Playlist";
      newPlaylist.Snippet.Description = "A playlist created with the YouTube API v3";
      newPlaylist.Status = new PlaylistStatus();
      newPlaylist.Status.PrivacyStatus = "public";
      newPlaylist = youtube.Playlists.Insert(newPlaylist, "snippet,status").Fetch();

      var newPlaylistItem = new PlaylistItem();
      newPlaylistItem.Snippet = new PlaylistItemSnippet();
      newPlaylistItem.Snippet.PlaylistId = newPlaylist.Id;
      newPlaylistItem.Snippet.ResourceId = new ResourceId();
      newPlaylistItem.Snippet.ResourceId.Kind = "youtube#video";
      newPlaylistItem.Snippet.ResourceId.VideoId = "GNRMeaz6QRI";
      newPlaylistItem = youtube.PlaylistItems.Insert(newPlaylistItem, "snippet").Fetch();

      CommandLine.WriteLine(String.Format("Playlist item id {0} was added to playlist id {1}.", newPlaylistItem.Id, newPlaylist.Id));

      CommandLine.PressAnyKeyToExit();
    }

    private static IAuthorizationState GetAuthorization(NativeApplicationClient client)
    {
      var storage = MethodBase.GetCurrentMethod().DeclaringType.ToString();
      var key = "storage_key";

      IAuthorizationState state = AuthorizationMgr.GetCachedRefreshToken(storage, key);
      if (state != null)
      {
        client.RefreshToken(state);
      }
      else
      {
        state = AuthorizationMgr.RequestNativeAuthorization(client, YoutubeService.Scopes.Youtube.GetStringValue());
        AuthorizationMgr.SetCachedRefreshToken(storage, key, state);
      }

      return state;
    }

        Task<SmartPlaylistDto> GetSmartPlaylistAsync(Guid smartPlaylistId);
        Task<SmartPlaylistDto[]> LoadPlaylistsAsync(Guid userId);
        Task<SmartPlaylistDto[]> GetAllSmartPlaylistsAsync();
        void Save(SmartPlaylistDto smartPlaylist);
        void Delete(Guid userId, string smartPlaylistId);


        public async Task<SmartPlaylistDto> GetSmartPlaylistAsync(Guid smartPlaylistId)
        {
            var fileName = _fileSystem.GetSmartPlaylistFilePath(smartPlaylistId.ToString());

            return await LoadPlaylistAsync(fileName).ConfigureAwait(false);
        }

SharpKml.Dom.GX.Playlist : KmlObject

Constructors :

public Playlist()

Methods :

public IReadOnlyCollection<TourPrimitive> get_Values()
public Void AddTourPrimitive(TourPrimitive tour = )
public String get_Id()
public Void set_Id(String value = )
public String get_TargetId()
public Void set_TargetId(String value = )
public IEnumerable<Element> get_Children()
public Element get_Parent()
public Void AddChild(Element child = )
public Boolean RemoveChild(Element child = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()