API
The usage is very simple, you only need to call the "parse" function with the filename as parameter to get a MediaInfo object back (or None, if the media can't be detected. Detection of discs like an audio cd, vcd or dvd works only with linux right now. Please send us a patch if you can get it working with BSD, MaxOS or Windows. The DVD parser needs libdvdread to be installed. An alternative parser lsdvdinfo.py uses lsdvd to do the parsing. This parser will be removed in the future.
All internal data is unicode.
Example:
import kaa.metadata
info = kaa.metadata.parse('movie.avi')
disc = kaa.metadata.parse('/dev/dvd')
Object MediaInfo
Attributes
The MediaInfo object has various attributes:
- artist
- bitrate
- caption
- chapters (DVD only?)
- comment
- copyright
- country
- delay ?
- encoder
- filename
- genre
- image
- keywords
- language
- length
- media
- mime
- mpeg_version
- producer
- product
- rating
- sequence_header_offset
- size
- software
- starring
- start
- studio
- subtype
- table_mapping
- timestamp
- title
- trackno
- trackof
- type
- url
- writer
Arrays
Append ID, e.g. info.video[0].width
- audio
- subtitles
- video
Methods
- convert
- dxy
- filename_aspect
- get
- get_endpos
- get_length
- get_time
- has_key
- isMPEG
- isPES
- isTS
- keys
- progressive
- ReadPESHeader
- ReadPTS
- ReadSCRMpeg1
- ReadSCRMpeg2
- seek
Parser
Current Parser
audio/ac3
audio/eyed3 (mp3 parser)
audio/flac
audio/m4a
audio/pcm
audio/webradio
audio/ogg
disc/audio (audio cd in drive)
disc/dvd (dvd in drive, dvd on harddisc and dvd iso file)
disc/vcd (vcd disc in drive)
image/tiff
image/jpg
image/png
image/pil (parser for different image formats based on PIL)
video/asf (asf, wmv, etc)
video/mkv
video/mov
video/mpeg
video/ogm
video/real
video/riff (avi, wmv, etc)
video/vcd (vcd files as bin/cue)
misc/xml (incl. fxd files for Freevo)
misc/dir (read freedesktop.org directory informations)
How to add a Parser
PleaseUpdate: add some doc here
mminfo
The module will install the script mminfo. It is a small example for the module itself and a nice script to parse media files on the command line.
-> mminfo star-wars-3-teaser.mov
kaa media metadata info
filename : star-wars-3-teaser.mov
Attributes:
title: Episode III Teaser Trailer
artist: starwars.com Hyperspace
type: Quicktime Video
date: 04/11/04
media: video
length: 107
copyright: Copright (c) 2004 Lucasfilm Ltd.
Stream list:
Video Stream:
length: 107
codec: SVQ3
width: 480
height: 206
Audio Stream:
length: 107
codec: QDM2
language: en