Ejemplo n.º 1
0
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# 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 {
    $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_one.mp4", LOCAL_PATH, True);
    $item2 = $rass->createItem("/test/content/", "myfile_two.mp4", LOCAL_PATH, True);
    # create content instance for item1
    $f = array();
    $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();
Ejemplo n.º 2
0
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
require_once 'raws_json/json_client.php';
require_once 'raws_json/meta_service.php';
try {
    $meta = new MetaService(USER, PWD);
    # create vocab
    $vocab = $meta->createVocab("myyvocab", "http://myyvocab.org/");
    echo "\nCreated vocab: " . $vocab->entry->id . "\n";
    # get vocab instance
    $vocab = $meta->getVocabInstance($vocab->entry->content->params->name);
    echo "\nRetrieved vocab with namespace: " . $vocab->entry->content->params->xml_namespace . "\n";
    # update vocab instance
    $vocab->entry->content->params->xml_namespace = "http://mynewvocab.com";
    $vocab = $meta->updateVocab($vocab);
    echo "\nUpdated vocab, new namespace = " . $vocab->entry->content->params->xml_namespace . "\n";
    # other way to call updateVocab, passing the vocab name as second argument
    $vocab->entry->content->params->xml_namespace = "http://mynewvocab2.com";
    $vocab = $meta->updateVocab($vocab, $vocab->entry->content->params->name);
    # get all vocab instances
    echo "\nGetting vocab list...";
Ejemplo n.º 3
0
# limitations under the License.
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# 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);
Ejemplo n.º 4
0
# limitations under the License.
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# 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 files to CDN (RASS PUT item)
    $item1 = $rass->createItem("/test/content/", "big_buck_bunny.mp4", LOCAL_PATH, True);
    $item1b = $rass->createItem("/test/content/", "big_buck_bunny.jpg", LOCAL_PATH, True);
    $item2 = $rass->createItem("/test/content/", "sintel.mp4", LOCAL_PATH, True);
    # create vocabs
    if (!$meta->vocabExists("media")) {
        $meta->createVocab("media", "http://search.yahoo.com/mrss/");
    }
    if (!$meta->vocabExists("myvocab")) {
        $meta->createVocab("myvocab", "http://myvocab.org/ns/");
    }
    # Create content instance with multiple languages for "/test/content/big_buck_bunny.mp4"
    $content_obj1 = new MetaContent("big_buck_bunny");
    $content_obj1->add_file_obj($item1->entry->content->params->path);
Ejemplo n.º 5
0
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# 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 {
    $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) {