en-us/about_ytdlWrapper_templates.help.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
TOPIC
    about_ytdlWrapper_templates
     
     
     
SHORT DESCRIPTION
    Explains how to set-up and use ytdlWrapper templates.
     
     
     
OVERVIEW
 == A template is a youtube-dl configuration file which is almost-complete. This
     file will not have everything hardcoded, so when it is executed using the
     `Invoke-YoutubeDl` cmdlet, the user will be asked to give inputs to
    "fill in" the file, and give youtube-dl.exe a valid configuration file.
     
 [!]Due to the nature of a template, the configuration file will not be a valid,
    youtube-dl configuration file. It will only be valid once the template is
    filled in when running the `Invoke-YoutubeDl` cmdlet.
     
    There is no limit to how many inputs a configuration file can have.
     
     
     
SETTING UP A CONFIGURATION FILE
 == To use a youtube-dl configuration file as a template, it must have at least
    one input defined. The syntax for an input definition is:
     
        i@{name}
         
        'name' is a string which acts as a user-friendly identifier for this
        input field. The string can only contain the characters: a-zA-Z0-9_
     [!]The string cannot contain a space.
          
        This input definition can go anywhere in the file. It is recommended
        to place this definition after a youtube-dl flag, such as '-f' or
        '--autonumber-start'.
     
     
 == An example of using an input to control the numbering:
     
        --write-thumbnail
        --add-metadata
        --yes-playlist
        --format "best"
     -> --autonumber-start i@{Number}
         
        -o "~\downloads\%(title)s-%(autonumber)s.%(ext)s"
        'https:\\youtube.com\some-id'
     
    When `Invoke-YoutubeDl` is run with this template, a parameter '-Number'
    will be created and the user will set a value for this input using it.
     
     
 == An example of using an input to control the format:
         
        --write-thumbnail
        --add-metadata
        --yes-playlist
     -> --format "i@{Format}"
         
        -o "~\downloads\%(title)s.%(ext)s"
        'https:\\youtube.com\some-id'
         
    When `Invoke-YoutubeDl` is ran with this template, a parameter '-Format'
    will be created and the user will set a value for this input using it.
     
 [!]Notice that the input definition is wrapped inside of the " " double-quotes.
    If youtube-dl expects a value within quotes, then the input definition must
    also go within quotes, since only the i@{...} part is replaced with the
    user provided value.
     
     
 == An example of using an input to specify the url:
  
        --yes-playlist
        --write-thumbnail
        --format "best"
 
        --output "~\downloads\%(title)s.%(ext)s"
 
     -> 'i@{Url}'
         
    When `Invoke-YoutubeDl` is ran with this template, a parameter '-Url'
    will be created and the user will set a value for this input using it.
     
 [!]Notice that the input definition is not in front of a flag. This is an
    exception. youtube-dl does not have a flag for the url. A url is a string
    in quotes which goes at the end of a configuration file. In this case, the
    module can detect that this is a valid url input.
     
     
     
CREATING A NEW TEMPLATE
 == To create a template, run:
     
        PS C:\> New-YoutubeDlItem -Template -Name "music" -Path "~\music.conf"
     
    This command will create a new template named "music", and move the
    configuration file to the module appdata folder.
     
    -Name
        Specifies the name of the template to be created; must be unique.
     
    -Path
        Specifies the path of the location of the configuration file to use.
         
    OPTIONAL PARAMETERS
     
    -DontMoveConfigurationFile
        Prevents the configuration file from being moved from its original
        location to a new location in the module appdata folder.
     
    -Force
        Forces this cmdlet to create a template that writes over an existing
        template. Even using this parameter, if the filesystem denies access to
        the necessary files, this cmdlet will fail.
     
    -WhatIf
        Shows what would happen if the cmdlet runs. The cmdlet does not run.
         
    -Confirm
        Prompts you for confirmation before running any state-altering actions
        in this cmdlet.
         
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
     
     
     
