Skip to content

Commit ac24a67

Browse files
author
Lukas Wingerberg
committed
add another quote command
1 parent 399ddc3 commit ac24a67

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
ARG PROTOC_VERSION=28.2
12
FROM debian:bookworm-slim AS builder
3+
ARG PROTOC_VERSION
24

35
# Setzen der Arbeitsverzeichnis im Container
46
WORKDIR /app
@@ -7,9 +9,11 @@ WORKDIR /app
79
RUN apt-get update && apt-get install -y \
810
python3 \
911
python3-pip \
10-
protobuf-compiler \
1112
&& rm -rf /var/lib/apt/lists/*
1213

14+
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
15+
unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /app/.local
16+
1317
# Upgrade pip
1418
RUN pip3 install --break-system-packages --upgrade pip
1519

@@ -18,7 +22,7 @@ COPY proto/ffmpeg.proto .
1822

1923
# Kompilieren der .proto-Datei für Python
2024
RUN python3 -m pip install --break-system-packages grpcio grpcio-tools
21-
RUN python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ffmpeg.proto
25+
RUN PATH="$PATH:$HOME/app/.local/bin" python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ffmpeg.proto
2226

2327
# Final stage
2428
FROM debian:bookworm-slim

client/grpc-ffmpeg.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,21 @@ def handle_quoted_arguments(command_args):
8282
if ' ' in vf_arg or ',' in vf_arg or ':' in vf_arg:
8383
vf_arg = f'"{vf_arg}"'
8484

85-
# Reassemble the -filter_complex argument
85+
# Reassemble the -vf argument
8686
rffmpeg_command.append(arg)
8787
rffmpeg_command.append(vf_arg)
8888
i += 2 # Skip the next argument as it's part of -vf
89+
elif arg == '-hls_segment_filename' and i + 1 < len(command_args):
90+
hls_segment_filename_arg = command_args[i + 1]
91+
92+
# Quote the filter complex string if it contains spaces, commas, or colons
93+
if ' ' in hls_segment_filename_arg or ',' in hls_segment_filename_arg or ':' in hls_segment_filename_arg:
94+
hls_segment_filename_arg = f'"{hls_segment_filename_arg}"'
95+
96+
# Reassemble the -hls_segment_filename argument
97+
rffmpeg_command.append(arg)
98+
rffmpeg_command.append(hls_segment_filename_arg)
99+
i += 2 # Skip the next argument as it's part of -hls_segment_filename
89100
# Append any other arguments as is
90101
else:
91102
rffmpeg_command.append(arg)

0 commit comments

Comments
 (0)