46 lines
872 B
Plaintext
46 lines
872 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
help()
|
||
|
{
|
||
|
echo "Usage: ffmpegauto [ -h | duration targetdirectory ]"
|
||
|
}
|
||
|
|
||
|
capture()
|
||
|
{
|
||
|
local duration="$1"
|
||
|
local targetDirectory="$2"
|
||
|
|
||
|
duration="$1"
|
||
|
targetDirectory="$2"
|
||
|
|
||
|
currentDate="$(date '+%Y-%m-%d-%Hh%M')"
|
||
|
|
||
|
echo "============ $(date) ============"
|
||
|
|
||
|
echo "Capture launching…"
|
||
|
ffmpeg -loglevel error -i https://icecast.libre-a-toi.org:8444/voixdulat_ogg -t "$duration" -c copy "$targetDirectory/output-$currentDate-bis.ogg"
|
||
|
#ffmpeg -i "$targetDirectory/output-$currentDate.ogg" "$targetDirectory/output-$currentDate.mp3"
|
||
|
}
|
||
|
|
||
|
|
||
|
#
|
||
|
case $# in
|
||
|
1)
|
||
|
if [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
|
||
|
help
|
||
|
else
|
||
|
capture "$1" "."
|
||
|
fi
|
||
|
;;
|
||
|
|
||
|
2) capture "$1" "$2"
|
||
|
;;
|
||
|
|
||
|
*) echo "Invalid parameter count."
|
||
|
help
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
|
||
|
|