From 6506b1e22c70b55a73ee4cb391aebaf73db79ef9 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Tue, 22 Nov 2011 21:06:08 +0100 Subject: [PATCH] Fixes for video branch - Removed superfluous code from media_types.image - Updated lazy_pass_to_ugettext imports --- mediagoblin/media_types/__init__.py | 10 ++---- mediagoblin/media_types/image/processing.py | 36 -------------------- mediagoblin/media_types/video/transcoders.py | 4 +-- mediagoblin/processing.py | 2 +- 4 files changed, 5 insertions(+), 47 deletions(-) diff --git a/mediagoblin/media_types/__init__.py b/mediagoblin/media_types/__init__.py index a2ea6bcb..f56fd942 100644 --- a/mediagoblin/media_types/__init__.py +++ b/mediagoblin/media_types/__init__.py @@ -18,7 +18,7 @@ import os import sys from mediagoblin import mg_globals -from mediagoblin.util import lazy_pass_to_ugettext as _ +from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ class FileTypeNotSupported(Exception): @@ -49,13 +49,7 @@ def get_media_managers(): Generator that returns all available media managers ''' for media_type in get_media_types(): - try: - __import__(media_type) - except ImportError as e: - raise Exception( - _('ERROR: Could not import {media_type}: {exception}').format( - media_type=media_type, - exception=e)) + __import__(media_type) yield media_type, sys.modules[media_type].MEDIA_MANAGER diff --git a/mediagoblin/media_types/image/processing.py b/mediagoblin/media_types/image/processing.py index 5e8e4e0a..2932c455 100644 --- a/mediagoblin/media_types/image/processing.py +++ b/mediagoblin/media_types/image/processing.py @@ -31,42 +31,6 @@ from mediagoblin.processing import BaseProcessingFail, \ # Media processing initial steps ################################ -class ProcessMedia(Task): - """ - Pass this entry off for processing. - """ - def run(self, media_id): - """ - Pass the media entry off to the appropriate processing function - (for now just process_image...) - """ - entry = mgg.database.MediaEntry.one( - {'_id': ObjectId(media_id)}) - - # Try to process, and handle expected errors. - try: - process_image(entry) - except BaseProcessingFail, exc: - mark_entry_failed(entry[u'_id'], exc) - return - - 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. - - Assuming that the exception raised is a subclass of BaseProcessingFail, - we can use that to get more information about the failure and store that - for conveying information to users about the failure, etc. - """ - entry_id = args[0] - mark_entry_failed(entry_id, exc) - - -process_media = registry.tasks[ProcessMedia.name] - def process_image(entry): """ diff --git a/mediagoblin/media_types/video/transcoders.py b/mediagoblin/media_types/video/transcoders.py index 493a837f..d7ed14ca 100644 --- a/mediagoblin/media_types/video/transcoders.py +++ b/mediagoblin/media_types/video/transcoders.py @@ -94,8 +94,8 @@ class VideoThumbnailer: self.videosink = gst.element_factory_make('fakesink', 'videosink') self.playbin.set_property('video-sink', self.videosink) - #self.audiosink = gst.element_factory_make('fakesink', 'audiosink') - #self.playbin.set_property('audio-sink', self.audiosink) + self.audiosink = gst.element_factory_make('fakesink', 'audiosink') + self.playbin.set_property('audio-sink', self.audiosink) self.bus = self.playbin.get_bus() self.bus.add_signal_watch() diff --git a/mediagoblin/processing.py b/mediagoblin/processing.py index 8738cbe2..89c4ac89 100644 --- a/mediagoblin/processing.py +++ b/mediagoblin/processing.py @@ -19,7 +19,7 @@ from celery.task import Task from mediagoblin.db.util import ObjectId from mediagoblin import mg_globals as mgg -from mediagoblin.util import lazy_pass_to_ugettext as _ +from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ from mediagoblin.media_types import get_media_manager -- 2.25.1