private function call($method, $args = array()) { KalturaLog::debug("Call [{$method}] args [" . print_r($args, true) . "]"); $result = $this->api->call($method, $args); KalturaLog::debug("Result [" . print_r($result, true) . "]"); return $result; }
$result = $pdo->ExecuteQuery("select type,tag, youtube_id,title,description,catagory,id from youtube"); foreach ($result as $item => $value) { $youtube_id = $value["youtube_id"]; $id = $value["id"]; $type = $value["type"]; $title = $value["title"]; $tag = explode(" ", $value["tag"]); $title = $value["title"]; $description = $value["description"]; $catagory = $value["catagory"]; if ($type == 1) { $videoFile = __DIR__ . "/files_download/" . $youtube_id . ".mp4"; } else { $videoFile = __DIR__ . "/files_download/" . $title . ".mp4"; } $api->setGrantType(Dailymotion::GRANT_TYPE_AUTHORIZATION, $apiKey, $apiSecret, array('manage_videos', 'write', 'delete'), array('username' => $testUser, 'password' => $testPassword)); $url = $api->uploadFile($videoFile); $result = $api->call('video.create', array('url' => $url, 'title' => $title, 'tag' => $tag, 'channel' => $catagory, 'published' => true, 'description' => $description)); $videourl = 'http://www.dailymotion.com/video/' . $result['id']; if ($result) { if ($type == 1) { unlink(__DIR__ . "/files_download/" . $youtube_id . ".mp4"); } else { unlink(__DIR__ . "/files_download/" . $title . ".mp4"); } $pdo->ExecuteQuery("update youtube set upload=1 where youtube.id={$id};"); echo "Upload success "; } } } catch (Exception $e) { }