Exemplo n.º 1
0
        /// <summary>
        /// Läd die übergebene Playlist
        /// </summary>
        /// <param name="pl"></param>
        /// <param name="sp"></param>
        /// <returns></returns>
        public static Boolean LoadPlaylist(SonosItem pl, SonosPlayer sp)
        {
            //laden der übergebenen Playlist
            StringBuilder stringb = new StringBuilder();

            try
            {
                stringb.AppendLine(sp.Name);
                //stringb.AppendLine("Suchen nach Playlist" + pl);
                //    var playlists = GetAllPlaylist();
                //var playlist = playlists.FirstOrDefault(x => x.Title.ToLower() == pl.ToLower());
                //if(playlist == null) throw new NullReferenceException("Playlist nicht gefunden");
                //stringb.AppendLine("Playlist gefunden" + playlist.Title);


                stringb.AppendLine("Löschen aller Tracks von " + sp.Name);
                sp.RemoveAllTracksFromQueue();
                Thread.Sleep(300);
                sp.Enqueue(pl, true);
                Thread.Sleep(200);
                stringb.AppendLine("Playlist wurde ersetzt.");
                sp.SetAVTransportURI(SonosConstants.xrinconqueue + sp.UUID + "#0");
                Thread.Sleep(500);
                return(true);
            }
            catch
            {
                SonosHelper.TraceLog("Loadplaylist.log", stringb.ToString());
                return(false);
            }
        }