Пример #1
0
    # 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";
} catch (Exception $e) {
    echo "\nAn exception occurred with code = " . $e->getCode();
    echo "\nError msg = " . $e->getMessage();
}
Пример #2
0
    $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";
} catch (Exception $e) {
    echo "\nAn exception occurred with code = " . $e->getCode();
    echo "\nError msg = " . $e->getMessage();
}
Пример #3
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();
}