$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); echo "\nDeleted content with name: " . $content_obj2->name . "\n";
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..."; $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;
$content_obj2->add_file_obj($item2->entry->content->params->path); $content = $meta->createContent($content_obj2->to_entry()); echo "\nCreated new content instance with name = " . $content->entry->content->params->name . "\n"; # Update content instance, adding meta objects $content_obj2->from_entry($content); $content_obj2->add_meta_obj("title", "media", "Sintel"); $content_obj2->add_meta_obj("description", "media", "Sintel (code-named Durian) is a short computer animated film by the Blender Institute, part of the Blender Foundation."); $content_obj2->add_meta_obj("tag", "myvocab", "animation", "en"); $content = $meta->updateContent($content_obj2->to_entry()); echo "\nAdded meta objects to content instance with name = " . $content->entry->content->params->name . "\n"; # search for content echo "\n\nGetting content list, search on 'iqmeta=blender' ..."; $feed = $meta->getContentList('iqmeta=blender'); foreach ($feed->feed->entry as $content_entry) { $content_obj = new MetaContent(); $content_obj->from_entry($content_entry); echo "\n\nRetrieved content instance with id = " . $content_obj->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}"; } } } } echo "\n... finished retrieving content instances.\n"; # delete content instances + files from CDN $meta->deleteContent($content_obj1->name); echo "\nDeleted content with name: " . $content_obj1->name . "\n";
require_once 'raws_json/json_client.php'; require_once 'raws_json/meta_service.php'; require_once 'raws_json/rass_service.php'; try { $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";