From bc4e715ce46e978da9bfe6168ddcb37312c59763 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 23 Dec 2025 22:14:22 +0100 Subject: [PATCH 1/2] only run cleanup if folders exist --- pandora/item/tasks.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pandora/item/tasks.py b/pandora/item/tasks.py index 92b3b08f..1d279f1b 100644 --- a/pandora/item/tasks.py +++ b/pandora/item/tasks.py @@ -150,14 +150,17 @@ def extract_clip(public_id, in_, out, resolution, format, track=None): def clear_cache(days=60): import subprocess path = os.path.join(settings.MEDIA_ROOT, 'media') - cmd = ['find', path, '-iregex', '.*/frames/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';'] - subprocess.check_output(cmd) - path = os.path.join(settings.MEDIA_ROOT, 'items') - cmd = ['find', path, '-iregex', '.*/cache/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';'] - subprocess.check_output(cmd) + if os.path.exists(path): + cmd = ['find', path, '-iregex', '.*/frames/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';'] + subprocess.check_output(cmd) + if os.path.exists(path): + path = os.path.join(settings.MEDIA_ROOT, 'items') + cmd = ['find', path, '-iregex', '.*/cache/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';'] + subprocess.check_output(cmd) path = settings.MEDIA_ROOT - cmd = ['find', path, '-type', 'd', '-size', '0', '-prune', '-exec', 'rmdir', '{}', ';'] - subprocess.check_output(cmd) + if os.path.exists(path): + cmd = ['find', path, '-type', 'd', '-size', '0', '-prune', '-exec', 'rmdir', '{}', ';'] + subprocess.check_output(cmd) @app.task(ignore_results=True, queue='default') From 7e8f3c4e507905a76f6dda32b7ceefcf1bad185b Mon Sep 17 00:00:00 2001 From: j Date: Tue, 23 Dec 2025 22:15:51 +0100 Subject: [PATCH 2/2] hide ffmpeg banner --- pandora/archive/extract.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/pandora/archive/extract.py b/pandora/archive/extract.py index 7b9f24ea..c95e39b8 100644 --- a/pandora/archive/extract.py +++ b/pandora/archive/extract.py @@ -308,6 +308,7 @@ def stream(video, target, profile, info, audio_track=0, flags={}): cmds = [] base = [settings.FFMPEG, + '-hide_banner', '-nostats', '-loglevel', 'error', '-y', '-i', video, '-threads', '4', '-map_metadata', '-1', '-sn'] @@ -413,7 +414,9 @@ def frame(video, frame, position, height=128, redo=False, info=None): def ffmpeg_frame_cmd(video, frame, position, height=128): cmd = [ - settings.FFMPEG, '-y', + settings.FFMPEG, + '-hide_banner', + '-y', '-ss', str(position), '-i', video, '-an', '-frames:v', '1', @@ -696,6 +699,7 @@ def chop(video, start, end, subtitles=None, dest=None, encode=False): ] cmd = [ settings.FFMPEG, + '-hide_banner', '-y', '-i', video, '-ss', '%.3f' % start, @@ -721,7 +725,11 @@ def chop(video, start, end, subtitles=None, dest=None, encode=False): return None def has_faststart(path): - cmd = [settings.FFPROBE, '-v', 'trace', '-i', path] + cmd = [ + settings.FFPROBE, + '-hide_banner', + '-v', 'trace', '-i', path + ] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -746,6 +754,7 @@ def remux_stream(src, dst): video = [] cmd = [ settings.FFMPEG, + '-hide_banner', '-nostats', '-loglevel', 'error', '-i', src, '-map_metadata', '-1', '-sn', @@ -768,7 +777,11 @@ def remux_stream(src, dst): def ffprobe(path, *args): - cmd = [settings.FFPROBE, '-loglevel', 'error', '-print_format', 'json', '-i', path] + list(args) + cmd = [ + settings.FFPROBE, + '-hide_banner', + '-loglevel', 'error', '-print_format', 'json', '-i', path + ] + list(args) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) stdout, stderr = p.communicate() return json.loads(stdout.decode()) @@ -816,7 +829,11 @@ def extract_subtitles(path, language=None): extra = ['-map', '0:%s' % track[0]['index']] else: raise Exception("unknown language: %s" % language) - cmd = ['ffmpeg', '-loglevel', 'error', '-i', path] + extra + ['-f', 'srt', '-'] + cmd = [ + settings.FFMPEG, + '-hide_banner', + '-loglevel', 'error', '-i', path + ] + extra + ['-f', 'srt', '-'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) stdout, stderr = p.communicate() return ox.srt.loads(stdout.decode())