Catmandu::Store::File::MediaHaven - A Catmandu::FileStore to access files in the Zeticon MediaHaven server
# From the command line $ cat catmandu.yml --- importer: 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);
Create a new Catmandu::Store::File::MediaHaven with the following connection parameters:
Required. The URL to the MediaHaven REST endpoint.
Required. Username used to connect to MediaHaven.
Required. Password used to connect to MediaHaven.
Optional. MediaHaven query to extract a given identifier from the database. Default: "q=%%2B(MediaObjectExternalId:%s)"
Optional. One or more Catmandu::Fix commands or a Fix script used to extract the _id bag identifier from the MediaHaven record.
_id
This Catmandu::FileStore implements:
The index Catmandu::Bag in this Catmandu::Store implements:
The file Catmandu::Bag in this Catmandu::Store implements:
Catmandu::Store::File::MediaHaven::Index, Catmandu::Store::File::MediaHaven::Bag, Catmandu::FileStore
To install Catmandu::MediaHaven, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::MediaHaven
CPAN shell
perl -MCPAN -e shell install Catmandu::MediaHaven
For more information on module installation, please visit the detailed CPAN module installation guide.