Example #1
0
        private void FormKeywords_Load(object sender, EventArgs e)
        {
            lbxKeywords.DisplayMember = "Formatted";
            keywords = YoutubeDLApi.GetKeywords().ToList();

            btnInsert.Enabled = lbxKeywords.SelectedIndex >= 0;

            UpdateList();
        }
Example #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Application.Idle += Application_Idle;
            this.ResizeBegin += (s, ee) => { this.SuspendLayout(); };
            this.ResizeEnd   += (s, ee) => { this.ResumeLayout(true); };

            ffmpegPath = Path.Combine(ROOT_DIRECTORY, BIN_FOLDER_NAME, "ffmpeg.exe");
            api        = new YoutubeDLApi(Path.Combine(ROOT_DIRECTORY, BIN_FOLDER_NAME, "youtube-dl.exe"), new YoutubeDLArguments());

            CheckVersion();

            cbxFilesizeMaxUnits.DataSource   = Enum.GetValues(typeof(FilesizeUnit));
            cbxFilesizeMaxUnits.SelectedItem = FilesizeUnit.MB;

            cbxFilesizeMinUnits.DataSource   = Enum.GetValues(typeof(FilesizeUnit));
            cbxFilesizeMinUnits.SelectedItem = FilesizeUnit.MB;

            cbxLimitRateUnits.DataSource   = Enum.GetValues(typeof(FilesizeUnit));
            cbxLimitRateUnits.SelectedItem = FilesizeUnit.MB;

            cbxOutputFormat.DataSource   = Enum.GetValues(typeof(MergeVideoFormat));
            cbxOutputFormat.SelectedItem = MergeVideoFormat.MP4;

            cbxRecodeFormat.DataSource   = Enum.GetValues(typeof(VideoFormatRecode));
            cbxRecodeFormat.SelectedItem = VideoFormatRecode.MP4;

            txtDownloadDirectory.Text = Properties.Settings.Default.DownloadDirectory;
            txtDownloadArchive.Text   = Properties.Settings.Default.DownloadArchive;
            txtFileTemplate.Text      = Properties.Settings.Default.FilenameTemplate;

            ControlListenGroup clg = ControlListenGroup.New();

            clg.OnChanged += () => {
                string ffmpegLocation = api.Arguments.PostProcessing.FFmpegLocation;
                api.Arguments.PostProcessing.FFmpegLocation = null;

                bool preferffmpeg = api.Arguments.PostProcessing.PreferFFmpeg;
                api.Arguments.PostProcessing.PreferFFmpeg = false;

                string exe = api.Executable;
                api.Executable = "youtube-dl";

                txtCommand.Text = api.BuildCommandString();


                api.Arguments.PostProcessing.FFmpegLocation = ffmpegLocation;
                api.Arguments.PostProcessing.PreferFFmpeg   = preferffmpeg;
                api.Executable = exe;
            };
            CreateBindings(clg);
        }