Skip to content

Commit b2f7968

Browse files
committed
Update options to yt-dlp 2024.07.25.
Change Paths to MultiOption (closes #49).
1 parent fde6d23 commit b2f7968

File tree

7 files changed

+52
-19
lines changed

7 files changed

+52
-19
lines changed

YoutubeDLSharp/Options/OptionSet.FileSystem.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class OptionSet
1010
{
1111
private Option<string> batchFile = new Option<string>("-a", "--batch-file");
1212
private Option<bool> noBatchFile = new Option<bool>("--no-batch-file");
13-
private Option<string> paths = new Option<string>("-P", "--paths");
13+
private MultiOption<string> paths = new MultiOption<string>("-P", "--paths");
1414
private Option<string> output = new Option<string>("-o", "--output");
1515
private Option<string> outputNaPlaceholder = new Option<string>("--output-na-placeholder");
1616
private Option<bool> restrictFilenames = new Option<bool>("--restrict-filenames");
@@ -70,15 +70,15 @@ public partial class OptionSet
7070
/// This option is ignored if --output is an
7171
/// absolute path
7272
/// </summary>
73-
public string Paths { get => paths.Value; set => paths.Value = value; }
73+
public MultiValue<string> Paths { get => paths.Value; set => paths.Value = value; }
7474
/// <summary>
7575
/// Output filename template; see &quot;OUTPUT
7676
/// TEMPLATE&quot; for details
7777
/// </summary>
7878
public string Output { get => output.Value; set => output.Value = value; }
7979
/// <summary>
8080
/// Placeholder for unavailable fields in
81-
/// &quot;OUTPUT TEMPLATE&quot; (default: &quot;NA&quot;)
81+
/// --output (default: &quot;NA&quot;)
8282
/// </summary>
8383
public string OutputNaPlaceholder { get => outputNaPlaceholder.Value; set => outputNaPlaceholder.Value = value; }
8484
/// <summary>
@@ -222,16 +222,17 @@ public partial class OptionSet
222222
/// The name of the browser to load cookies
223223
/// from. Currently supported browsers are:
224224
/// brave, chrome, chromium, edge, firefox,
225-
/// opera, safari, vivaldi. Optionally, the
226-
/// KEYRING used for decrypting Chromium cookies
227-
/// on Linux, the name/path of the PROFILE to
228-
/// load cookies from, and the CONTAINER name
229-
/// (if Firefox) (&quot;none&quot; for no container) can
230-
/// be given with their respective seperators.
231-
/// By default, all containers of the most
232-
/// recently accessed profile are used.
233-
/// Currently supported keyrings are: basictext,
234-
/// gnomekeyring, kwallet, kwallet5, kwallet6
225+
/// opera, safari, vivaldi, whale. Optionally,
226+
/// the KEYRING used for decrypting Chromium
227+
/// cookies on Linux, the name/path of the
228+
/// PROFILE to load cookies from, and the
229+
/// CONTAINER name (if Firefox) (&quot;none&quot; for no
230+
/// container) can be given with their
231+
/// respective separators. By default, all
232+
/// containers of the most recently accessed
233+
/// profile are used. Currently supported
234+
/// keyrings are: basictext, gnomekeyring,
235+
/// kwallet, kwallet5, kwallet6
235236
/// </summary>
236237
public string CookiesFromBrowser { get => cookiesFromBrowser.Value; set => cookiesFromBrowser.Value = value; }
237238
/// <summary>

YoutubeDLSharp/Options/OptionSet.General.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public partial class OptionSet
116116
public string DefaultSearch { get => defaultSearch.Value; set => defaultSearch.Value = value; }
117117
/// <summary>
118118
/// Don&#x27;t load any more configuration files
119-
/// except those given by --config-locations.
119+
/// except those given to --config-locations.
120120
/// For backward compatibility, if this option
121121
/// is found inside the system configuration
122122
/// file, the user configuration is not loaded.
@@ -183,7 +183,9 @@ public partial class OptionSet
183183
/// stderr) to apply the setting to. Can be one
184184
/// of &quot;always&quot;, &quot;auto&quot; (default), &quot;never&quot;, or
185185
/// &quot;no_color&quot; (use non color terminal
186-
/// sequences). Can be used multiple times
186+
/// sequences). Use &quot;auto-tty&quot; or &quot;no_color-tty&quot;
187+
/// to decide based on terminal support only.
188+
/// Can be used multiple times
187189
/// </summary>
188190
public MultiValue<string> Color { get => color.Value; set => color.Value = value; }
189191
/// <summary>

YoutubeDLSharp/Options/OptionSet.Network.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public partial class OptionSet
1111
private Option<string> proxy = new Option<string>("--proxy");
1212
private Option<int?> socketTimeout = new Option<int?>("--socket-timeout");
1313
private Option<string> sourceAddress = new Option<string>("--source-address");
14+
private Option<string> impersonate = new Option<string>("--impersonate");
15+
private Option<bool> listImpersonateTargets = new Option<bool>("--list-impersonate-targets");
1416
private Option<bool> forceIPv4 = new Option<bool>("-4", "--force-ipv4");
1517
private Option<bool> forceIPv6 = new Option<bool>("-6", "--force-ipv6");
1618
private Option<bool> enableFileUrls = new Option<bool>("--enable-file-urls");
@@ -32,6 +34,19 @@ public partial class OptionSet
3234
/// </summary>
3335
public string SourceAddress { get => sourceAddress.Value; set => sourceAddress.Value = value; }
3436
/// <summary>
37+
/// Client to impersonate for requests. E.g.
38+
/// chrome, chrome-110, chrome:windows-10. Pass
39+
/// --impersonate=&quot;&quot; to impersonate any client.
40+
/// Note that forcing impersonation for all
41+
/// requests may have a detrimental impact on
42+
/// download speed and stability
43+
/// </summary>
44+
public string Impersonate { get => impersonate.Value; set => impersonate.Value = value; }
45+
/// <summary>
46+
/// List available clients to impersonate.
47+
/// </summary>
48+
public bool ListImpersonateTargets { get => listImpersonateTargets.Value; set => listImpersonateTargets.Value = value; }
49+
/// <summary>
3550
/// Make all connections via IPv4
3651
/// </summary>
3752
public bool ForceIPv4 { get => forceIPv4.Value; set => forceIPv4.Value = value; }

YoutubeDLSharp/Options/OptionSet.PostProcessing.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public partial class OptionSet
308308
/// --print/--output), &quot;before_dl&quot; (before each
309309
/// video download), &quot;post_process&quot; (after each
310310
/// video download; default), &quot;after_move&quot;
311-
/// (after moving video file to it&#x27;s final
311+
/// (after moving video file to its final
312312
/// locations), &quot;after_video&quot; (after downloading
313313
/// and processing all formats of a video), or
314314
/// &quot;playlist&quot; (at end of playlist). This option

YoutubeDLSharp/Options/OptionSet.VerbosityAndSimulation.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public partial class OptionSet
2626
private Option<bool> progress = new Option<bool>("--progress");
2727
private Option<bool> consoleTitle = new Option<bool>("--console-title");
2828
private Option<string> progressTemplate = new Option<string>("--progress-template");
29+
private Option<string> progressDelta = new Option<string>("--progress-delta");
2930
private Option<bool> verbose = new Option<bool>("-v", "--verbose");
3031
private Option<bool> dumpPages = new Option<bool>("--dump-pages");
3132
private Option<bool> writePages = new Option<bool>("--write-pages");
@@ -143,6 +144,10 @@ public partial class OptionSet
143144
/// </summary>
144145
public string ProgressTemplate { get => progressTemplate.Value; set => progressTemplate.Value = value; }
145146
/// <summary>
147+
/// Time between progress output (default: 0)
148+
/// </summary>
149+
public string ProgressDelta { get => progressDelta.Value; set => progressDelta.Value = value; }
150+
/// <summary>
146151
/// Print various debugging information
147152
/// </summary>
148153
public bool Verbose { get => verbose.Value; set => verbose.Value = value; }

YoutubeDLSharp/Options/OptionSet.VideoSelection.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public partial class OptionSet
2525
private Option<bool> noDownloadArchive = new Option<bool>("--no-download-archive");
2626
private Option<int?> maxDownloads = new Option<int?>("--max-downloads");
2727
private Option<bool> breakOnExisting = new Option<bool>("--break-on-existing");
28+
private Option<bool> noBreakOnExisting = new Option<bool>("--no-break-on-existing");
2829
private Option<bool> breakPerInput = new Option<bool>("--break-per-input");
2930
private Option<bool> noBreakPerInput = new Option<bool>("--no-break-per-input");
3031
private Option<int?> skipPlaylistAfterErrors = new Option<int?>("--skip-playlist-after-errors");
@@ -82,8 +83,8 @@ public partial class OptionSet
8283
/// is not present, and &quot;&amp;&quot; to check multiple
8384
/// conditions. Use a &quot;\&quot; to escape &quot;&amp;&quot; or
8485
/// quotes if needed. If used multiple times,
85-
/// the filter matches if atleast one of the
86-
/// conditions are met. E.g. --match-filter
86+
/// the filter matches if at least one of the
87+
/// conditions is met. E.g. --match-filter
8788
/// !is_live --match-filter &quot;like_count&gt;?100 &amp;
8889
/// description~=&#x27;(?i)\bcats \&amp; dogs\b&#x27;&quot; matches
8990
/// only videos that are not live OR those that
@@ -144,6 +145,12 @@ public partial class OptionSet
144145
/// </summary>
145146
public bool BreakOnExisting { get => breakOnExisting.Value; set => breakOnExisting.Value = value; }
146147
/// <summary>
148+
/// Do not stop the download process when
149+
/// encountering a file that is in the archive
150+
/// (default)
151+
/// </summary>
152+
public bool NoBreakOnExisting { get => noBreakOnExisting.Value; set => noBreakOnExisting.Value = value; }
153+
/// <summary>
147154
/// Alters --max-downloads, --break-on-existing,
148155
/// --break-match-filter, and autonumber to
149156
/// reset per input URL

YoutubeDLSharp/Options/autoconvert.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
"Datebefore": "DateBefore",
4646
"Dateafter": "DateAfter",
4747
}
48+
MULTI_OPTIONS = [
49+
"Paths"
50+
]
4851

4952
CODE_TEMPLATE = [
5053
"// <auto-generated>",
@@ -169,7 +172,7 @@ def convert_to_file(data, deprecated=False):
169172
ctype = infer_type(name, item[0][-1])
170173
# check if option can be set multiple times
171174
joined_descr = " ".join(item[1])
172-
multi = "multiple times" in joined_descr
175+
multi = "multiple times" in joined_descr or name in MULTI_OPTIONS
173176
# extract alias options
174177
if match := re.search(r"\(Alias\: (\S+)\)", joined_descr):
175178
literals.append(match.group(1))

0 commit comments

Comments
 (0)