public override async Task <Playlist> GetPlaylistAsync(string playlistId)
        {
            // Shitty URL decode implementation because honestly,
            // playlist ID handling is a mess
            playlistId = playlistId.Replace("%3D", "=");
            var playlistResponse = await client.ListPlaylistsAsync();

            var playlists    = playlistResponse.Data.Items;
            var playlistInfo = (from playlist in playlists
                                where playlist.ShareToken == playlistId
                                select playlist).FirstOrDefault();

            if (playlistInfo == null)
            {
                throw new Exception("Playlist not found, or is not a user playlist. Only playlists the user owns can be downloaded at present.");
            }
            var items = await client.ListTracksFromPlaylist(playlistInfo);

            return(new Playlist
            {
                Id = playlistInfo.Id,
                Title = playlistInfo.Name,
                Tracks = (from track in items where track != null select track.ToAthameTrack()).ToList(),
            });
        }
Exemplo n.º 2
0
        public async Task ListPlaylists()
        {
            var account = GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            Assert.IsNotNull(await mc.ListPlaylistsAsync());
        }
Exemplo n.º 3
0
        private async Task InitPlayLists()
        {
            var playListsResult = await _mobileClient.ListPlaylistsAsync();

            _playLists = playListsResult.Data.Items;

            foreach (var playlist in _playLists)
            {
                _mainWindow.AvailablePlaylistsBox.Items.Add(playlist);
            }
        }
Exemplo n.º 4
0
        public async Task ListPlaylistItems()
        {
            var account = CommonTests.GetAccount();
            var mc      = new MobileClient();

            Assert.IsTrue(await mc.LoginAsync(account.Item1, account.Item2));
            ResultList <Playlist> playlist;

            Assert.IsNotNull(playlist = await mc.ListPlaylistsAsync());
            Assert.IsNotNull(await mc.ListTracksFromPlaylist(playlist.Data.Items.First()));
        }