diff --git a/file_utils.py b/file_utils.py index 2e70c5a..34b1cc8 100644 --- a/file_utils.py +++ b/file_utils.py @@ -147,22 +147,21 @@ def open_file(filepath, env=None, select=False): subprocess.Popen(cmd, env=env) -# def parse(string, template): -# template = re.sub(r'{index:(.+?)}', r'(?P.+)', template) -# reg = re.sub(r'{(.+?)}', r'(?P<_\1>.+)', template) - -# values = list(re.search(reg, string).groups()) -# keys = re.findall(r'{(.+?)}', template) + ['index'] - -# return dict(zip(keys, values)) - def parse(template, string): + template = re.sub(r'{index:(.+?)}', r'(?P.+)', template) + reg = re.sub(r'{(.+?)}', r'(?P<_\1>.+)', template) + + values = list(re.search(reg, string).groups()) + keys = re.findall(r'{(.+?)}', template) + ['index'] + + return dict(zip(keys, values)) + +"""def parse(template, string): reg = re.sub(r'{[^}]*}|\.', lambda m: m.group() if m.group().startswith('{') else r'\.', template) reg = re.sub(r'{(.+?)}', r'(?P<\1>.*)', reg) - #print(string, template, reg) if result := re.match(reg, string): - return result.groupdict() + return result.groupdict()""" def expand(template, **kargs): template = Path(template).as_posix() diff --git a/operators/sequencer.py b/operators/sequencer.py index 9049848..9011bea 100644 --- a/operators/sequencer.py +++ b/operators/sequencer.py @@ -218,7 +218,7 @@ class VSETB_OT_set_stamps(Operator): # Shot Name shot_strip_stamp = new_text_strip('shot_stamp', channel=2, **stamp_params, - text='sq{sequence} / sh{shot}', align_y='BOTTOM') + text='{sequence} / sh{index}', align_y='BOTTOM') shot_strip_stamp.crop.min_x = crop_x shot_strip_stamp.crop.max_x = crop_x