cron ffmpeg recorder docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
url_parse() { | |
if [[ $1 == http* ]] ; | |
then | |
URL=$1 | |
else | |
# variabile 1 : dal 0 carattere : prendi 1 | |
channel=${1:0:1} | |
out=$(wget -qO- https://apid.sky.it/vdp/v1/getLivestream?id=${channel} | jq --raw-output .streaming_url) | |
if [[ "$out" == "" ]]; | |
then | |
echo "Impossibile trovare streaming_url" | |
exit 1 | |
else | |
URL=$out | |
fi | |
fi | |
} | |
datetime_parse() { | |
CRON="${1:14:2} ${1:11:2} ${1:8:2} ${1:5:2} *" | |
echo "$CRON" killall -s SIGTERM ffmpeg | crontab - | |
} | |
#url_parse $1 | |
datetime_parse $2 | |
crontab -l | |
crond | |
ffmpeg -i "$1" "out/$3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
RUN apk add jq ffmpeg tzdata | |
RUN mkdir /app | |
RUN mkdir /out | |
COPY ./script.sh /app/script.sh | |
ENV TZ=Europe/Rome | |
ENTRYPOINT ["./app/script.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment