Пример #1
0
        public List <AlbumModel> CreateListAlbumByQuery(string nameAlbum)
        {
            DiscogsClient discogsClient = new DiscogsClient("HfsyysppxnrCYpIttoYY", "hIuWlIIOvzhnINezvqJCeRJgeWYYNsNw");

            string result = discogsClient.SetQuery(nameAlbum).GetQueryResult();             //zapytanie o album

            List <AlbumModel> albumList = new List <AlbumModel>();

            for (int i = 0; i <= GetReleaseAlbumCDLink(result).Count - 1; i++)
            {
                string l = GetReleaseAlbumCDLink(result)[i];

                string rel = discogsClient.SetLink(l).GetLinkResult();
                if (string.IsNullOrEmpty(rel))
                {
                    return(null);
                }
                AlbumModel album = CreateAlbumByRelease(rel);
                album.Query.Title = nameAlbum;
                albumList.Add(album);
            }


            return(albumList);
        }
Пример #2
0
        public AlbumModel CreateAlbumByQuery(string nameAlbum, int id = 0)
        {
            AlbumModel    album         = new AlbumModel();
            DiscogsClient discogsClient = new DiscogsClient("HfsyysppxnrCYpIttoYY", "hIuWlIIOvzhnINezvqJCeRJgeWYYNsNw");

            string result = discogsClient.SetQuery(nameAlbum).GetQueryResult(); //zapytanie o album

            string link = GetReleaseAlbumCDLink(result)[id];                    //wyciagniecie linku do konretnego wydania

            string release = discogsClient.SetLink(link).GetLinkResult();       //zapytanie o wydanie konkretne

            if (string.IsNullOrEmpty(release))
            {
                return(null);
            }
            album = CreateAlbumByRelease(release);

            return(album);
        }
Пример #3
0
        public bool SearchAlbumAndShow(string nameAlbum, out string release)
        {
            DiscogsClient discogsClient = new DiscogsClient("NYqvEPnYZdPWmAFFMURi", "kEvfDhiyBRunRURKFjlMmoCKPjIcYiVU");

            string result = discogsClient.SetQuery(nameAlbum).GetQueryResult(); //zapytanie o album

            List <string> link = GetReleaseAlbumCDLink(result);                 //wyciagniecie linku do konretnego wydania

            if (link is null)
            {
                release = "";
                return(false);
            }

            string command = "";

            release = "";
            int index = 0;

            do
            {
                if (link.Count == 0)
                {
                    return(false);
                }

                Console.Clear();
                if (index < link.Count)
                {
                    release = discogsClient.SetLink(link[index]).GetLinkResult();                     //zapytanie o wydanie konkretne
                }
                else
                {
                    release = "";
                }

                if (!string.IsNullOrEmpty(release))
                {
                    ShowRelease(release);
                }

                if (string.IsNullOrEmpty(release))
                {
                    Console.Clear();
                    Console.WriteLine("No Data, back to th first?: (y/n): ");
                    command = Console.ReadLine();

                    if (command == "n")
                    {
                        return(false);
                    }
                    if (command == "y")
                    {
                        index = 0;
                        continue;
                    }
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.Write("\nNext data?: (y/n): ");
                    Console.ResetColor();
                    command = Console.ReadLine();
                }

                if (command == "y")
                {
                    index++;
                }
                if (command == "n")
                {
                    break;
                }
            } while (true);

            return(true);
        }