Catmandu-MediaHaven

 view release on metacpan or  search on metacpan

lib/Catmandu/Store/File/MediaHaven.pm  view on Meta::CPAN

             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);

=head1 METHODS

=head2 new(%connection_parameters)

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

=over

=item url

Required. The URL to the MediaHaven REST endpoint.

=item username

Required. Username used to connect to MediaHaven.

=item password

Required. Password used to connect to MediaHaven.

=item record_query

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

=item record_id_fix

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

=item search_limit

Optional. The maximum number of records to return for each Mediahaven search query.

=item search_sort

Optional. The sorting field used in queries.

=back


=head1 INHERITED METHODS

This Catmandu::FileStore implements:

=over 3

=item L<Catmandu::FileStore>

=back

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

=over 3

=item L<Catmandu::Bag>

=item L<Catmandu::Searchable>

=item L<Catmandu::FileBag::Index>

=back

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

=over 3

=item L<Catmandu::Bag>

=item L<Catmandu::FileBag>



( run in 1.620 second using v1.01-cache-2.11-cpan-364913b4093 )