INVOKING A TEMPLATE
 == Assuming the configuration file has an input named 'Url'.
     To execute a template, run:
  
        PS C:\> Invoke-YoutubeDl -Template -Name "music" `
                 -Url "https:\\youtube\some-id"
     
    This command will execute the "music" template, which has a 'Url' input
    parameter.
         
    -Name
        Specifies the name of the template to run.
     [!]This parameter autocompletes to existing template names.
     
 [!]DYNAMIC PARAMETERS
     
    For each input defined within the configuration file, a parameter with the
    same name will be created, e.g. '-Url'.
     
    OPTIONAL PARAMETER
     
    -WhatIf
        Shows what would happen if the cmdlet runs. The cmdlet does not run.
         
    -Confirm
        Prompts you for confirmation before running any state-altering actions
        in this cmdlet.
         
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
     
     
     
RETRIEVING A TEMPLATE
 == To retrieve the details of a template, run:
     
        PS C:\> Get-YoutubeDlItem -Template -Name "music"
     
    This command will retrieve the details of the template named "music", and
    print the details to the screen. The output of this cmdlet can be piped
    to a number of other cmdlets in this module.
     
    -Name
        Specifies the name of the template(s) to run.
     [!]This parameter autocompletes to existing template names.
     
    OPTIONAL PARAMETER
     
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
     
     
     
CHANGING THE PROPERTIES OF A TEMPLATE
 == To change the path of the location of the configuration file, run:
     
        PS C:\> Set-YoutubeDlItem -Template -Name "music" `
                 -Path "~\new_template.conf"
     
    This command will change the path of the location of the configuration
    file from an previous old value to a new one for the template named
    "music".
     
    The path can be changed to point to the new location of the configuration
    file if it has been moved. Or it can be changed to a different file with
    different input definitions.
     
    -Name
        Specifies the name of the template to edit.
     [!]This parameter autocompletes to existing template names.
     
    -Path
        Specifies the new path of the location of the configuration file to use.
         
    OPTIONAL PARAMETER
     
    -WhatIf
        Shows what would happen if the cmdlet runs. The cmdlet does not run.
         
    -Confirm
        Prompts you for confirmation before running any state-altering actions
        in this cmdlet.
         
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
     
     
     
REMOVING A TEMPLATE
 == To delete a template, run:
  
        PS C:\> Remove-YoutubeDlItem -Template -Name "music"
         
    This command will delete the template named "music".
     
    -Name
        Specifies the name of the template(s) to run.
     [!]This parameter autocompletes to existing template names.
     
    OPTIONAL PARAMETER
     
    -WhatIf
        Shows what would happen if the cmdlet runs. The cmdlet does not run.
         
    -Confirm
        Prompts you for confirmation before running any state-altering actions
        in this cmdlet.
         
    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer, PipelineVariable, and OutVariable. For more information, see
        about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
     
     
     
EXAMPLE
 == An example of a template for downloading music.
     
    The configuration file:
     
        -f '(m4a)/(mp3)/bestaudio'
        -o 'i@{DownloadFolder}\%(title)s.mp3'
         
        'i@{Url}'
     
    Creating the template:
     
        PS C:\> New-YoutubeDlItem -Template -Name "music" -Path "~\music.conf"
     
    Running the template:
     
        PS C:\> Invoke-YoutubeDl -Template -Name "music" `
                 -DownloadFolder "~\Downloads\Music" `
                 -Url "https:\\youtube.com\some-id"
         
    The result:
         
        ~\Downloads\Music\video_title.mp3
     
     
     
OTHER
 == Using these templates effectively requires the use of youtube-dl flags and
    features. For example, to only require the user to specify a folder without
    having to worry about specifying the name and extension of the file itself,
    the input declaration would look like:
         
        -o 'i@{DownloadFolder}\%(title)s.mp3'
         
    In this case, the %(title)s tag is used. If you don't know these tags, or
    would like to see a full list of available tags, see the youtube-dl
    documentation at:
     
    https://github.com/ytdl-org/youtube-dl#format-selection
     
     
     
KEYWORDS
    ytdlWrapper_templates
    ytdlWrapper
    Youtube
    Video
    Download
    Wrapper