Magnus Manske wrote:
On 8/20/07, Rob Church <robchur(a)gmail.com>
wrote:
> On 20/08/07, Tim Starling <tstarling(a)wikimedia.org> wrote:
>> This seems a bit short-sighted, since I've been busy lately writing
>> routines to extract and display metadata from Ogg files. Wouldn't it be
>> better to call it something like {{#filemetadata:...}} ? Then the media
>> handlers could provide arbitrary key-value pairs.
> I don't understand whether you're objecting to the function name,
> which is trivial to change, or how the function actually operates...?
Just the function name. It's not really that easy to change once it's in
use on the wiki, it's easier if we get it right from the outset.
I think Tim has written PHP functions, but no
wiki-based access to
them. I want to write access routines for the wiki. So,
{{#filemetadata}} sounds great.
Could someone quickly point me to where Tims handlers are
defined/used, so I won't have to wade through the entire code? ;-)
The media handlers are in the includes/media directory. The new Ogg
handler is in extensions/OggHandler. Presumably we would have a metadata
accessor in the File object, which passes through to the media handler.
The interface for metadata is not yet finalised, so I wouldn't actually
recommend making this work for arbitrary media types just yet. If I were
you, I would stick with:
$metadata = $file->getMetadata();
$handler = $file->getHandler();
$metadataType = $handler ? $handler->getMetadataType( $file ) : false;
if ( $metadataType != 'exif' ) return 'Media type not supported';
That gives you forwards-compatibility. You can leave the abstraction until
I've finished with the media handler work.
-- Tim Starling