mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-10 18:59:39 +00:00
Improve output template internal formatting
* Allow slicing lists/strings using `field.start🔚step`
* A field can also be used as offset like `field1+num+field2`
* A default value can be given using `field|default`
* Capture all format strings and set it to `None` if invalid. This prevents invalid fields from causing errors
This commit is contained in:
@@ -24,7 +24,7 @@ class ExecAfterDownloadPP(PostProcessor):
|
||||
|
||||
def parse_cmd(self, cmd, info):
|
||||
# If no %(key)s is found, replace {} for backard compatibility
|
||||
if not re.search(FORMAT_RE.format(r'[-\w>.+]+'), cmd):
|
||||
if not re.search(FORMAT_RE.format(r'[^)]*'), cmd):
|
||||
if '{}' not in cmd:
|
||||
cmd += ' {}'
|
||||
return cmd.replace('{}', compat_shlex_quote(info['filepath']))
|
||||
|
Reference in New Issue
Block a user