Add watch.sh
This commit is contained in:
parent
e1106131e3
commit
dc4ed4678b
21
watch.sh
Normal file
21
watch.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Functie om audio te extraheren
|
||||||
|
extract_audio() {
|
||||||
|
INPUT="$1"
|
||||||
|
OUTPUT="${INPUT%.*}.mp3"
|
||||||
|
ffmpeg -i "$INPUT" -q:a 0 "$OUTPUT"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Begin de loop om de map in de gaten te houden
|
||||||
|
inotifywait -m -r -e create /watched --format '%w%f' | while read FILE
|
||||||
|
do
|
||||||
|
# Wacht tot het bestand volledig is geschreven
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
# Controleer of het bestand een video- of audio-bestand is
|
||||||
|
if [[ "$FILE" == *.mp4 || "$FILE" == *.MP4 || "$FILE" == *.avi ]]; then
|
||||||
|
echo "Nieuw bestand gedetecteerd: $FILE"
|
||||||
|
extract_audio "$FILE"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user