From d832e195a7cec5ffef38d5ef0c33f675160e649a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 6 Oct 2022 07:05:03 +0200 Subject: [PATCH] same as last commit --- files/helpers/media.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/helpers/media.py b/files/helpers/media.py index 6cd35125d..5485303fa 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -48,7 +48,9 @@ def process_audio(file): def webm_to_mp4(old, new): - subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", new, "-threads:v", "1"], check=True, stderr=subprocess.STDOUT) + tmp = f"{new}.tmp" + subprocess.run(["ffmpeg", "-y", "-loglevel", "warning", "-i", old, "-map_metadata", "-1", tmp, "-threads:v", "1"], check=True, stderr=subprocess.STDOUT) + os.rename(tmp, new) os.remove(old) requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data=f'{{"files": ["{SITE_FULL}{new}"]}}', timeout=5)