Beispiel #1
0
 $f[] = new FileObj($item1->entry->content->params->path);
 $m = array();
 $m[] = new MetaObj("Title", "rss", "My first file", "en");
 $m[] = new MetaObj("Description", "rss", "Description of my first file", "en");
 $content_obj1 = new MetaContent("myfile_one", $f, null, $m);
 $content = $meta->createContent($content_obj1->to_entry());
 $content_obj1->from_entry($content);
 echo "\nCreated new content instance with name = " . $content_obj1->name . "\n";
 # create content instance for item2
 $f = array();
 $f[] = new FileObj($item2->entry->content->params->path, "video");
 $m = array();
 $m[] = new MetaObj("Title", "rss", "My second file", "en");
 $m[] = new MetaObj("Description", "rss", "Description of my second file", "en");
 $content_obj2 = new MetaContent("myfile_two", $f, null, $m);
 $content = $meta->createContent($content_obj2->to_entry());
 $content_obj2->from_entry($content);
 echo "\nCreated new content instance with name = " . $content_obj2->name . "\n";
 echo "\nGetting json list... \n";
 $json_list = $meta->getExtJson();
 print_r($json_list);
 echo "\nGetting atom list... \n";
 $atom_list = $meta->getExtAtom();
 print_r($atom_list);
 echo "\nGetting mrss list... \n";
 $mrss_list = $meta->getExtMrss();
 print_r($mrss_list);
 # delete content instance (this will not delete the file!)
 $meta->deleteContent($content_obj1->name);
 echo "\nDeleted content with name: " . $content_obj1->name . "\n";
 $meta->deleteContent($content_obj2->name);
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
define('LOCAL_PATH', '/path/to/local/file.mp4');
# add path to local (video) file, to be uploaded to the CDN
require_once 'raws_json/meta.php';
require_once 'raws_json/json_client.php';
require_once 'raws_json/meta_service.php';
require_once 'raws_json/rass_service.php';
try {
    $meta = new MetaService(USER, PWD);
    $rass = new RassService(USER, PWD, RASS_SERVER);
    # upload file to CDN (RASS PUT item)
    $item = $rass->createItem("/test/content/", "big_buck_bunny.mp4", LOCAL_PATH, True);
    # create content instance without metadata
    $content_obj = new MetaContent("big_buck_bunny");
    $content_obj->add_file_obj($item->entry->content->params->path);
    $content = $meta->createContent($content_obj->to_entry());
    echo "\nCreated new content instance with name = " . $content->entry->content->params->name . "\n";
    # add tags to the content instance
    $content_obj->from_entry($content);
    $content_obj->set_tags(array("bunny", "animation", "Blender"));
    $content = $meta->updateContent($content_obj->to_entry());
    echo "\nAdded tags to content instance with name = " . $content_obj->name . "\n";
    # get content instance
    $content = $meta->getContentInstance($content_obj->name);
    $content_obj->from_entry($content);
    echo "\nRetrieved content instance with id = " . $content->entry->id . " and tags: ";
    foreach ($content_obj->get_tags() as $t) {
        echo "\n* " . $t;
    }
    # get content feed
    echo "\n\nGetting content list...";