From de16df05efd88b75e84efe388bf40883263f06bb Mon Sep 17 00:00:00 2001 From: "florentin.luce" Date: Thu, 19 Dec 2024 16:43:50 +0100 Subject: [PATCH] get latest media from currrent one pattern --- operators/sequencer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/operators/sequencer.py b/operators/sequencer.py index b2b5ef6..3ffea51 100644 --- a/operators/sequencer.py +++ b/operators/sequencer.py @@ -1,5 +1,7 @@ +import re from os.path import expandvars, abspath from pathlib import Path + import bpy from bpy.types import Operator from bpy.props import (BoolProperty, StringProperty, FloatProperty, @@ -714,7 +716,9 @@ class VSETB_OT_update_media(Operator): def execute(self, context): for strip in context.selected_sequences: current_movie = Path(abspath(bpy.path.abspath(strip.filepath))) - latest_file = sorted(list(current_movie.parent.glob('*.*')))[-1] + pattern_name = re.sub(r'[^\s._\?]+', '*', current_movie.name) + + latest_file = sorted(list(current_movie.parent.glob(pattern_name)))[-1] if latest_file != current_movie: print(latest_file)