get latest media from currrent one pattern

master
florentin.luce 2024-12-19 16:43:50 +01:00
parent 23093a72e7
commit de16df05ef
1 changed files with 5 additions and 1 deletions

View File

@ -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)