Exemplo n.º 1
0
        private List <Skiva> DenSkivan(string artist, string album)
        {
            List <Skiva> S           = new List <Skiva>();
            var          clientCover = new GracenoteClient("687559541-407A6818314DF26BB17DC1E4AB57BD4E");
            var          Cover       = BestMatchSearchWithOptions(clientCover, artist, album);

            foreach (var skiva in Cover.Albums)
            {
                string s = "";
                try
                {
                    //s = skiva.Artwork.First().Uri.AbsoluteUri;
                    s = Cover.Albums.First().Artwork.First().Uri.AbsoluteUri;
                }
                catch (Exception ex)
                {
                    s = "";
                }
                Skiva NySkiva = new Skiva(skiva.Id, skiva.Title, skiva.Year.ToString(), s, skiva.Genre.First());
                foreach (var track in skiva.Tracks)
                {
                    NySkiva.Lat.Add(new Latar(track.Number.ToString(), track.Title, track.Id));
                }
                S.Add(NySkiva);
            }
            return(S);
        }
Exemplo n.º 2
0
        private List <Skiva> GetSkivData(string grupp)
        {
            Groups.Clear();
            var client      = new GracenoteClient("687559541-407A6818314DF26BB17DC1E4AB57BD4E");
            var clientCover = new GracenoteClient("687559541-407A6818314DF26BB17DC1E4AB57BD4E");
            int iLoopar     = 0;

            result = client.Search(new SearchCriteria
            {
                Artist = grupp,
                //SearchOptions = SearchOptions,
                Range = new Range(1, 500)
            });
            int iAntal = result.Count;

            if (iAntal > 100)
            {
                iLoopar = 8;
                //iLoopar = iAntal / 20;
            }
            else
            {
                iLoopar = iAntal / 20;
            }

            for (int i = 0; i <= iLoopar; i++)
            {
                var Album = client.Search(new SearchCriteria
                {
                    Artist        = grupp,
                    SearchOptions = SearchOptions,
                    Range         = new Range(i, 20)
                });
                foreach (var skiva in Album.Albums)
                {
                    string s = "";
                    try
                    {
                        s = skiva.Artwork.First().Uri.AbsoluteUri;
                    }
                    catch (Exception ex)
                    {
                        s = "";
                    }
                    Skiva NySkiva = new Skiva(skiva.Id, skiva.Title, skiva.Year.ToString(), s, skiva.Genre.First());
                    this.Groups.Add(NySkiva);
                }
            }
            return(Groups);
        }