From 5a1e4f25ed41a6f3e6003b3c0afff76acf58d23a Mon Sep 17 00:00:00 2001 From: Markos Gogoulos Date: Wed, 20 Nov 2024 15:04:27 +0200 Subject: [PATCH] fix: issue with create_hls --- Makefile | 6 +++++- files/tasks.py | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1d8dc31..53cefdb 100644 --- a/Makefile +++ b/Makefile @@ -12,4 +12,8 @@ admin-shell: build-frontend: docker-compose -f docker-compose-dev.yaml exec frontend npm run dist cp -r frontend/dist/static/* static/ - docker-compose -f docker-compose-dev.yaml restart web \ No newline at end of file + docker-compose -f docker-compose-dev.yaml restart web + +test: + docker compose -f docker-compose-dev.yaml exec --env TESTING=True -T web pytest + diff --git a/files/tasks.py b/files/tasks.py index b9f3a19..479f3cb 100644 --- a/files/tasks.py +++ b/files/tasks.py @@ -439,10 +439,15 @@ def create_hls(friendly_token): if existing_output_dir: # override content with -T ! - cmd = "cp -rT {0} {1}".format(output_dir, existing_output_dir) + cmd = ["cp", "-rT", output_dir, existing_output_dir] run_command(cmd) - shutil.rmtree(output_dir) + try: + shutil.rmtree(output_dir) + except: # noqa + # this was breaking in some cases where it was already deleted + # because create_hls was running multiple times + pass output_dir = existing_output_dir pp = os.path.join(output_dir, "master.m3u8") if os.path.exists(pp):