forked from puzanov/pusha
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pusha_video.php
26 lines (25 loc) · 972 Bytes
/
pusha_video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?
require_once "lib/VideoUploader.php";
require_once "lib/HttpClient.php";
require_once "lib/CurlFileUploader.php";
$config = yaml_parse(file_get_contents("config.yml"));
$d = dir($config["video_path"]);
while (false !== ($entry = $d->read())) {
if ($entry == ".." || $entry == ".") continue;
if (is_file($config['video_path']."/".$entry)) continue;
$category_id = $entry;
$video_uploader = new VideoUploader();
$dv = dir($config['video_path']."/".$entry);
while (false !== ($video = $dv->read())) {
if ($video == ".." || $video == ".") continue;
if (is_dir($config['video_path']."/".$entry."/".$video)) continue;
try {
echo "uploading video ".$config['video_path']."/".$entry."/".$video." to category $category_id\n";
$video_uploader->upload($config['video_path']."/".$entry."/".$video, $category_id);
echo "gooood\n";
} catch (Exception $e) {
echo "failed :( ".$e->getMessage()."\n";
}
sleep(0.5);
}
}