private void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } arguments.FileSystem.OutputTemplate = txtFilenameTemplate.GetText(); arguments.VideoSelection.DownloadArchive = txtDownloadArchive.GetText(); if (arguments.VideoSelection.DownloadArchive != null) { arguments.VideoSelection.DownloadArchive = Util.GetAbsolutePath(arguments.VideoSelection.DownloadArchive); } arguments.CustomArgs = txtCustomArguments.GetText(); if (!BasicMode) { general.SetArguments(arguments); videoSelection.SetArguments(arguments); workarounds.SetArguments(arguments); } else { basicAddDownloadPanel.SetArguments(arguments); } }
private void UpdateCommandPreview() { if (txtUrl.Text.Length == 0) { txtCommandPreview.Text = Localization.GetString("download_dialog.preview.no_url", "<Waiting for URL>"); } else { YdlArguments args = new YdlArguments { Url = txtUrl.Text }; SetArguments(args); // Arguments from the Download class. args.General.IgnoreConfig = true; args.FileSystem.NoCacheDir = true; args.FileSystem.NoMTime = true; args.PostProcessing.PreferFFmpeg = true; args.PostProcessing.FFmpegLocation = downloadManager.FfmpegPath; #if DEBUG args.Verbosity.Simulate = true; #endif txtCommandPreview.Text = $"\"{downloadManager.YdlPath}\" {Download.ArgumentSerializer.Serialize(args)}"; } }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } // General arguments.General.IgnoreErrors = cbIgnoreErrors.Checked; arguments.General.AbortOnError = cbAbortOnErrors.Checked; // Filesystem arguments.FileSystem.WriteAnnotations = cbWriteAnnotations.Checked; arguments.FileSystem.WriteDescription = cbWriteDescription.Checked; arguments.FileSystem.RestrictFilenames = cbRestrictFilenames.Checked; arguments.FileSystem.NoOverwrites = cbNoOverwrites.Checked; arguments.Thumbnail.WriteThumbnail = cbWriteThumbnail.Checked; if (cbCustomFormatSelector.Checked) { arguments.VideoFormat.Format = txtCustomFormatSelector.Text; } else { FormatSelector formatSelector = new FormatSelector(videoQualitySelector, frameRateSelector); arguments.VideoFormat.Format = formatSelector.ToString(); } }
public bool AddDownload(Download download) { if (download == null) { return(true); } foreach (Download dl in Downloads) { if (dl.Url == download.Url) { return(false); } } if (download.Status == DownloadStatus.Downloading || download.Status == DownloadStatus.Processing) { download.Status = preferencesManager.Preferences.ResumeDownloads ? DownloadStatus.Queued : DownloadStatus.Stopped; } download.PropertyChanged += Download_PropertyChanged; download.Index = Downloads.Count + 1; Downloads.Add(download); // Get the video title, but dont download the video yet, even if the download is 'Waiting' or 'Stopped' if (preferencesManager.Preferences.FetchTitle && download.Title == null) { YdlArguments args = new YdlArguments(); args.General.IgnoreConfig = true; args.General.FlatPlaylist = true; args.VideoSelection.NoPlaylist = true; args.Verbosity.Simulate = true; args.Verbosity.GetTitle = true; args.Url = download.Url; string strArgs = Download.ArgumentSerializer.Serialize(args, true); ExecutableProcess titleProcess = new ExecutableProcess(YdlPath, strArgs, download.DownloadDirectory); titleProcess.OnReceived += (sender, data) => { if (download.Title == null && !string.IsNullOrWhiteSpace(data?.Trim())) { download.Title = data.Trim(); } }; #if DEBUG titleProcess.OnExited += (sender, code) => Logger.Instance.Debug(nameof(DownloadManager), $"Title process has exited: {code}"); #endif titleProcess.Start(); } FirePropertyChanged(nameof(TotalDownloads)); return(true); }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } arguments.PostProcessing.AudioFormat = cbxAudioOnly.Enabled ? (AudioFormat?)cbxAudioOnly.SelectedValue : null; arguments.PostProcessing.ExtractAudio = (arguments.PostProcessing.AudioFormat != null); arguments.PostProcessing.RecodeVideo = cbxRecodeFormat.Enabled ? (VideoFormatRecode?)cbxRecodeFormat.SelectedValue : null; }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } arguments.PostProcessing.AudioFormat = cbxAudioOnly.Enabled ? (AudioFormat?)cbxAudioOnly.SelectedValue : null; arguments.PostProcessing.ExtractAudio = (arguments.PostProcessing.AudioFormat != null); arguments.PostProcessing.EmbedThumbnail = cbEmbedThumbnail.Checked; arguments.PostProcessing.AddMetadata = cbAddMetadata.Checked; arguments.PostProcessing.RecodeVideo = cbxRecodeFormat.Enabled ? (VideoFormatRecode?)cbxRecodeFormat.SelectedValue : null; }
private void UpdateCommandPreview() { if (txtUrl.Text.Length == 0) { txtCommandPreview.Text = Localization.GetString("download_dialog.preview.no_url", "<Waiting for URL>"); } else { YdlArguments args = new YdlArguments { Url = txtUrl.Text }; SetArguments(args); txtCommandPreview.Text = $"\"{downloadManager.YdlPath}\" {Download.ArgumentSerializer.Serialize(args)}"; } }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } // Download arguments.General.IgnoreErrors = cbIgnoreErrors.Checked; arguments.General.AbortOnError = cbAbortOnErrors.Checked; // Filesystem arguments.FileSystem.WriteAnnotations = cbWriteAnnotations.Checked; arguments.FileSystem.WriteDescription = cbWriteDescription.Checked; arguments.FileSystem.RestrictFilenames = cbRestrictFilenames.Checked; arguments.FileSystem.NoOverwrites = cbNoOverwrites.Checked; arguments.Thumbnail.WriteThumbnail = cbWriteThumbnail.Checked; // Subtitles arguments.Subtitle.AllSubs = rbSubAll.Checked; arguments.Subtitle.WriteSub = rbSubDefault.Checked || rbSubLanguages.Checked; arguments.Subtitle.SubLang = rbSubLanguages.Checked ? txtSubLanguages.Text : null; if (cbCustomFormatSelector.Checked) { arguments.VideoFormat.Format = txtCustomFormatSelector.Text; } else { FormatSelector formatSelector = new FormatSelector(videoQualitySelector, frameRateSelector); arguments.VideoFormat.Format = formatSelector.ToString(); } // Post Processing arguments.PostProcessing.AudioFormat = cbxAudioOnly.Enabled ? (AudioFormat?)cbxAudioOnly.SelectedValue : null; arguments.PostProcessing.ExtractAudio = (arguments.PostProcessing.AudioFormat != null); arguments.PostProcessing.EmbedThumbnail = cbEmbedThumbnail.Checked; arguments.PostProcessing.EmbedSubs = cbEmbedSubtitles.Checked; arguments.PostProcessing.AddMetadata = cbAddMetadata.Checked; arguments.PostProcessing.RecodeVideo = cbxRecodeFormat.Enabled ? (VideoFormatRecode?)cbxRecodeFormat.SelectedValue : null; }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } arguments.FileSystem.RestrictFilenames = cbRestrictFilenames.Checked; arguments.FileSystem.NoOverwrites = cbNoOverwrites.Checked; arguments.Thumbnail.WriteThumbnail = cbWriteThumbnail.Checked; FormatSelector formatSelector = new FormatSelector(videoQualitySelector, frameRateSelector); arguments.VideoFormat.Format = formatSelector.ToString(); arguments.PostProcessing.AudioFormat = cbxAudioOnly.Enabled ? (AudioFormat?)cbxAudioOnly.SelectedValue : null; arguments.PostProcessing.ExtractAudio = (arguments.PostProcessing.AudioFormat != null); }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } // Selection Type arguments.VideoSelection.NoPlaylist = rbSelectionVideo.Checked; arguments.VideoSelection.YesPlaylist = rbSelectionPlaylist.Checked; // Date Filters arguments.VideoSelection.Date = dtpDate.GetValue(); arguments.VideoSelection.DateAfter = dtpDateAfter.GetValue(); arguments.VideoSelection.DateBefore = dtpDateBefore.GetValue(); // Filesize Filters arguments.VideoSelection.MinFilesize = nudMinSize.GetUnitValue(cbxMinSizeUnit); arguments.VideoSelection.MaxFilesize = nudMaxSize.GetUnitValue(cbxMaxSizeUnit); // View Count arguments.VideoSelection.MinViews = (int?)nudMinViews.GetValue(); arguments.VideoSelection.MaxViews = (int?)nudMaxViews.GetValue(); // Playlist Filters arguments.VideoSelection.PlaylistStart = (int?)nudPlaylistStart.GetValue(); arguments.VideoSelection.PlaylistEnd = (int?)nudPlaylistEnd.GetValue(); arguments.VideoSelection.PlaylistItems = txtPlaylistRange.GetText(); arguments.Download.PlaylistRandom = cbPlaylistRandom.Checked; arguments.Download.PlaylistReverse = cbPlaylistReversed.Checked; // Text / Regex Filters arguments.VideoSelection.MatchTitle = txtMatchTitle.GetText(); arguments.VideoSelection.RejectTitle = txtRejectTitle.GetText(); arguments.VideoSelection.MatchFilter = txtMatchFilter.GetText(); }
public void SetArguments(YdlArguments arguments) { if (arguments == null) { return; } arguments.Workarounds.Referer = txtReferer.GetText(); arguments.Workarounds.UserAgent = txtUserAgent.GetText(); // Network arguments.Network.Proxy = txtProxy.GetText(); arguments.Network.SocketTimeout = (int?)nudSocketTimeout.GetValue(); arguments.Network.SourceAddress = txtSourceAddress.GetText(); arguments.Network.ForceIpv4 = rbForceIp4.Checked; arguments.Network.ForceIpv6 = rbForceIp6.Checked; // Download arguments.Download.LimitRate = nudLimitRate.GetUnitValue(cbxLimitRateUnit); int?retries = (int?)nudRetries.GetValue(); int?fragRetries = (int?)nudFragmentRetries.GetValue(); arguments.Download.Retries = retries == null ? null : (retries >= 0 ? retries.ToString() : "infinite"); arguments.Download.FragmentRetries = fragRetries == null ? null : (fragRetries >= 0 ? fragRetries.ToString() : "infinite"); // Sleep interval arguments.Workarounds.SleepInterval = (int?)nudSleepInterval.GetValue(); if (rbSleepIntervalRange.Checked) { arguments.Workarounds.MinSleepInterval = (int?)nudSleepIntervalMin.GetValue(); arguments.Workarounds.MaxSleepInterval = (int?)nudSleepIntervalMax.GetValue(); } else { arguments.Workarounds.MaxSleepInterval = null; } // Auth arguments.Authentication.Username = txtUsername.GetText(); arguments.Authentication.Password = txtPassword.GetText(); arguments.Authentication.TwoFactor = txtTwoFactorCode.GetText(); arguments.Authentication.VideoPassword = txtVideoPassword.GetText(); // Headers arguments.Workarounds.Headers.Clear(); foreach (DataGridViewRow row in dgvHeaders.Rows) { if (row.IsNewRow) { continue; } string key = (string)row.Cells["colKey"].Value; string value = (string)row.Cells["colValue"].Value; if (string.IsNullOrWhiteSpace(key) || string.IsNullOrWhiteSpace(value)) { continue; } if (!arguments.Workarounds.Headers.ContainsKey(key)) { arguments.Workarounds.Headers.Add(key, value); } } }