tool_test.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. set_time_limit(0);
  3. include("connectSQL_Component.php");
  4. require '../../vendor/autoload.php';
  5. $ffmpeg = FFMpeg\FFMpeg::create([
  6. 'ffmpeg.binaries' => 'C:\FFmpeg\bin\ffmpeg.exe',
  7. 'ffprobe.binaries' => 'C:\FFmpeg\bin\ffprobe.exe',
  8. ]);
  9. $GLOBALS["ffmpeg"] = $ffmpeg;
  10. $GLOBALS["conn"] = $conn;
  11. $root = '../../assets';
  12. $folder = 'videos';
  13. FindPath($root, $folder, $ffmpeg);
  14. sqlsrv_close($conn);
  15. function FindPath($root, $folder, $ffmpeg)
  16. {
  17. $rootPath = $root . '/' . $folder;
  18. $paths = array_diff(scandir($root . '/' . $folder), array('.', '..', 'Thumbs.db'));
  19. natsort($paths);
  20. echo ("<ul>");
  21. foreach ($paths as $path) {
  22. if (str_contains($path, '.')) {
  23. if (str_contains(strtolower($path), '.mp4')) {
  24. echo ("<li data-jstree='{ " . '"type" : "file"' . " }' >");
  25. $title = explode(".", $path)[0];
  26. $file_path = substr($rootPath, 4) . "/" . $path;
  27. $path = "title:" . $title . "path:" . $file_path . " dir_id:" . $folder;
  28. echo ($path);
  29. echo ("</li>");
  30. }
  31. } else {
  32. echo ("<li>");
  33. echo ("dir_name: " . $path . "parent: " . $folder);
  34. FindPath($rootPath, $path, $ffmpeg);
  35. echo ("</li>");
  36. }
  37. }
  38. echo ("</ul>");
  39. }