-
-
Save lkysow/0fe45f25c9817381e131 to your computer and use it in GitHub Desktop.
Quick and dirty script to provide an API that would show the
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: application/json'); | |
header('Access-Control-Allow-Origin: *'); | |
$files = scandir('.'); | |
$videos = array_filter($files, function($filename) { | |
return strpos($filename, 'VID') !== false && strpos($filename, '-thumbnail') === false; | |
}); | |
$json = []; | |
foreach($videos as $video) { | |
$json[] = [ | |
'videoUrl' => $video, | |
'thumbnailUrl' => $video . '-thumbnail.jpg' | |
]; | |
} | |
echo json_encode($json); | |
/** Example Response: | |
* [ | |
{ | |
"videoUrl": "VID_1415583006.mp4", | |
"thumbnailUrl": "VID_1415583006.mp4-thumbnail.jpg" | |
}, | |
{ | |
"videoUrl": "VID_1415592608.mp4", | |
"thumbnailUrl": "VID_1415592608.mp4-thumbnail.jpg" | |
} | |
] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment