Exemplo n.º 1
0
    $rass = new RassService(USER, PWD, RASS_SERVER);
    $meta = new MetaService(USER, PWD);
    # upload file to CDN (RASS PUT item)
    $item1 = $rass->createItem("/test/content/", "myfile_with_meta.mp4", LOCAL_PATH, True);
    $item2 = $rass->createItem("/test/content/", "myfile_no_meta.mp4", LOCAL_PATH, True);
    # create content instance
    $f = array();
    $f[] = new FileObj($path = $item1->entry->content->params->path, $media_type = "video");
    $content = new MetaContent($name = "myfile_with_meta", $file_objs = $f);
    $content->tags = array("een", "twee", "drie");
    $content_obj = $meta->createContent($content->to_entry());
    $content->from_entry($content_obj);
    echo "\nCreated new content instance with name = " . $content->name . "\n";
    # get contentdir feed
    echo "\n\nGetting contentdir list...";
    $feed = $meta->getContentdirList("/");
    foreach ($feed->feed->entry as $e) {
        if ($e->content->params->name) {
            echo "\n* retrieved content instance: " . $e->id . " with name = " . $e->content->params->name;
        } else {
            echo "\n* retrieved file without metadata, path = " . $e->content->file[0]->path;
        }
    }
    echo "\n... finished retrieving contentdir instances.\n";
    # delete content instance (this will not delete the file!)
    $meta->deleteContent($content->name);
    echo "\nDeleted content with name: " . $content->name . "\n";
} catch (Exception $e) {
    echo "\nAn exception occurred with code = " . $e->getCode();
    echo "\nError msg = " . $e->getMessage();
}