Esempio n. 1
0
        public async Task <ActionResult> Index(string artistId)
        {
            Artist artist = await spotifyService.GetArtist(artistId);

            List <Track> topTracks = null;

            if (artist.id != null)
            {
                // Set cookie for homepage's related artists section
                Response.Cookies["cookie"].Value = artist.id;

                topTracks = await spotifyService.GetArtistTopTracks(artistId);

                List <Album> albums = await spotifyService.GetArtistAlbums(artistId);

                artist.youtubeProfile = await youtubeService.GetYoutubeChannel(artist.name);

                wikipediaService.GetArticleIntro(artist);

                // geniusService.SetTrackLyrics("PNL");

                ViewBag.Albums            = albums;
                ViewBag.ArtistName        = artist.name;
                ViewBag.ArtistImage       = artist.images[0].url;
                ViewBag.WikiActicle       = artist.wikipediaArticle;
                ViewBag.WikipediaURL      = artist.wikipediaProfile;
                ViewBag.YoutubeChannelURL = artist.youtubeProfile;
                ViewBag.SpotifyURL        = "https://play.spotify.com/artist/" + artist.id;
            }
            return(View(topTracks));
        }
Esempio n. 2
0
        public async Task GetArtist_DoesNotError()
        {
            // arrange
            SpotifyService spotifyService = new SpotifyService();

            // act
            try
            {
                dynamic artist = await spotifyService.GetArtist("1tpXaFf2F55E7kVJON4j4G");

                //Assert.AreEqual("", artist.name);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
        }