From 752cda3880f30a46bed1d27b69188ab93ad1a368 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 3 Jun 2021 23:30:38 +0530 Subject: Fix and refactor `prepare_outtmpl` The following tests would have failed previously: %(id)d %(id)r %(ext)s-%(ext|def)d %(width|)d %(id)r %(height)r %(formats.0)r %s --- yt_dlp/utils.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'yt_dlp/utils.py') diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index dea7d85cd..72fd8a0e7 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -4393,15 +4393,17 @@ OUTTMPL_TYPES = { # As of [1] format syntax is: # %[mapping_key][conversion_flags][minimum_width][.precision][length_modifier]type # 1. https://docs.python.org/2/library/stdtypes.html#string-formatting -FORMAT_RE = r'''(?x) +STR_FORMAT_RE = r'''(?x) (?[diouxXeEfFgGcrs%]) # conversion type + (?P\((?P{0})\))? # mapping key + (?P + (?:[#0\-+ ]+)? # conversion flags (optional) + (?:\d+)? # minimum field width (optional) + (?:\.\d+)? # precision (optional) + [hlL]? # length modifier (optional) + [diouxXeEfFgGcrs] # conversion type + ) ''' -- cgit v1.2.3