tag regexp strings

This commit is contained in:
j 2025-10-20 10:33:34 +01:00
commit bde25f5762
3 changed files with 6 additions and 6 deletions

View file

@ -100,7 +100,7 @@ if os.path.exists('__init__.py'):
local_settings += '\nLOCAL_APPS = ["%s"]\n' % name local_settings += '\nLOCAL_APPS = ["%s"]\n' % name
local_settings_changed = True local_settings_changed = True
else: else:
apps = re.compile('(LOCAL_APPS.*?)\]', re.DOTALL).findall(local_settings)[0] apps = re.compile(r'(LOCAL_APPS.*?)\]', re.DOTALL).findall(local_settings)[0]
if name not in apps: if name not in apps:
new_apps = apps.strip() + ',\n"%s"\n' % name new_apps = apps.strip() + ',\n"%s"\n' % name
local_settings = local_settings.replace(apps, new_apps) local_settings = local_settings.replace(apps, new_apps)

View file

@ -14,7 +14,7 @@ from ...render import get_srt
def resolve_roman(s): def resolve_roman(s):
extra = re.compile('^\d+(.*?)$').findall(s) extra = re.compile(r'^\d+(.*?)$').findall(s)
if extra: if extra:
extra = extra[0].lower() extra = extra[0].lower()
new = { new = {
@ -88,9 +88,9 @@ class Command(BaseCommand):
clip['tags'] = i.data.get('tags', []) clip['tags'] = i.data.get('tags', [])
clip['editingtags'] = i.data.get('editingtags', []) clip['editingtags'] = i.data.get('editingtags', [])
name = os.path.basename(original_target) name = os.path.basename(original_target)
seqid = re.sub("Hotel Aporia_(\d+)", "S\\1_", name) seqid = re.sub(r"Hotel Aporia_(\d+)", "S\\1_", name)
seqid = re.sub("Night March_(\d+)", "S\\1_", seqid) seqid = re.sub(r"Night March_(\d+)", "S\\1_", seqid)
seqid = re.sub("_(\d+)H_(\d+)", "_S\\1\\2_", seqid) seqid = re.sub(r"_(\d+)H_(\d+)", "_S\\1\\2_", seqid)
seqid = seqid.split('_')[:2] seqid = seqid.split('_')[:2]
seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid] seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid]
seqid[1] = resolve_roman(seqid[1]) seqid[1] = resolve_roman(seqid[1])

View file

@ -61,7 +61,7 @@ def write_if_new(path, data, mode=''):
old = "" old = ""
is_new = data != old is_new = data != old
if path.endswith(".kdenlive"): if path.endswith(".kdenlive"):
is_new = re.sub('\{.{36}\}', '', data) != re.sub('\{.{36}\}', '', old) is_new = re.sub(r'\{.{36}\}', '', data) != re.sub(r'\{.{36}\}', '', old)
if is_new: if is_new:
with open(path, write_mode) as fd: with open(path, write_mode) as fd:
fd.write(data) fd.write(data)