Fixes for video branch

- Removed superfluous code from media_types.image
- Updated lazy_pass_to_ugettext imports
This commit is contained in:
Joar Wandborg 2011-11-22 21:06:08 +01:00
parent 8aeb673877
commit 6506b1e22c
4 changed files with 5 additions and 47 deletions

View File

@ -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

View File

@ -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):
"""

View File

@ -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()

View File

@ -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