Ejemplo n.º 1
0
 public function upload($file)
 {
     $url = $this->api->uploadFile($file);
     $result = $this->call('video.create', array('url' => $url));
     $remoteId = $result['id'];
     return $remoteId;
 }
Ejemplo n.º 2
0
    $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) {
}
Ejemplo n.º 3
-1
 public function updateSubtitle($remoteSubtitleId, KalturaDailymotionDistributionCaptionInfo $captionInfo)
 {
     $url = $this->api->uploadFile($captionInfo->filePath);
     $args = array();
     $args['url'] = $url;
     $args['language'] = $captionInfo->language;
     $args['format'] = $this->getCaptionFormate($captionInfo->format);
     $tempApiEndpointUrl = $this->api->apiEndpointUrl;
     $this->api->apiEndpointUrl = self::NEW_API_END_POINT_URL;
     $response = $this->call("POST /subtitle/{$remoteSubtitleId}", $args);
     $this->api->apiEndpointUrl = $tempApiEndpointUrl;
 }