コード例 #1
0
        public AlbumModel CreateAlbumByQuery(string nameAlbum)
        {
            AlbumModel    album         = new AlbumModel();
            DiscogsClient discogsClient = new DiscogsClient("NYqvEPnYZdPWmAFFMURi", "kEvfDhiyBRunRURKFjlMmoCKPjIcYiVU");

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

            string link = GetReleaseAlbumCDLink(result)[0];                     //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);
        }
コード例 #2
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);
        }