pulpvideo.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Http\Client;
  5. $accessKey = getenv('QINIU_ACCESS_KEY');
  6. $secretKey = getenv('QINIU_SECRET_KEY');
  7. $auth = new Auth($accessKey, $secretKey);
  8. $config = new \Qiniu\Config();
  9. $argusManager = new \Qiniu\Storage\ArgusManager($auth, $config);
  10. $reqBody = array();
  11. $reqBody['uri'] = "xxxx";
  12. $ops = array();
  13. $ops = array(
  14. array(
  15. 'op' => 'pulp',
  16. 'params' => array(
  17. 'labels' => array(
  18. array(
  19. 'label' => "1",
  20. 'select' => 1,
  21. 'score' => 2,
  22. ),
  23. )
  24. )
  25. ),
  26. );
  27. $params = array();
  28. $params = array(
  29. 'async' => false,
  30. 'vframe' => array(
  31. 'mode' => 1,
  32. 'interval' => 8,
  33. )
  34. );
  35. $req = array();
  36. $req['data'] = $reqBody;
  37. $req['ops'] = $ops;
  38. $req['params'] = $params;
  39. $body = json_encode($req);
  40. $vid = "xxxx";
  41. list($ret, $err) = $argusManager->pulpVideo($body, $vid);
  42. if ($err !== null) {
  43. var_dump($err);
  44. } else {
  45. var_dump($ret);
  46. }