Ejemplo n.º 1
0
 private void DownloadPlaylist_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 0)
     {
         MessageBox.Show("Please select a playlist");
     }
     else
     {
         string directory = Microsoft.VisualBasic.Interaction.InputBox("Please type in where you want to save the playlist", "Save", "");
         if (directory == "")
         {
         }
         else if (Directory.Exists(directory))
         {
             string selectedPlaylistName = listView1.Items[listView1.SelectedIndices[0]].Text;
             GetInfo getInfo = new GetInfo();
             List<string> videoId = getInfo.getAllVideoId(selectedPlaylistName);
             songProgressBar.Maximum = videoId.Count;
             toLab.Text = videoId.Count.ToString();
             OneSongDownload oneSongDownload = new OneSongDownload(ProgressBar);
             oneSongDownload.DownloadSong(videoId, directory);
             UpdateInfo updateInfo = new UpdateInfo();
             updateInfo.updateStatus(UserGetSet.selectedPlaylis);
         }
         else
         {
             MessageBox.Show("Save location is invalid");
         }
     }
 }
Ejemplo n.º 2
0
 private void DownloadOne_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 0)
     {
         MessageBox.Show("Please select a song");
     }
     else
     {
         string selectedSongName = listView1.Items[listView1.SelectedIndices[0]].Text;
         string directory        = Microsoft.VisualBasic.Interaction.InputBox("Please type in where you want to save the playlist", "Save", "");
         if (directory == "")
         {
         }
         else if (Directory.Exists(directory))
         {
             toLab.Text           = "1";
             progressBar1.Maximum = 1;
             UpdateInfo updateInfo = new UpdateInfo();
             updateInfo.updateOneStatus(selectedSongName);
             GetInfo       getInfo = new GetInfo();
             string        videoId = getInfo.oneVideoId(selectedSongName);
             List <string> id      = new List <string>();
             id.Add(videoId);
             OneSongDownload songDownload = new OneSongDownload(ProgressBar);
             songDownload.DownloadSong(id, directory);
         }
         else
         {
             MessageBox.Show("Save location is invalid");
         }
     }
 }
Ejemplo n.º 3
0
        public YourTube()
        {
            InitializeComponent();
            songPlaylistDownload = new SongPlaylistDownload(ProgressBar);
            songDownload = new SongDownload(ProgressBar);
            oneSongDownload = new OneSongDownload(ProgressBar);
            videoDownload = new VideoDownload(ProgressBarVideo);
            videoPlaylistDownload = new VideoPlaylistDownload(ProgressBarVideo);
            updateList();
            UserGetSet.input();
            labelUsername.Text = UserGetSet.username;
            labelApiKey.Text = UserGetSet.apiKey;
            labelTotalPlaylist.Text = UserGetSet.playlistCount;
            GetInfo getInfo = new GetInfo();

        }
Ejemplo n.º 4
0
        private void DownloadNew_Click(object sender, EventArgs e)
        {
            GetInfo       getInfo         = new GetInfo();
            List <string> downloadedYesNo = getInfo.getData();
            bool          noNew           = false;

            for (int i = 0; i < downloadedYesNo.Count; i++)
            {
                string word = downloadedYesNo[i];
                if (word == "No")
                {
                    noNew = true;
                    break;
                }
            }
            if (noNew == true)
            {
                string directory = Microsoft.VisualBasic.Interaction.InputBox("Please type in where you want to save the playlist", "Save", "");
                if (directory == "")
                {
                }
                else if (Directory.Exists(directory))
                {
                    List <string>   newVideoId   = getInfo.getNewSongVideoId();
                    OneSongDownload songDownload = new OneSongDownload(ProgressBar);
                    toLab.Text           = newVideoId.Count.ToString();
                    progressBar1.Maximum = newVideoId.Count;
                    songDownload.DownloadSong(newVideoId, directory);
                    UpdateInfo updateInfo = new UpdateInfo();
                    UserGetSet.input();
                    updateInfo.updateStatus(UserGetSet.selectedPlaylis);
                }
                else
                {
                    MessageBox.Show("Save location is invalid");
                }
            }
            else
            {
                MessageBox.Show("There are no new songs in playlist, try updating it");
            }
        }
Ejemplo n.º 5
0
 public InspectPlaylist()
 {
     InitializeComponent();
     oneSongDownload = new OneSongDownload(ProgressBar);
     updateList();
 }