Skip to content

Instantly share code, notes, and snippets.

@DVDAndroid
Last active May 24, 2022 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DVDAndroid/d4dd85b430b365a599d66d802d431058 to your computer and use it in GitHub Desktop.
Save DVDAndroid/d4dd85b430b365a599d66d802d431058 to your computer and use it in GitHub Desktop.
cron ffmpeg recorder docker
#!/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"
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