From 317ba03fdf4c0ef16ff11fe84d8ce3a7bb767965 Mon Sep 17 00:00:00 2001 From: Elyse <26639800+elyse0@users.noreply.github.com> Date: Thu, 9 Mar 2023 18:34:45 -0600 Subject: [PATCH] Improve parse_chapters comments --- yt_dlp/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py index 4ebdff298..c31f9f9e0 100644 --- a/yt_dlp/__init__.py +++ b/yt_dlp/__init__.py @@ -322,9 +322,10 @@ def validate_outtmpl(tmpl, msg): def parse_chapters(name, value): def parse_timestamp(x): - # FIXME: This should be smarter, e.g. 'inf-1day'? + # FIXME: Maybe there's a better way to remove parenthesis x = x.replace('(', '').replace(')', '') + # FIXME: This should be smarter, e.g. 'inf-1day'? if x in ('inf', 'infinite'): return float('inf') @@ -337,7 +338,7 @@ def parse_timestamp(x): for regex in value or []: if regex.startswith('*'): for range_ in map(str.strip, regex[1:].split(',')): - # FIXME: This is really sensible + # FIXME: This should match correctly '(now-1hour)-(now-20minutes)' mobj = range_ != '-' and re.fullmatch(r'(.+)?\s*-\s*(.+)?', range_) dur = mobj and (parse_timestamp(mobj.group(1) or '0'), parse_timestamp(mobj.group(2) or 'inf')) if None in (dur or [None]):