Proposal: Image::EXIF::DateTime::Parser

M

Marcin Owsiany

[cc: (e-mail address removed), sergey - author of Image::EXIF]

As a part of a program I'm writing I made a module that might be
useful to
other people. Below is an excerpt from its README and POD.

Please send me your comments and suggestions before I upload it to
CPAN.

README:
| Image::EXIF::DateTime::parser
| =============================
|
| Purpose
| -------
|
| This module provides a parser for "DateTime" strings as defined in
| Exchangeable image file format for digital still cameras:
| Exif Version 2.2
| Section 4.6.4 "TIFF Revision 6.0 Attribute information"
| Subsection D. "Other Tags", DateTime
|
| Apart from parsing the strings that conform to the specification,
this
| module tries to decipher some non-compliant strings which certain
| implementations produce. Examples of supported deviations can be
| found in the unit tests for this module.
| [...]

POD:
| NAME
| Image::EXIF::DateTime::parser - parser for EXIF date/time
strings
|
| SYNOPSIS
| use Image::EXIF::DateTime::parser;
|
| my $parser = Image::EXIF::DateTime::parser->new;
| printf "%d\n", $p->parse("2009:05:05 09:17:37");
|
| produces "1241540257", if you are in America/Los_Angeles
timezone.
|
| DESCRIPTION
| While parsing standards-compliant EXIF Date/Time string is
easy, allow$B!>(B
| ing for the various ways different non-standards-compliant
implementa$B!>(B
| tions mangle these strings is neither easy nor pleasant. This
module
| encapsulates this complexity for you. It provides a parser
which takes
| an EXIF Date/Time string and returns time in "calendar time"
format,
| aka. time_t.
|
| EXPORTS
|
| Nothing.
|
| METHODS
|
|
| $p = Image::EXIF::DateTime::parser->new
| Returns a new parser object.
|
| Introduced in version 1.1.
|
| $time_t = $p->parse( $B!G(B2009:05:05 09:17:37$B!G(B )
| Takes a single argument: an EXIF Date/Time string, and
returns a
| time_t value by interpreting the string as local time.
|
| Returns undef when the string represents an unknown date/
time
| (zeros or blanks).
|
| Throws an exception if the string is not parseable.
|
| Introduced in version 1.1.

regards,

Marcin

PS: Apologies if google groups mangles the message.
 
I

Ilya Zakharevich

| This module provides a parser for "DateTime" strings as defined in
| Exchangeable image file format for digital still cameras:
| Exif Version 2.2
| Section 4.6.4 "TIFF Revision 6.0 Attribute information"
| Subsection D. "Other Tags", DateTime

Why use a separate module? Should not just ExifTool be fixed to
transparently translate to a uniform format?

(Of course, there must be kept some fields to access the "raw", low-level,
strings, but the "high-level" fields should better not depend on the
flavor of firmware...)

Or did I confuse what this module is about?

Thanks,
Ilya
 
M

Marcin Owsiany

Why use a separate module? Should not just ExifTool be fixed to
transparently translate to a uniform format?

Sorry, I meant to clarify this but forgot.

This module is simply a string parser. It does NOT know how to extract
a date/time string from an image file.
You just give it a short string and it returns a time_t.

Keeping this module separate gives the programmer freedom to choose
the method of reading the actual image, without forcing them to use
ExifTool or any other EXIF library. At the same time it gives us a
single place to maintain the date/time parsing code.

Marcin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top