mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Update
This commit is contained in:
parent
c30c4b3963
commit
d15a0ec71d
1 changed files with 28 additions and 11 deletions
|
@ -181,16 +181,6 @@
|
|||
killProcessFromKeyword($keyword);
|
||||
}
|
||||
|
||||
// Validate that ffmpegCommand is not empty after sanitization
|
||||
if (empty($ffmpegCommand)) {
|
||||
echo json_encode([
|
||||
'error' => true,
|
||||
'msg' => 'Invalid or empty ffmpeg command',
|
||||
'codeToExec' => $codeToExec,
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get the system's temporary directory
|
||||
$tempDir = "{$global['systemRootPath']}videos/ffmpegLogs/";
|
||||
make_path($tempDir);
|
||||
|
@ -201,6 +191,33 @@ $tempDir = rtrim($tempDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
|||
// Create a unique log file path
|
||||
$logFile = "{$tempDir}ffmpeg_{$keyword}.log";
|
||||
|
||||
$time = time();
|
||||
$modified = @filemtime($logFile);
|
||||
$secondsAgo = $time - $obj->modified;
|
||||
$isActive = $secondsAgo < 10;
|
||||
|
||||
if (!empty($codeToExec->log)) {
|
||||
echo json_encode([
|
||||
'error' => file_exists($logFile),
|
||||
'msg' => '',
|
||||
'content' => @file_get_contents($logFile),
|
||||
'time' =>$time,
|
||||
'modified' =>$modified,
|
||||
'secondsAgo' =>$secondsAgo,
|
||||
'isActive' =>$isActive,
|
||||
]);
|
||||
exit;
|
||||
}else
|
||||
// Validate that ffmpegCommand is not empty after sanitization
|
||||
if (empty($ffmpegCommand)) {
|
||||
echo json_encode([
|
||||
'error' => true,
|
||||
'msg' => 'Invalid or empty ffmpeg command',
|
||||
'codeToExec' => $codeToExec,
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Redirect all output to the log file
|
||||
$ffmpegCommand .= " > {$logFile} 2>&1";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue