diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-25 03:32:15 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-25 03:32:15 +0530 |
commit | 143db31d48802e26e975a94ab27263df381c9381 (patch) | |
tree | d96b2725630248140deded60fdbaf05281765e23 /yt_dlp/utils.py | |
parent | 3700c7ef10a665c4153bc532c789c059dfbaea42 (diff) | |
download | hypervideo-pre-143db31d48802e26e975a94ab27263df381c9381.tar.lz hypervideo-pre-143db31d48802e26e975a94ab27263df381c9381.tar.xz hypervideo-pre-143db31d48802e26e975a94ab27263df381c9381.zip |
Parse metadata from multiple fields
Closes #196
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 3a8725c21..c14fdb509 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -4205,6 +4205,20 @@ OUTTMPL_TYPES = { 'pl_infojson': 'info.json', } +# 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) + (?<!%) + % + \({0}\) # mapping key + (?:[#0\-+ ]+)? # conversion flags (optional) + (?:\d+)? # minimum field width (optional) + (?:\.\d+)? # precision (optional) + [hlL]? # length modifier (optional) + (?P<type>[diouxXeEfFgGcrs%]) # conversion type +''' + def limit_length(s, length): """ Add ellipses to overly long strings """ |