Compare commits

...

2 commits

Author SHA1 Message Date
j
bde25f5762 tag regexp strings 2025-10-20 10:33:34 +01:00
j
454c4eeaa5 skip missing config 2025-10-20 10:31:42 +01:00
4 changed files with 11 additions and 8 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

@ -426,8 +426,11 @@ def main():
log_format = '%(asctime)s:%(levelname)s:%(name)s:%(message)s' log_format = '%(asctime)s:%(levelname)s:%(name)s:%(message)s'
logging.basicConfig(level=logging.DEBUG, format=log_format) logging.basicConfig(level=logging.DEBUG, format=log_format)
if args.config: if args.config:
with open(args.config) as fd: if os.path.exists(args.config):
CONFIG.update(json.load(fd)) with open(args.config) as fd:
CONFIG.update(json.load(fd))
else:
logger.error("config file %s does not exist, skipping", args.config)
base = os.path.dirname(os.path.abspath(__file__)) base = os.path.dirname(os.path.abspath(__file__))
#os.chdir(base) #os.chdir(base)

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)