Skip to content
Commits on Source (2)
.env
\ No newline at end of file
......@@ -3,7 +3,7 @@
export MC_HOST_minio=https://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@${S3_ENDPOINT}
for i in `mc ls minio/${BUCKET}/hls/0/ | grep -o "stream-$STREAM_ID.*.ts"`;do
echo file ${S3_ENDPOINT}/$BUCKET/hls/0/$i;
echo file https://${S3_ENDPOINT}/$BUCKET/hls/0/$i;
done > /tmp/allts
......
......@@ -41,7 +41,7 @@ metadata:
rules:
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create"]
verbs: ["get","create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
......
apiVersion: batch/v1
kind: Job
metadata:
name: compile-${STREAM_ID}
name: compile-${NAME}
spec:
template:
spec:
......@@ -18,6 +18,6 @@ spec:
name: ${BUCKET}
image: libresh/compile-owncast
imagePullPolicy: IfNotPresent
name: compile-${STREAM_ID}
name: compile-${NAME}
restartPolicy: Never
......@@ -5,13 +5,18 @@ mc cp minio/${BUCKET}/hls/0/stream.m3u8 /tmp/stream.m3u8
if cat /tmp/stream.m3u8 | grep offline; then
echo not live;
export LIVE_STREAM_ID=""
export FILTER="offline\|m3u8"
else
echo stream is live;
export LIVE_STREAM_ID=`cat /tmp/stream.m3u8 | grep -v offline | grep stream | head -c 16 | tail -c 9`
export FILTER="$LIVE_STREAM_ID\|offline\|m3u8"
fi
for STREAM_ID in `mc ls minio/${BUCKET}/hls/0/ | grep -v "$LIVE_STREAM_ID\|offline\|m3u8" | cut -d"-" -f4 | cut -c-9 | uniq`; do
for ID in `mc ls minio/${BUCKET}/hls/0/ | grep -v "$FILTER" | cut -d"-" -f4 | cut -c-9 | uniq`; do
echo "Gonna compile stream $ID..."
export STREAM_ID=$ID
export NAME=`echo $ID tr '[:upper:]' '[:lower:]'`
cat ./job.yml | envsubst | kubectl apply -f -
echo "Job started"
done