function pushVideos($videosDir, $tags = 'phpBulkImport', $ignoreList = '.,..') { //This is where we actually process everything $ignoreList = explode(',', $ignoreList); //We require the Ziggeo SDK Entry file require_once 'Ziggeo.php'; $arguments = array('tags' => $tags); //console output styling echo "\n"; echo "******************************************************\n"; echo " Pushing multiple videos to Ziggeo servers \n"; echo "******************************************************\n"; echo "\n"; //Data for output.. $count = 0; $ziggeo = new Ziggeo(APP_TOKEN, PRIVATE_KEY); //Get all files in the mentioned folder $files = @scandir($videosDir); //If you are getting errors, remove @ to see what is the cause.. if ($files) { //we run it like this, which will remove . and .. and other files if you have specified any with full name $files = array_diff($files, $ignoreList); } if (!$files) { echo 'No videos found to execute the push'; exit; } $c = count($files); foreach ($files as $file) { //Setting up the arguments to pass over.. of course we can do this differently, this is just for example, but remember that each video has a different name while other parameters would be shared! $tmp_arguments = $arguments; $tmp_arguments['file'] = $videosDir . '/' . $file; //the actual passing of the videos to Ziggeo from our PC / Mac $ziggeo->videos()->create($tmp_arguments); //This is just for display purposes upon the upload $count++; echo "Pushed: " . $count . ". \"" . $file . "\"\n"; } //console output styling echo "\n"; echo "******************************************************\n"; echo " Push complete - please check your Ziggeo dashboard \n"; echo "******************************************************\n"; echo "\n"; }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?= $settings["title"] ?></title> <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> <?php foreach ($settings["css"] as $css) { ?> <link rel="stylesheet" href="<?= $css ?>" /> <?php } ?> <link rel="stylesheet" href="//assets.ziggeo.com/css/ziggeo-betajs-player.min.css" /> <script src="//assets.ziggeo.com/js/ziggeo-jquery-json2-betajs-player.min.js"></script> <script>ZiggeoApi.token = "<?= $settings["token"] ?>";</script> <?php require_once($settings["sdkpath"]); $ziggeo = new Ziggeo($settings["token"], $settings["private_key"]); ?> </head> <body> <div class="header"> <h1><?= $settings["heading"] ?></h1> <p> <?= $settings["subtitle"] ?> <br /> <span class="powered"> Proudly powered By the <a href="http://api.ziggeo.com">Ziggeo API</a> </span> </p> </div> <div class="wrapper"> <?php if ($settings["open"]) { ?> <div class="container" id="add_video_container">
define('APP_TOKEN', ''); define('PRIVATE_KEY', ''); //We quickly check if we have post, 'submitted' field and 'submitted' value..If we have all that, then we check if we have videos as well if (isset($_POST, $_POST['submitted']) && $_POST['submitted'] === 'submitted' && isset($_FILES)) { //This is where we actually process everything //We require the Ziggeo SDK Entry file require_once 'Ziggeo.php'; $arguments = array(); //OK we have some tags set, we should add them to the videos if (isset($_POST['tags'])) { $arguments['tags'] = $_POST['tags']; } //Data for output.. $count = 0; $names = ''; $ziggeo = new Ziggeo(APP_TOKEN, PRIVATE_KEY); $c = count($_FILES['files']['name']); for ($i = 0; $i < $c; $i++) { //Setting up the arguments to pass over.. of course we can do this differently, this is just for example, but remember that each video has a different name while other parameters would be shared! $tmp_arguments = $arguments; $tmp_arguments['file'] = $_FILES['files']['tmp_name'][$i]; //the actual passing of the videos to Ziggeo from our PC / Mac $ziggeo->videos()->create($tmp_arguments); //This is just for display purposes upon the upload $count++; $names .= '<li>' . $_FILES['files']['name'][$i] . '</li>'; } ?> <!DOCTYPE html> <html> <head>
<?php require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:", "vtoken:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"]); $ziggeo->videos()->update($opts["vtoken"], array("approved" => TRUE));
<?php require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"]); while (TRUE) { $idx = $ziggeo->videos()->index(); if (count($idx) === 0) { break; } foreach ($idx as $video) { echo "Deleting " . $video->token . " / " . @$video->key . "\n"; $ziggeo->videos()->delete($video->token); } }
<?php require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:", "file:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"]); $ziggeo->videos()->create(array("file" => $opts["file"]));
<?php require_once dirname(__FILE__) . "/../vendor/autoload.php"; require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:", "encryptionkey:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"], $opts["encryptionkey"]); var_dump($ziggeo->auth()->generate(array("grants" => array("read" => array("all" => TRUE)))));
<?php require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"]); $idx = $ziggeo->videos()->index(); foreach ($idx as $video) { echo "Listing " . $video->token . " / " . @$video->key . "\n"; }
<?php require_once dirname(__FILE__) . "/../vendor/autoload.php"; require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"]); var_dump($ziggeo->authtokens()->create(array("grants" => array("read" => array("all" => TRUE)))));
<?php require_once dirname(__FILE__) . "/../Ziggeo.php"; $opts = getopt("", array("token:", "privatekey:", "video:")); $ziggeo = new Ziggeo($opts["token"], $opts["privatekey"]); var_dump($ziggeo->videos()->get($opts["video"]));