NAME

Catmandu::Store::File::MediaHaven - A Catmandu::FileStore to access files in the Zeticon MediaHaven server

SYNOPSIS

# From the command line

$ cat catmandu.yml
---
store:
     mh:
         package: MediaHaven
         options:
             url: https://archief.viaa.be/mediahaven-rest-api/resources/media
             username: ...
             password: ...

# Export a list of all file containers
$ catmandu export mh to YAML

# Export a list of all file containers based on a query
$ catmandu export mh --query "+(MediaObjectFragmentTitle:data)"
$ catmandu export mh --query "+(MediaObjectFragmentTitle:data)"  --sort "+=MediaObjectFragmentTitle"

$ Count all file containers
$ catmandu count mh

# Export a list of all files in container '1234'
$ catmandu export mh --bag 1234 to YAML

# Download the file 'myfile.txt' from the container '1234'
$ catmandu stream mh --bag 1234 --id myfile.txt to /tmp/output.txt


# From Perl
use Catmandu;

my $store = Catmandu->store('File::MediaHaven' ,
    url      => '...' ,
    username => '...' ,
    password => '...' ,
);

my $index = $store->index;

# List all folder
$index->bag->each(sub {
    my $container = shift;

    print "%s\n" , $container->{_id};
});

# Get the folder
my $files = $index->files('1234');

# Retrieve a file
my $file = $files->get('foobar.txt');

# Stream the contents of a file
$files->stream(IO::File->new('>foobar.txt'), $file);

METHODS

new(%connection_parameters)

Create a new Catmandu::Store::File::MediaHaven with the following connection parameters:

url

Required. The URL to the MediaHaven REST endpoint.

username

Required. Username used to connect to MediaHaven.

password

Required. Password used to connect to MediaHaven.

record_query

Optional. MediaHaven query to extract a given identifier from the database. Default: "q=%%2B(MediaObjectFragmentId:%s)"

record_id_fix

Optional. One or more Catmandu::Fix commands or a Fix script used to extract the _id bag identifier from the MediaHaven record.

INHERITED METHODS

This Catmandu::FileStore implements:

Catmandu::FileStore

The index Catmandu::Bag in this Catmandu::Store implements:

Catmandu::Bag
Catmandu::Searchable
Catmandu::FileBag::Index

The file Catmandu::Bag in this Catmandu::Store implements:

Catmandu::Bag
Catmandu::FileBag

SEE ALSO

Catmandu::Store::File::MediaHaven::Index, Catmandu::Store::File::MediaHaven::Bag, Catmandu::FileStore