add tons of todos

This commit is contained in:
henryruhs
2026-03-31 22:50:02 +02:00
parent 84ad32912e
commit ef8feaab6b
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -104,13 +104,13 @@ async def save_asset_files(upload_files : List[UploadFile]) -> List[str]:
asset_file_name = uuid.uuid4().hex
asset_path = os.path.join(temp_path, asset_file_name + file_extension)
upload_queue : UploadQueue = queue.SimpleQueue()
upload_queue : UploadQueue = queue.SimpleQueue() #todo: not sure if queue is even needed
process_manager.start()
upload_task = asyncio.create_task(feed_upload_queue(upload_file, upload_queue))
if media_type == 'audio' and await asyncio.to_thread(ffmpeg.sanitize_audio, file_format, upload_queue.get, asset_path, api_security_strategy):
if media_type == 'audio' and await asyncio.to_thread(ffmpeg.sanitize_audio, file_format, upload_queue.get, asset_path, api_security_strategy): #todo: do not pass format, do not pass queue but bytes if same speed
asset_paths.append(asset_path)
if media_type == 'image' and await asyncio.to_thread(ffmpeg.sanitize_image, file_format, upload_queue.get, asset_path):
+7 -7
View File
@@ -56,7 +56,7 @@ def run_ffmpeg_with_pipe(commands : List[Command], media_chunk_reader : MediaChu
process = subprocess.Popen(commands, stdin = subprocess.PIPE, stderr = subprocess.PIPE, stdout = subprocess.PIPE)
while media_chunk := media_chunk_reader():
if process.poll() is not None:
if process.poll() is not None: #todo - poll not allowed
break
process.stdin.write(media_chunk)
@@ -309,7 +309,7 @@ def concat_video(output_path : str, temp_output_paths : List[str]) -> bool:
def sanitize_audio(audio_format : str, media_chunk_reader : MediaChunkReader, asset_path : str, security_strategy : ApiSecurityStrategy) -> bool:
audio_pipe_format = ffmpeg_builder.resolve_audio_pipe_format(audio_format)
audio_pipe_format = ffmpeg_builder.resolve_audio_pipe_format(audio_format) #todo: does not make sense this methods are in the builder
if security_strategy == 'strict':
commands = ffmpeg_builder.chain(
@@ -330,7 +330,7 @@ def sanitize_audio(audio_format : str, media_chunk_reader : MediaChunkReader, as
def sanitize_image(image_format : str, media_chunk_reader : MediaChunkReader, asset_path : str) -> bool:
image_pipe_format = ffmpeg_builder.resolve_image_pipe_format(image_format)
image_pipe_format = ffmpeg_builder.resolve_image_pipe_format(image_format) #todo: does not make sense this methods are in the builder
commands = ffmpeg_builder.chain(
ffmpeg_builder.pipe_image(image_pipe_format),
ffmpeg_builder.deep_copy_image(),
@@ -341,14 +341,14 @@ def sanitize_image(image_format : str, media_chunk_reader : MediaChunkReader, as
def sanitize_video(video_format : str, media_chunk_reader : MediaChunkReader, asset_path : str, security_strategy : ApiSecurityStrategy) -> bool:
video_pipe_format = ffmpeg_builder.resolve_video_pipe_format(video_format)
video_pipe_format = ffmpeg_builder.resolve_video_pipe_format(video_format) #todo: does not make sense this methods are in the builder
if security_strategy == 'strict':
commands = ffmpeg_builder.chain(
ffmpeg_builder.pipe_input(video_pipe_format),
ffmpeg_builder.set_video_encoder('libx264'),
ffmpeg_builder.set_video_preset('libx264', 'ultrafast'),
ffmpeg_builder.set_pixel_format('libx264'),
ffmpeg_builder.set_video_encoder('libx264'), #todo - remove hard coded
ffmpeg_builder.set_video_preset('libx264', 'ultrafast'), #todo - remove hard coded
ffmpeg_builder.set_pixel_format('libx264'), #todo - remove hard coded
ffmpeg_builder.deep_copy_video(),
ffmpeg_builder.deep_copy_audio(),
ffmpeg_builder.strip_metadata(),
+2 -2
View File
@@ -32,7 +32,7 @@ def get_audio_entries(audio_path : str) -> Dict[str, str]:
return audio_entries
def detect_audio_codec(audio_path : str) -> Optional[str]:
def detect_audio_codec(audio_path : str) -> Optional[str]: #todo: extend get_audio_entries and reuse it
commands = ffprobe_builder.chain(
ffprobe_builder.show_entries([ 'codec_name' ]),
ffprobe_builder.format_to_value(),
@@ -74,7 +74,7 @@ def detect_audio_frame_total(audio_path : str) -> Optional[int]:
return None
def detect_video_codec(video_path : str) -> Optional[str]:
def detect_video_codec(video_path : str) -> Optional[str]: #todo: could be generic entries method like audio has
commands = ffprobe_builder.chain(
ffprobe_builder.show_entries([ 'codec_name' ]),
ffprobe_builder.format_to_value(),