Exemplo n.º 1
0
        // Call MusicBrainz API to get artist songs
        private List <SongList> GetArtistSongs(string artistID)
        {
            if (string.IsNullOrEmpty(artistID))
            {
                return(new List <SongList>());
            }

            // This is taken from Github documentation
            // https://github.com/Zastai/MetaBrainz.MusicBrainz/blob/master/UserGuide.md

            var oa = new OAuth2();

            oa.ClientId = "mJAE1ZhAnqLnC3Pg6Hnt9Q85V0PA-Qgo";
            // If using a local MusicBrainz server instance, make sure to set up the correct address and port.
            var url = oa.CreateAuthorizationRequest(OAuth2.OutOfBandUri, AuthorizationScope.Rating | AuthorizationScope.Tag);
            var at  = oa.GetBearerToken(LoginHelper.GetAccessToken(), "ahb54cxChyLFXebAX4BFMezbm6IgXXac", OAuth2.OutOfBandUri);
            var q   = new MetaBrainz.MusicBrainz.Query("Red Stapler", "19.99", "mailto:[email protected]");

            q.BearerToken = at.AccessToken;
            var artist = q.BrowseArtistWorks(new Guid(artistID));

            q.Close();

            return(GetArtistSongsFromResult(artist.Results));
        }