21 lines
639 B
Bash
Executable File
21 lines
639 B
Bash
Executable File
#!/bin/bash
|
|
|
|
M3U8_STREAM_URL="${1:-$M3U8_STREAM_URL}"
|
|
SLUG="${2:-$SLUG}"
|
|
USER_AGENT="${3:-$USER_AGENT}"
|
|
|
|
if [ -n "$M3U8_STREAM_URL" ] && [ -n "$SLUG" ]; then
|
|
:
|
|
else
|
|
echo "Error: M3U8 URL and SLUG required. Provide both as arguments or set M3U8_STREAM_URL and SLUG environment variables."
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p live
|
|
|
|
if [ -n "$USER_AGENT" ]; then
|
|
ffmpeg -user_agent "$USER_AGENT" -i "$M3U8_STREAM_URL" -c copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags delete_segments "live/$SLUG.m3u8"
|
|
else
|
|
ffmpeg -i "$M3U8_STREAM_URL" -c copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags delete_segments "live/$SLUG/live.m3u8"
|
|
fi
|