transcription/website/youtube-dl.sh

42 lines
1.2 KiB
Bash
Raw Normal View History

2021-03-23 12:13:23 +01:00
#!/bin/bash
2021-03-27 10:08:19 +01:00
touch log_ydl.txt
echo " $(date) ###### start conversion __ $1 __ $2" >> log_ydl.txt
2021-03-27 09:13:03 +01:00
UNIQID=$1
2021-03-27 14:38:39 +01:00
# mkdir -p ../input/ydl
# rm -rf ../input/ydl/$UNIQID.mp3
# rm -rf ../input/ydl/$UNIQID
2021-03-23 12:54:17 +01:00
2021-03-23 12:13:23 +01:00
URL=$2
2021-03-27 10:08:19 +01:00
OUTPUT="../input/ydl/$UNIQID/base.mp3"
2021-03-27 14:38:39 +01:00
echo " \n output : \n"
echo $OUTPUT
2021-03-23 12:13:23 +01:00
mkdir ../input/ydl/$UNIQID
2021-03-27 14:38:39 +01:00
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --output $OUTPUT $URL --no-continue
ls -larth ../input/ydl/$UNIQID
2021-03-27 10:08:19 +01:00
ffmpeg -i "../input/ydl/$UNIQID/base.mp3" -ac 1 "../input/ydl/$UNIQID/mono_canal.wav"
2021-03-23 12:54:17 +01:00
OUT_DIR="input/ydl/$UNIQID"
2021-03-27 14:38:39 +01:00
mkdir $OUT_DIR
echo " $(date) ###### lancer la transcription"
pwd
ls -larth input/ydl/$UNIQID/
echo "\n"
cd ..
bash transcript.sh input/ydl/$UNIQID/mono_canal.wav
#jq .text $OUT_DIR/0_output_$FILE_NAME.json > $OUT_DIR/1_converted_$FILE_NAME.txt
# sed 's/null//g' $OUT_DIR/1_converted_$FILE_NAME.txt > $OUT_DIR/2_without_nulls_$FILE_NAME.txt
# sed 's/^ *//; s/ *$//; /^$/d' $OUT_DIR/2_without_nulls_$FILE_NAME.txt > $OUT_DIR/3_without_nulls_$FILE_NAME.txt
# sed 's/\"//g' $OUT_DIR/3_without_nulls_$FILE_NAME.txt > $OUT_DIR/4_phrases_$FILE_NAME.txt
2021-03-27 10:08:19 +01:00
ls -l $OUT_DIR >> log_ydl.txt
echo " $(date) ###### end conversion __ $1 __ $2" >> log_ydl.txt