public async Task Search_Artist()
        {
            var discogsSearch = new DiscogsSearch()
            {
                query = "Ornette Coleman",
                type  = DiscogsEntityType.artist
            };

            var observable = _DiscogsClient.Search(discogsSearch);
            await observable.ForEachAsync(OnResult);
        }
        public async Task Search_Release()
        {
            var discogsSearch = new DiscogsSearch()
            {
                artist        = "Ornette Coleman",
                release_title = "The Shape Of Jazz To Come"
            };

            var observable = _DiscogsClient.Search(discogsSearch);
            await observable.ForEachAsync(OnResult);
        }
示例#3
0
        public async Task SearchAsync()
        {
            var discogsSearch = new DiscogsSearch()
            {
                artist        = "Ornette Coleman",
                release_title = "The Shape Of Jazz To Come"
            };

            var res = await _DiscogsClient.SearchAsync(discogsSearch);

            foreach (var searchResult in res.GetResults())
            {
                OnResult(searchResult);
            }
        }
        private void DoSearch()
        {
            Running      = true;
            NothingFound = false;
            Results.Clear();
            _CancellationTokenSource = new CancellationTokenSource();
            var client = _DiscogsClientProvider.GetDiscogsClient();
            var search = new DiscogsSearch
            {
                artist        = Artist,
                release_title = Album
            };

            client.Search(search).ObserveOn(SynchronizationContext.Current).Subscribe(OnResult, OnEnd, _CancellationTokenSource.Token);
        }
示例#5
0
        private async Task <Album> GetAlbumQuery()
        {
            log.Trace($"Discogs: Querying {ArtistName} -  {AlbumName}");
            var query = new DiscogsSearch {
                artist = ArtistName, release_title = AlbumName, type = DiscogsEntityType.master
            };
            var searchresults = await _discogsClient.SearchAsync(query);

            // Look for the Master Release only
            foreach (var result in searchresults.GetResults())
            {
                var album = await GetRelease(result.id);

                Albums.Add(album);
            }
            log.Trace("Discogs Query Ended");
            // We don't need to return really anything. Just to satisfy that a Task can't return void
            return(null);
        }
示例#6
0
文件: Infos.cs 项目: rasmus-z/AutoTag
        // Not implemented yet
        public static void GetSongInfosFromAPI(string artist, string title)
        {
            // Do the GET API Call
            // Convert to JSON
            // Return object

            var discogsSearch = new DiscogsSearch()
            {
                artist        = artist,
                release_title = title
            };

            //Retrieve observable result from search
            var observable = DiscogsAPI.Instance.client.Search(discogsSearch);
            var enumerable = DiscogsAPI.Instance.client.SearchAsEnumerable(discogsSearch);

            foreach (var v in enumerable)
            {
                Console.WriteLine(v.title);
                Console.WriteLine(v.id);
            }
        }
        private IObservable <DiscogsSearchResult> RawSearchAll(DiscogsSearch search, int?max = null)
        {
            IRestRequest RequestBuilder() => _Client.GetSearchRequest().AddAsParameter(search);

            return(GenerateFromPaginable <DiscogsSearchResult, DiscogsSearchResults>(RequestBuilder, max));
        }
 public Task <DiscogsSearchResults> SearchAsync(DiscogsSearch search, DiscogsPaginable paginable = null)
 {
     return(SearchAsync(search, paginable, CancellationToken.None));
 }
        public Task <DiscogsSearchResults> SearchAsync(DiscogsSearch search, DiscogsPaginable paginable, CancellationToken token)
        {
            IRestRequest RequestBuilder() => _Client.GetSearchRequest().AddAsParameter(search);

            return(GetPaginableAsync <DiscogsSearchResults>(RequestBuilder, paginable, token));
        }
示例#10
0
        public IObservable <DiscogsSearchResult> Search(DiscogsSearch search, int?max = null)
        {
            var observable = RawSearchAll(search, max);

            return(max.HasValue ? observable.Take(max.Value) : observable);
        }
示例#11
0
 public IEnumerable <DiscogsSearchResult> SearchAsEnumerable(DiscogsSearch search, int?max = null)
 {
     return(Search(search, max).ToEnumerable());
 }