add missing thumbs, fix script thumb path
SSH Build / Deploy (push) Successful in 7s Details

This commit is contained in:
Carneiro 2024-08-05 22:36:03 -03:00
parent bcd1db9a08
commit e999e8b658
4 changed files with 9 additions and 27 deletions

View File

@ -9,7 +9,7 @@
"level": "Basico" "level": "Basico"
}, },
{ {
"title": "Introdução ao MIxxx", "title": "Introdução ao Mixxx",
"user": "fls", "user": "fls",
"author": "Flávio Luiz Schiavoni", "author": "Flávio Luiz Schiavoni",
"description": "Bem-vindos ao curso de Mixxx, um software de DJ gratuito e de código aberto que permite que você crie sets incríveis e faça mixagens profissionais. Este curso é ideal para quem deseja começar na arte da discotecagem ou para DJs experientes que querem explorar uma nova ferramenta.", "description": "Bem-vindos ao curso de Mixxx, um software de DJ gratuito e de código aberto que permite que você crie sets incríveis e faça mixagens profissionais. Este curso é ideal para quem deseja começar na arte da discotecagem ou para DJs experientes que querem explorar uma nova ferramenta.",

View File

@ -16,7 +16,7 @@ lang: pt
<div class="box"> <div class="box">
<div class="box-top"> <div class="box-top">
<figure> <figure>
<img src="{{ site.baseurl }}/assets/thumbs/{{ aula.title }}.jpg"> <img src="{{ site.baseurl }}/videos/{{ aula.user }}/thumbs/{{ aula.title }}.jpg">
</figure> </figure>
</div> </div>

View File

@ -1,22 +1,9 @@
<?php <?php
$username = $_SERVER['PHP_AUTH_USER']; $username = $_SERVER['PHP_AUTH_USER'];
$target_dir = "/var/www/html/aliceclass_videos/" . $username; $target_dir = "/var/www/html/aliceclass_videos/" . $username;
$paths = array('', '/src', '/dest', '/thumbs')
# check if user dir exists foreach ($paths as $path) {
if (!file_exists($target_dir)) { file_exists($target_dir . $path) || mkdir($target_dir . $path, 0775, true)
# if not, create it
if (mkdir($target_dir, 0775, true)) {
// echo "Directory created successfully.";
}
if (mkdir($target_dir . "/src", 0775, true)) {
// echo "Directory created successfully.";
}
if (mkdir($target_dir . "/dest", 0775, true)) {
// echo "Directory created successfully.";
}
} }
$fileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); $fileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
@ -38,10 +25,6 @@
$brute_file = $target_dir . "/src/" . $video_title . $ext; $brute_file = $target_dir . "/src/" . $video_title . $ext;
$target_file = $target_dir . "/dest/" . $video_title . '.mp4'; $target_file = $target_dir . "/dest/" . $video_title . '.mp4';
// echo $video_title . $video_desc . $video_date . $video_level;
// echo $target_file;
// return;
// Check if file already exists // Check if file already exists
if (file_exists($brute_file)) { if (file_exists($brute_file)) {
echo "Sorry, file already exists."; echo "Sorry, file already exists.";
@ -57,8 +40,6 @@
// return; // return;
// ./script.sh "TESTE" "TESTAO" "/home/carneiro/Introdução ao LMMS.mkv" "AULATESTE" /home/carneiro/teste.mp4
echo "The file ". htmlspecialchars(basename( $_FILES["videoTitle"]["name"])). " has been uploaded."; echo "The file ". htmlspecialchars(basename( $_FILES["videoTitle"]["name"])). " has been uploaded.";
$SCRIPT_PATH = "/var/www/src/AliceClass/script/script.sh"; $SCRIPT_PATH = "/var/www/src/AliceClass/script/script.sh";
$AUTHOR = $username; $AUTHOR = $username;
@ -68,5 +49,4 @@
$cmd = sprintf('%s "%s" "%s" "%s" "%s" "%s"', $SCRIPT_PATH, $NAME, $AUTHOR, $INPUT, 'aulateste', $OUTPUT); $cmd = sprintf('%s "%s" "%s" "%s" "%s" "%s"', $SCRIPT_PATH, $NAME, $AUTHOR, $INPUT, 'aulateste', $OUTPUT);
$output = shell_exec($cmd); $output = shell_exec($cmd);
?> ?>

View File

@ -20,6 +20,8 @@ process_video () {
OUTPUT="$ASSETS/videos/${NAME}.mp4" OUTPUT="$ASSETS/videos/${NAME}.mp4"
fi fi
THUMB_PATH=$(dirname $OUTPUT)/${NAME}
echo "########################################" echo "########################################"
echo "# Aula: ${AULA}" echo "# Aula: ${AULA}"
echo "# Author: ${AUTHOR}" echo "# Author: ${AUTHOR}"
@ -34,8 +36,8 @@ process_video () {
# #################################### # ####################################
# Creating the thumbnail if does not exist # Creating the thumbnail if does not exist
# #################################### # ####################################
if test ! -f "$ASSETS/thumbs/${NAME}.jpg" ; then if test ! -f "${THUMB_PATH}.jpg" ; then
ffmpeg -y -i "${INPUT}" -vframes 1 -an -s 400x222 -ss 30 "$ASSETS/thumbs/${NAME}.jpg" ffmpeg -y -i "${INPUT}" -vframes 1 -an -s 400x222 -ss 30 "${THUMB_PATH}.jpg"
fi fi
# #################################### # ####################################