On Sat, 2010-08-28 at 16:11 +0200, m.bey...@gmx.de wrote: > Awesome, I would really apreciate it. > Could you drop me a quick reply if you add it?
Ok, I've committed Matroska tags support in r4363. I added a tags framework to the Media core object, which means other parsers can and should use it (where it makes sense). It ended up being a bit more involved than I expected, mainly because of the level of flexibility Matroska tags can have. Support for Matroska tags comes in two forms: 1. Relevant tags are exposed as core attributes (e.g. director, rating, keywords, etc.) 2. All media objects have a new tags attribute that is a Tags object (basically a dictionary). I think I managed to add proper support for all the major use-cases: * nested tags (dicts within dicts) * lists of tags (multiple instances of e.g. ACTOR) * global tags and per-track tags Tag objects have these attributes: * value: a unicode or binary string value * langcode: the 3 letter language code * language: human readable language name * binary: True if 'value' is a binary value, False if it's a readable string I don't have any Matroska files that use tags, so I made my own. Usage example: >>> m = kaa.metadata.parse("Coraline.2009.1080p.mkv") >>> print m | title: Coraline | type: Matroska | timestamp: 1283116779 | keywords: parallel worlds, dream, eye, secret door, button | media: MEDIA_AV | mime: application/mkv | datetime: 2009-02-06 00:00:00 | length: 6036.266 | genre: Animation, Adventure, Family, Fantasy | writer: Henry Selick, Neil Gaiman | studio: Universal | actors: Dakota Fanning, Teri Hatcher, Jennifer Saunders, Dawn French | thumbnail: <unprintable data, size=376511> | summary: An adventurous girl finds another world that is a strangely idealized version of her frustrating home, but it has sinister secrets. | tags: title = Coraline | law_rating = PG | country = US | production_studio = Universal | actor = Dakota Fanning, Teri Hatcher, Jennifer Saunders, Dawn French | summary = An adventurous girl finds another world that is a strangely idealized version of her frustrating home, but it has sinister secrets. | director = Henry Selick | genre = Animation, Adventure, Family, Fantasy | written_by = Henry Selick, Neil Gaiman | keywords = parallel worlds, dream, eye, secret door, button | date_released = 2009-02-06 00:00:00 +-- Video Track #1 | | title: 1080p non-3D | | media: MEDIA_VIDEO | | bitrate: 8499200.0 | | codec: H.264 AVC | | width: 1920 | | height: 1040 | | fps: 23.9760247425 | | aspect: 1.84615384615 | | trackno: 1 | | fourcc: AVC1 | | id: 0 | | tags: bps = 8499200 | | title = 1080p non-3D +-- Video Track #2 | | title: 720p 3D | | media: MEDIA_VIDEO | | bitrate: 3158016.0 | | codec: H.264 AVC | | width: 1440 | | height: 780 | | fps: 23.9760247425 | | aspect: 1.84615384615 | | trackno: 2 | | fourcc: AVC1 | | id: 1 | | tags: bps = 3158016 | | title = 720p 3D +-- Audio Track #1 | | title: DTS (1536 kbit/s) | | media: MEDIA_AUDIO | | channels: 6 | | samplerate: 48000.0 | | codec: Dolby DTS (Digital Theater System) | | fourcc: 0x2001 | | trackno: 3 | | id: 0 +-- Audio Track #2 | | title: Commentary with Director Henry Selick and Composer Bruno Coulais | | media: MEDIA_AUDIO | | channels: 2 | | samplerate: 48000.0 | | codec: Ogg Vorbis (mode 2) | | fourcc: 0x6750 | | trackno: 4 | | id: 1 +-- Chapter #1 | | name: The Pink Palace (Main Titles) | | pos: 0.0 | | enabled: 1 | | id: 0 +-- Chapter #2 | | name: A Little Me | | pos: 492.283 | | enabled: 1 | | id: 1 +-- Chapter #3 | | name: Your Other Mother | | pos: 836.21 | | enabled: 1 | | id: 2 +-- Chapter #4 | | name: Incredible Dream | | pos: 1106.731 | | enabled: 1 | | id: 3 +-- Chapter #5 | | name: The Amazing Bobinsky | | pos: 1389.471 | | enabled: 1 | | id: 4 +-- Chapter #6 | | name: Spink & Forcible | | pos: 1605.771 | | enabled: 1 | | id: 5 +-- Chapter #7 | | name: In the Garden | | pos: 1954.578 | | enabled: 1 | | id: 6 +-- Chapter #8 | | name: Jumping Mouse Circus | | pos: 2217.173 | | enabled: 1 | | id: 7 +-- Chapter #9 | | name: Unlocking the Door | | pos: 2439.187 | | enabled: 1 | | id: 8 +-- Chapter #10 | | name: Dream Come True | | pos: 2659.907 | | enabled: 1 | | id: 9 +-- Chapter #11 | | name: A Special Surprise | | pos: 3050.005 | | enabled: 1 | | id: 10 +-- Chapter #12 | | name: Good Kitty | | pos: 3304.551 | | enabled: 1 | | id: 11 +-- Chapter #13 | | name: It's All A Trap | | pos: 3619.825 | | enabled: 1 | | id: 12 +-- Chapter #14 | | name: Only One Thing To Do | | pos: 3954.868 | | enabled: 1 | | id: 13 +-- Chapter #15 | | name: Let's Play a Game | | pos: 4261.591 | | enabled: 1 | | id: 14 +-- Chapter #16 | | name: Unwinding the Web | | pos: 4523.686 | | enabled: 1 | | id: 15 +-- Chapter #17 | | name: Nobody Likes a Rat | | pos: 4647.893 | | enabled: 1 | | id: 16 +-- Chapter #18 | | name: Staying Forever | | pos: 4880.709 | | enabled: 1 | | id: 17 +-- Chapter #19 | | name: Over and Done | | pos: 5225.345 | | enabled: 1 | | id: 18 +-- Chapter #20 | | name: End Titles | | pos: 5682.635 | | enabled: 1 | | id: 19 >>> m.tags.keys() [u'title', u'law_rating', u'production_studio', u'actor', u'summary', u'director', u'genre', u'written_by', u'keywords', u'date_released'] >>> m.tags['keywords'] <Tag object: u'parallel worlds, dream, eye, secret door, button'> # Multiple instances of a given tag are turned into lists >>> m.tags['actor'] [<Tag object: u'Dakota Fanning'>, <Tag object: u'Teri Hatcher'>, <Tag object: u'Jennifer Saunders'>, <Tag object: u'Dawn French'>] # Tags that map onto core attributes are exposed (and converted # to the expected form if necessary.) >>> m.keywords [u'parallel worlds', u'dream', u'eye', u'secret door', u'button'] >>> m.actors [u'Dakota Fanning', u'Teri Hatcher', u'Jennifer Saunders', u'Dawn French'] # Date tags are turned into Python datetime objects. >>> m.tags['date_released'] <Tag object: datetime.datetime(2009, 2, 6, 0, 0)> # Nested tags; Tags objects are also Tag objects (with a value, # langcode, etc.) >>> type(m.tags['law_rating']) <class 'kaa.metadata.core.Tags'> >>> m.tags['law_rating'].value u'PG' >>> m.tags['law_rating'] {u'country': <Tag object: u'US'>} # Per track tags also supported. >>> m.video[0].tags {u'bps': <Tag object: u'8499200'>, u'title': <Tag object: u'1080p non-3D'>} >>> m.video[1].tags {u'bps': <Tag object: u'3158016'>, u'title': <Tag object: u'720p 3D'>} If you have any files that aren't parsed properly, please make them available to me (or tell me how to recreate with mkvmerge) and I'll fix any bugs. Cheers, Jason. ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel