コード例 #1
0
ファイル: APITests.cs プロジェクト: bitrvmpd/wuffSonic
        public void GetAlbumList_alphabeticalByName()
        {
            GetAlbumList al = new GetAlbumList(ListType.alphabeticalByName)
            {
                Credentials = c
            };
            var response = al.DoRequest<GetAlbumListResponse>().GetAwaiter().GetResult();

            Assert.AreEqual<string>(expected, response.status);
        }
コード例 #2
0
        public async Task<bool> Get(int id)
        {
            try
            {
                var ar = new GetAlbumList(ListType.alphabeticalByName, size: "10")
                {
                    appName = "wuffSonic",
                    user = "",
                    password = "",
                    version = "1.11",
                    uri = "http://music.deviouscreation.com"
                };

                var albumsResponse = await ar.DoRequest<GetAlbumListResponse>();
                var returnedAlbums = albumsResponse.albumList.album;

                foreach (var returnedAlbum in returnedAlbums)
                {
                    long albumId, coverArtId;
                    long.TryParse(returnedAlbum.id, out albumId);
                    long.TryParse(returnedAlbum.artistId, out coverArtId);
                    var album = new Album(albumId, returnedAlbum.name, coverArtId);
                    
                    var albumRequest = new GetAlbum(returnedAlbum.id);
                    var albumResponse = await albumRequest.DoRequest<GetAlbum>();
                    var songs = albumResponse.Response.album.song;
                    foreach (var song in songs)
                    {
                        var track = new Track(song.id, song.duration, song.size, song.title, song.track)
                    }

                    _musicContext.Albums.Add(album);
                }
            }
            catch (Exception ex)
            {
                
                throw;
            }
            

            return true;
        }
コード例 #3
0
ファイル: APITests.cs プロジェクト: bitrvmpd/wuffSonic
        public void GetAlbumList_genre()
        {
            GetAlbumList al = new GetAlbumList(genre: "rock")
            {
                Credentials = c
            };
            var response = al.DoRequest<GetAlbumListResponse>().GetAwaiter().GetResult();

            Assert.AreEqual<string>(expected, response.status);
        }
コード例 #4
0
ファイル: APITests.cs プロジェクト: bitrvmpd/wuffSonic
        public void GetAlbumList_year()
        {
            GetAlbumList al = new GetAlbumList(fromYear: "1990", toYear: "2015")
            {
                Credentials = c
            };
            var response = al.DoRequest<GetAlbumListResponse>().GetAwaiter().GetResult();

            Assert.AreEqual<string>(expected, response.status);
        }