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):
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
# 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):
"""
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()
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