Example #1
0
        private void btnAddPlaylist_Click(object sender, EventArgs e)
        {
            string path = FormMain.defaultPath;
            string url  = textBoxUrl.Text;

            playlistService = new PlaylistService();
            chromeDriver    = new ChromeDriver(BrowserSettings.ChromeDriverService, BrowserSettings.ChromeOptions(null));
            Playlist playlist = new Playlist(path, url);

            playlist = playlistService.GetUpdatedPlaylist(chromeDriver, playlist);
            string result = "";

            string[] splited = playlist.PathFolder.Split(new[] { "\\" }, StringSplitOptions.None);
            splited[splited.Length - 1] = "Spotify-" + splited.LastOrDefault();
            result = string.Join("\\", splited);
            //foreach(var split in sp)

            DirectoryInfo di = Directory.CreateDirectory(result);

            using (StreamWriter sw = File.CreateText(result + "\\url.txt"))
            {
                sw.WriteLine(playlist.Url);
            }
            chromeDriver.Quit();
            this.Close();
        }
Example #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            playlistService = new PlaylistService();
            var selectedPlaylists = playlists.Where(p => checkedListBoxPlaylists.CheckedItems.Contains(p.Name)).ToList();

            for (int i = 0; i < selectedPlaylists.Count; i++)
            {
                chromeDriver         = new ChromeDriver(BrowserSettings.ChromeDriverService, BrowserSettings.ChromeOptions(selectedPlaylists[i].PathFolder));
                selectedPlaylists[i] = playlistService.GetUpdatedPlaylist(chromeDriver, selectedPlaylists[i]);
                playlistService.UpdatePlaylist(chromeDriver, selectedPlaylists[i]);
                chromeDriver.Quit();
            }
            MessageBox.Show("Playlists atualizadas com sucesso.");
        }