diff --git a/install.py b/install.py index 1ad6f4d..20a4484 100755 --- a/install.py +++ b/install.py @@ -100,7 +100,7 @@ if os.path.exists('__init__.py'): local_settings += '\nLOCAL_APPS = ["%s"]\n' % name local_settings_changed = True 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: new_apps = apps.strip() + ',\n"%s"\n' % name local_settings = local_settings.replace(apps, new_apps) diff --git a/management/commands/generate_clips.py b/management/commands/generate_clips.py index 4c96377..1be54fa 100644 --- a/management/commands/generate_clips.py +++ b/management/commands/generate_clips.py @@ -14,7 +14,7 @@ from ...render import get_srt def resolve_roman(s): - extra = re.compile('^\d+(.*?)$').findall(s) + extra = re.compile(r'^\d+(.*?)$').findall(s) if extra: extra = extra[0].lower() new = { @@ -88,9 +88,9 @@ class Command(BaseCommand): clip['tags'] = i.data.get('tags', []) clip['editingtags'] = i.data.get('editingtags', []) name = os.path.basename(original_target) - seqid = re.sub("Hotel Aporia_(\d+)", "S\\1_", name) - seqid = re.sub("Night March_(\d+)", "S\\1_", seqid) - seqid = re.sub("_(\d+)H_(\d+)", "_S\\1\\2_", seqid) + seqid = re.sub(r"Hotel Aporia_(\d+)", "S\\1_", name) + seqid = re.sub(r"Night March_(\d+)", "S\\1_", seqid) + seqid = re.sub(r"_(\d+)H_(\d+)", "_S\\1\\2_", seqid) seqid = seqid.split('_')[:2] seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid] seqid[1] = resolve_roman(seqid[1]) diff --git a/player/player.py b/player/player.py index 74938ef..28b41e0 100755 --- a/player/player.py +++ b/player/player.py @@ -426,8 +426,11 @@ def main(): log_format = '%(asctime)s:%(levelname)s:%(name)s:%(message)s' logging.basicConfig(level=logging.DEBUG, format=log_format) if args.config: - with open(args.config) as fd: - CONFIG.update(json.load(fd)) + if os.path.exists(args.config): + 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__)) #os.chdir(base) diff --git a/render.py b/render.py index 56fc94a..f97a60a 100644 --- a/render.py +++ b/render.py @@ -61,7 +61,7 @@ def write_if_new(path, data, mode=''): old = "" is_new = data != old 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: with open(path, write_mode) as fd: fd.write(data)