modify script ydl
This commit is contained in:
parent
b618dfe7c3
commit
27b82d9d0d
@ -31,18 +31,19 @@ include( '_head.php' );
|
|||||||
// print '[Erreur] pas de commande youtube-dl installée sur ce serveur';
|
// print '[Erreur] pas de commande youtube-dl installée sur ce serveur';
|
||||||
// } else {
|
// } else {
|
||||||
|
|
||||||
$uniqid = time();
|
$uniqid = date('Y-M-d_').time();
|
||||||
|
|
||||||
// # exemple url https://peertube.cipherbliss.com/videos/watch/e6a37508-042e-4d83-8598-5d36b764bb3d
|
// # exemple url https://peertube.cipherbliss.com/videos/watch/e6a37508-042e-4d83-8598-5d36b764bb3d
|
||||||
|
|
||||||
|
|
||||||
exec( './youtube-dl.sh uniqueid_facho https://peertube.cipherbliss.com/videos/watch/b88a9568-517c-4a49-ab07-75c79323a825', $output, $result );
|
// exec( './youtube-dl.sh uniqueid_facho https://peertube.cipherbliss.com/videos/watch/b88a9568-517c-4a49-ab07-75c79323a825', $output, $result );
|
||||||
// exec( '.'.$old . '/test.sh ' . $uniqid . ' ' . $url, $output, $result );
|
exec( './youtube-dl.sh ' . $uniqid . ' ' . $url, $output, $result );
|
||||||
|
|
||||||
echo "<br/> résultat du script. <br>";
|
echo "<br/> résultat du script. <br>";
|
||||||
var_dump( $result );
|
var_dump( $result );
|
||||||
echo "<br/> sortie du script. <br>";
|
echo "<br/> sortie du script. <br>";
|
||||||
var_dump( $output );
|
var_dump( $output );
|
||||||
|
|
||||||
if ( $result ) {
|
if ( $result ) {
|
||||||
echo( '<div class="alert is-danger"> problème de script </div>' );
|
echo( '<div class="alert is-danger"> problème de script </div>' );
|
||||||
include( '_foot.php' );
|
include( '_foot.php' );
|
||||||
@ -64,7 +65,7 @@ include( '_head.php' );
|
|||||||
echo " <br> pas d'url envoyée. Vérifiez le formulaire. <a href='index.php'>Retour</a>";
|
echo " <br> pas d'url envoyée. Vérifiez le formulaire. <a href='index.php'>Retour</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
exec( './youtube-dl.sh canadien https://www.youtube.com/watch?v=w97pAEr3svc', $output, $result );
|
// exec( './youtube-dl.sh canadien https://www.youtube.com/watch?v=w97pAEr3svc', $output, $result );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
touch log_ydl.txt
|
||||||
|
echo " $(date) ###### start conversion __ $1 __ $2" >> log_ydl.txt
|
||||||
UNIQID=$1
|
UNIQID=$1
|
||||||
|
|
||||||
mkdir -p ../input/ydl
|
mkdir -p ../input/ydl
|
||||||
@ -7,16 +8,20 @@ rm -rf ../input/ydl/$UNIQID.mp3
|
|||||||
rm -rf ../input/ydl/$UNIQID
|
rm -rf ../input/ydl/$UNIQID
|
||||||
|
|
||||||
URL=$2
|
URL=$2
|
||||||
OUTPUT="../input/ydl/$UNIQID.mp3"
|
OUTPUT="../input/ydl/$UNIQID/base.mp3"
|
||||||
|
|
||||||
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --output $OUTPUT $URL
|
|
||||||
mkdir ../input/ydl/$UNIQID
|
mkdir ../input/ydl/$UNIQID
|
||||||
ffmpeg -i "../input/ydl/$UNIQID.mp3" -ac 1 "../input/ydl/$UNIQID/$UNIQID.wav"
|
youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --output $OUTPUT $URL
|
||||||
|
|
||||||
|
ffmpeg -i "../input/ydl/$UNIQID/base.mp3" -ac 1 "../input/ydl/$UNIQID/mono_canal.wav"
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
OUT_DIR="input/ydl/$UNIQID"
|
OUT_DIR="input/ydl/$UNIQID"
|
||||||
python3 ./conversion_simple_fr.py "input/ydl/$UNIQID/$UNIQID.wav" > $OUT_DIR/0_output_$FILE_NAME.json
|
python3 ./conversion_simple_fr.py $OUT_DIR/mono_canal.wav > $OUT_DIR/0_output_$FILE_NAME.json
|
||||||
jq .text $OUT_DIR/0_output_$FILE_NAME.json > $OUT_DIR/1_converted_$FILE_NAME.txt
|
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/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/^ *//; 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
|
sed 's/\"//g' $OUT_DIR/3_without_nulls_$FILE_NAME.txt > $OUT_DIR/4_phrases_$FILE_NAME.txt
|
||||||
|
|
||||||
|
ls -l $OUT_DIR >> log_ydl.txt
|
||||||
|
echo " $(date) ###### end conversion __ $1 __ $2" >> log_ydl.txt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user