1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 02:39:46 +02:00
Daniel Neto 2024-11-20 11:12:09 -03:00
parent 95d3dfc895
commit 8a6a1f448b
9 changed files with 108 additions and 28 deletions

View file

@ -1089,4 +1089,25 @@ function getVideosDirectoryUsageInfo() {
'used_percentage' => $usedPercentageFormatted,
'used_percentage_number' => $usedPercentage
];
}
}
function findMP4File($folderPath)
{
// Ensure the folder path ends with a slash
$folderPath = addLastSlash($folderPath);
// Open the folder and iterate over files
if (is_dir($folderPath)) {
$files = scandir($folderPath);
foreach ($files as $file) {
// Check if the file has a .mp4 extension
if (pathinfo($file, PATHINFO_EXTENSION) === 'mp4') {
// Return the absolute path to the first .mp4 file found
return $folderPath . $file;
}
}
}
// Return false if no .mp4 file is found
return false;
}