Fix bugs
This commit is contained in:
parent
6f2113c15c
commit
bed27db264
14
index.js
14
index.js
|
@ -37,14 +37,14 @@ function sorryHtml() {
|
||||||
|
|
||||||
function failureText(id, email, stdout, stderr) {
|
function failureText(id, email, stdout, stderr) {
|
||||||
return (
|
return (
|
||||||
"Une erreur a eu lieu !\n\nQuelque chose s'est mal passé pendant l'encodage de la video de " + email + " (" + id + + ")\n\n" +
|
"Une erreur a eu lieu !\n\nQuelque chose s'est mal passé pendant l'encodage de la video de " + email + " (" + id + ")\n\n" +
|
||||||
"STDOUT\n" + stdout + "\n\nSTDERR\n" + stderr
|
"STDOUT\n" + stdout + "\n\nSTDERR\n" + stderr
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function failureHtml(id, email, stdout, stderr) {
|
function failureHtml(id, email, stdout, stderr) {
|
||||||
return (
|
return (
|
||||||
"<p>Une erreur a eu lieu !\n\nQuelque chose s'est mal passé pendant l'encodage de la video de " + email + " (" + id + + ")</p><p>" +
|
"<p>Une erreur a eu lieu !\n\nQuelque chose s'est mal passé pendant l'encodage de la video de " + email + " (" + id + ")</p><p>" +
|
||||||
"<h3>STDOUT</h3><pre><code>" + stdout + "</code></pre><h3>STDERR</h3><pre><code>" + stderr + "</code></pre></p>"
|
"<h3>STDOUT</h3><pre><code>" + stdout + "</code></pre><h3>STDERR</h3><pre><code>" + stderr + "</code></pre></p>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ app.post('/easy-edit', async (req, res, next) => {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
||||||
res.status(400).send(stderr);
|
res.status(400).send(stdout);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ app.post('/easy-edit', async (req, res, next) => {
|
||||||
transporter.sendMail({
|
transporter.sendMail({
|
||||||
from: '"Easy-Editing" <postmaster@tforgione.fr>',
|
from: '"Easy-Editing" <postmaster@tforgione.fr>',
|
||||||
to: fields.email,
|
to: fields.email,
|
||||||
subject: "Votre video est prête",
|
subject: "Une erreur s'est produite",
|
||||||
text: sorryText(),
|
text: sorryText(),
|
||||||
html: sorryHtml(),
|
html: sorryHtml(),
|
||||||
})
|
})
|
||||||
|
@ -115,9 +115,9 @@ app.post('/easy-edit', async (req, res, next) => {
|
||||||
transporter.sendMail({
|
transporter.sendMail({
|
||||||
from: '"Easy-Editing" <postmaster@tforgione.fr>',
|
from: '"Easy-Editing" <postmaster@tforgione.fr>',
|
||||||
to: fields.email,
|
to: fields.email,
|
||||||
subject: "Votre video est prête",
|
subject: "Une erreur s'est produite",
|
||||||
text: failureText(id, email, stdout, stderr),
|
text: failureText(id, fields.email, stdout, stderr),
|
||||||
html: failureHtml(id, email, stdout, stderr),
|
html: failureHtml(id, fields.email, stdout, stderr),
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
8
merge
8
merge
|
@ -6,17 +6,19 @@ if [ $files -eq 1 ]; then
|
||||||
cd $(ls)
|
cd $(ls)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
convert -density 300 *.pdf -resize 1440x1080! '%01d'.png
|
convert -density 300 *.pdf -resize 1440x1080! '%d'.png
|
||||||
count=$(ls *wav | wc -l)
|
count=$(ls *wav | wc -l)
|
||||||
|
files=""
|
||||||
|
|
||||||
for i in `seq 0 $count`; do
|
for i in `seq 0 $(($count - 1))`; do
|
||||||
# fade
|
# fade
|
||||||
duration=$(sox $i.wav -n stat 2>&1 | grep Length | cut -d ':' -f 2 | tr -d '[:space:]')
|
duration=$(sox $i.wav -n stat 2>&1 | grep Length | cut -d ':' -f 2 | tr -d '[:space:]')
|
||||||
sox $i.wav faded-$i.wav fade 0:0.1 $(soxi -d $i.wav) 0:0.1
|
sox $i.wav faded-$i.wav fade 0:0.1 $(soxi -d $i.wav) 0:0.1
|
||||||
|
files="$files faded-$i.wav"
|
||||||
echo -e "file '$i.png'\nduration $duration" >> video-input-list.txt
|
echo -e "file '$i.png'\nduration $duration" >> video-input-list.txt
|
||||||
done
|
done
|
||||||
|
|
||||||
sox faded-{0..$count}.wav output.wav
|
sox $files output.wav
|
||||||
|
|
||||||
ffmpeg -f concat -safe 0 -i video-input-list.txt output.mp4
|
ffmpeg -f concat -safe 0 -i video-input-list.txt output.mp4
|
||||||
ffmpeg -i output.mp4 -i output.wav -c:v libx264 final.mp4
|
ffmpeg -i output.mp4 -i output.wav -c:v libx264 final.mp4
|
||||||
|
|
21
test-merge
21
test-merge
|
@ -10,33 +10,36 @@ if [ $files -eq 1 ]; then
|
||||||
mv $(ls)/* .
|
mv $(ls)/* .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pdf_count=$(ls *.pdf 2>/dev/null | wc -l)
|
pdf_count=$(ls *.pdf | wc -l)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
||||||
echo >&2 "<li>il doit y avoir un fichier PDF dans l'archive</li>"
|
echo "<li>il doit y avoir un fichier PDF dans l'archive</li>"
|
||||||
errored=1
|
errored=1
|
||||||
|
|
||||||
elif [ $pdf_count -ne 1 ]; then
|
elif [ $pdf_count -ne 1 ]; then
|
||||||
|
|
||||||
echo >&2 "<li>il ne doit y avoir qu'un seul fichier PDF dans l'archive</li>"
|
echo "<li>il ne doit y avoir qu'un seul fichier PDF dans l'archive</li>"
|
||||||
errored=1
|
errored=1
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
number_of_pages=$(pdfinfo *.pdf 2>/dev/null| grep Pages | cut -d ':' -f 2 | tr -d '[:space:]')
|
number_of_pages=$(pdfinfo *.pdf | grep Pages | cut -d ':' -f 2 | tr -d '[:space:]')
|
||||||
number_of_sounds=$(ls *.wav 2>/dev/null | wc -l)
|
number_of_sounds=$(ls *.wav | wc -l)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo >&2 "<li>il doit y avoir des fichiers .wav dans l'archive</li>"
|
echo "<li>il doit y avoir des fichiers .wav dans l'archive</li>"
|
||||||
errored=1
|
errored=1
|
||||||
elif [ $number_of_sounds -ne $number_of_pages ]; then
|
elif [ $number_of_sounds -ne $number_of_pages ]; then
|
||||||
echo >&2 "<li>il y a $number_of_sounds fichiers sonores mais $number_of_pages planches dans vos slides</li>"
|
echo "<li>il y a $number_of_sounds fichiers sonores mais $number_of_pages planches dans vos slides</li>"
|
||||||
errored=1
|
errored=1
|
||||||
else
|
else
|
||||||
for i in `seq 0 $number_of_sounds`; do
|
for i in `seq 0 $(($number_of_sounds - 1))`; do
|
||||||
|
echo $i
|
||||||
if ! [ -f $i.wav ]; then
|
if ! [ -f $i.wav ]; then
|
||||||
"<li>les fichiers sonores doivent s'appeler 0.wav, 1.wav, 2.wav, etc...</li>"
|
echo "<li>les fichiers sonores doivent s'appeler 0.wav, 1.wav, 2.wav, etc...</li>"
|
||||||
|
errored=1
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue