diff options
author | Joar Wandborg <git@wandborg.com> | 2012-07-11 00:36:42 +0200 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-07-11 00:36:42 +0200 |
commit | 6471291575c97f03d129051dc3d2bef28b4d89f2 (patch) | |
tree | 0c1252c0c23c2978736dd6eb819aefa89c1e355a /mediagoblin/processing/task.py | |
parent | 51eb0267d901bafcc90879dadbc2b8616ecdc4f5 (diff) | |
download | mediagoblin-6471291575c97f03d129051dc3d2bef28b4d89f2.tar.lz mediagoblin-6471291575c97f03d129051dc3d2bef28b4d89f2.tar.xz mediagoblin-6471291575c97f03d129051dc3d2bef28b4d89f2.zip |
Panel improvements
- Added progress meter for video and audio media types.
- Changed the __repr__ method of a MediaEntry to display a bit more
useful explanation.
- Added a new MediaEntry.state, 'processing', which means that the task
is running the processor on the item currently.
- Fixed some PEP8 issues in user_pages/views.py
- Fixed the ATOM TAG URI to show the correct year.
Diffstat (limited to 'mediagoblin/processing/task.py')
-rw-r--r-- | mediagoblin/processing/task.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py index af815362..58e36a11 100644 --- a/mediagoblin/processing/task.py +++ b/mediagoblin/processing/task.py @@ -44,20 +44,24 @@ class ProcessMedia(Task): entry = mgg.database.MediaEntry.one( {'_id': ObjectId(media_id)}) - _log.info('Running task {0} on media {1}: {2}'.format( - self.name, - entry._id, - entry.title)) - # Try to process, and handle expected errors. try: - #__import__(entry.media_type) manager = get_media_manager(entry.media_type) + + entry.state = u'processing' + entry.save() + _log.debug('Processing {0}'.format(entry)) + manager['processor'](entry) + + entry.state = u'processed' + entry.save() + except BaseProcessingFail as exc: mark_entry_failed(entry._id, exc) return + except ImportError as exc: _log.error( 'Entry {0} failed to process due to an import error: {1}'\ @@ -67,9 +71,6 @@ class ProcessMedia(Task): mark_entry_failed(entry._id, exc) - entry.state = u'processed' - entry.save() - def on_failure(self, exc, task_id, args, kwargs, einfo): """ If the processing failed we should mark that in the database. |