Exemplo n.º 1
0
 $content_obj1 = new MetaContent("big_buck_bunny");
 $content_obj1->add_file_obj($item1->entry->content->params->path);
 $content_obj1->add_file_obj($item1b->entry->content->params->path);
 $content_obj1->add_meta_obj("title", "media", "Big Buck Bunny", "en");
 $content_obj1->add_meta_obj("description", "media", "Big Buck Bunny is a short computer animated film by the Blender Institute, part of the Blender Foundation.", "en");
 $content_obj1->add_meta_obj("keywords", "media", "bunny, animation, Blender", "en");
 $content_obj1->add_meta_obj("title", "media", "Big Buck Bunny", "nl");
 $content_obj1->add_meta_obj("description", "media", "Big Buck Bunny is een animatiefilm gemaakt door het Blender Institute met behulp van opensource software.", "nl");
 $content_obj1->add_meta_obj("keywords", "media", "konijn, animatie, Blender", "nl");
 $content_obj1->add_meta_obj("tag", "myvocab", "animation", "en");
 $content_obj1->add_meta_obj("tag", "myvocab", "animatie", "nl");
 $content_obj1->add_meta_obj("credit", "media", "Blender Foundation", null, array("role" => "author"));
 $content = $meta->createContent($content_obj1->to_entry());
 echo "\nCreated new content instance with name = " . $content->entry->content->params->name . "\n";
 # get content instance
 $content = $meta->getContentInstance($content->entry->content->params->name);
 $content_obj = new MetaContent();
 $content_obj->from_entry($content);
 echo "\nRetrieved content instance with id = " . $content->entry->id . " and meta objs: ";
 foreach ($content_obj->get_meta_objs() as $m) {
     echo "\n- meta obj with vocab = {$m->vocab}, meta_name = {$m->meta_name}, text = {$m->text}, lang = {$m->lang}";
     if ($m->has_attrs()) {
         echo "\n   meta obj attrs:";
         foreach ($m->get_attrs() as $key => $value) {
             echo "\n   * {$key}:{$value}";
         }
     }
 }
 # Create content instance without meta objects for "/test/content/sintel.mp4"
 $content_obj2 = new MetaContent("sintel");
 $content_obj2->add_file_obj($item2->entry->content->params->path);
Exemplo n.º 2
0
 $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...";
 $feed = $meta->getContentList("tag=animation");
 foreach ($feed->feed->entry as $content_entry) {
     echo "\n* retrieved content: " . $content_entry->id . " with name = " . $content_entry->content->params->name;
 }
 echo "\n... finished retrieving content instances.\n";
 # delete content instance + file from CDN
 $meta->deleteContent($content_obj->name);
 echo "\nDeleted content with name: " . $content_obj->name . "\n";