public MusicDownloader(string outputDirectory)
        {
            Console.WriteLine($"Setting output directory '{outputDirectory}'\n");
            DownloadDirectory = outputDirectory;

            IOHandler.CreateDirectory(DownloadDirectory);
            IOHandler.SetDirectoryPermission(DownloadDirectory);

            ChromeDriverHandler.CheckUpdateChromeDriver();

            Console.WriteLine("Instantiating main driver\n");
            Task.Run(() => { MainDriver = ChromeDriverHandler.GetDriver(DownloadDirectory); });
        }
        public void DownloadSpotifyPlaylist(string playlistLink, bool runInParallel)
        {
            Console.WriteLine($"Got playlist link '{playlistLink}'\n");
            Console.WriteLine($"Application {(runInParallel ? "will" : "won't")} run in parallel {(runInParallel ? $"using {Environment.ProcessorCount} logical processors" : string.Empty)}\n");

            Console.WriteLine("Waiting for main driver\n");
            while (MainDriver == null)
            {
            }

            var songsNames = GetSongsNamesFromPlaylistLink(playlistLink).ToList();

            RefineSongsNames(songsNames);

            Count = 0;
            Total = songsNames.Count;

            ConcurrentBag <string> processingPool = null;
            var processed = new List <string>();

            if (!runInParallel)
            {
                songsNames.ToList().ForEach(songName => DownloadSongFromMyFreeMp3(MainDriver, songName, runInParallel, processed));
            }
            else
            {
                processingPool = songsNames.ToConcurrentBag();
                var arr = new string[songsNames.Count];

                songsNames.CopyTo(arr);
                processed       = arr.ToList();
                ParallelDrivers = new List <ChromeDriver>();

                // Number of concurrent drivers should be the same as the logical processors count
                Task.Run(() => Parallel.For(0, Environment.ProcessorCount, i =>
                {
                    var driver = ChromeDriverHandler.GetDriver(DownloadDirectory, killOtherProcesses: false);
                    ParallelDrivers.Add(driver);

                    while (!processingPool.IsEmpty)
                    {
                        processingPool.TryTake(out var songName);
                        DownloadSongFromMyFreeMp3(driver, songName, runInParallel, processed);
                    }
                }));
            }

            var youtubeWritten = false;

            while (processed.Count > 0 ||
                   Directory.GetFiles(DownloadDirectory).Any(x => x.EndsWith("crdownload")) ||
                   FromYoutubeDownloads?.Count > 0)
            {
                Thread.Sleep(TimeSpan.FromSeconds(1));
                if (processed.Count == 0 &&
                    FromYoutubeDownloads?.Count > 0 &&
                    !youtubeWritten)
                {
                    Console.WriteLine("\nWaiting for youtube downloads\n" +
                                      $"{string.Join('\n', FromYoutubeDownloads)}\n" +
                                      "Please be calm, those really take a long time");
                    youtubeWritten = true;
                }
            }

            IOHandler.RenameFilesRemovingString(DownloadDirectory, "my-free-mp3s.com");
        }