Sample code: Showing imagefile's metadata
C++
#include <mobius/imagefile/imagefile.h>
#include <iostream>
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//! \brief Show metadata
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void
show_metadata (const mobius::imagefile::imagefile& image)
{
std::cout << std::endl;
for (const auto& attr : image.get_metadata ())
std::cout << attr.description << ": " << attr.value << std::endl;
}
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//! \brief main function
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
int
main (int argc, char **argv)
{
for (int i = 1; i < argc;i++)
{
std::cout << std::endl;
std::cout << ">> " << argv[i] << std::endl;
auto image = mobius::imagefile::new_imagefile_by_url (argv[i]);
if (image.is_available ())
show_metadata (image);
}
}
Python
import mobius
import sys
def print_imagefile_info (imagefile):
for data in imagefile.get_metadata ():
print '%s: %s' % (data.description.capitalize (), data.value)
for uri in sys.argv[1:]:
print
print ">>", uri
imagefile = mobius.imagefile.new_imagefile_by_url (uri)
if imagefile.is_available ():
print_imagefile_info (imagefile)
Usage
imagefile_info <imagefile-url>
Where imagefile-url is a complete URL to imagefileExample: imagefile_info file:///home/aguiar/imagefile.E01