From: Jason T. <ta...@ur...> - 2010-08-22 22:13:52
|
Author: tack Date: Sun Aug 22 18:17:21 2010 New Revision: 4345 Log: Assign width/height attributes for video items; remove 'image' attribute after thumbnail is queued as it doesn't seem to be needed anymore and isn't registered as an attribute for any type in the db anyway. Modified: trunk/beacon/src/server/parser.py Modified: trunk/beacon/src/server/parser.py ============================================================================== --- trunk/beacon/src/server/parser.py (original) +++ trunk/beacon/src/server/parser.py Sun Aug 22 18:17:21 2010 @@ -248,7 +248,19 @@ if os.path.isfile(item.filename + ext): attributes['image'] = item.filename + ext break - + + # + # Type specific attributes + # + if type == 'video': + # Normally db.add_object() will take care of assigning type + # attributes from metadata, but some attributes for videos + # aren't at the top-level attribute object. For video + # dimensions, take the dimensions of the first video track. + if metadata.video: + attributes['width'] = metadata.video[0].get('width') + attributes['height'] = metadata.video[0].get('height') + attributes['metadata'] = metadata # now call extention plugins @@ -266,6 +278,7 @@ if t.needs_update and (not type == 'video' or not hasattr(item, 'filename') or utils.do_thumbnail(item.filename)): t.create(t.PRIORITY_LOW) + del attributes['image'] if not metadata.get('title'): # try to set a good title |