Пример #1
0
        public async Task HandleAsync(SetActivePlaylistCommand command)
        {
            Log.Info("Processing SetActivePlaylistCommand");

            var playlistContainer = _spotifySession.Playlistcontainer();

            await playlistContainer.Load();

            var playlist = await FindPlaylistByName(playlistContainer, command.PlaylistName);

            if (playlist == null)
            {
                Log.Warn("Playlist {0} not found", command.PlaylistName);
            }

            var tracks = await GetTracks(playlist);

            var playlistPlayStrategy = _session.PlaylistPlayStrategy;

            playlistPlayStrategy.SetPlaylist(tracks);
        }
        public async Task <IDictionary <int, string> > ExecuteAsync()
        {
            var playlistContainer = _spotifySession.Playlistcontainer();

            await playlistContainer.Load();

            var playlists = new Dictionary <int, string>();

            for (var i = 0; i < playlistContainer.NumPlaylists(); i++)
            {
                if (playlistContainer.PlaylistType(i) != PlaylistType.Playlist)
                {
                    continue;
                }

                var playlist = playlistContainer.Playlist(i);
                await playlist.Load();

                playlists.Add(i, playlist.Name());
            }

            return(playlists);
        }