Fixes for video branch
- Removed superfluous code from media_types.image - Updated lazy_pass_to_ugettext imports
This commit is contained in:
parent
8aeb673877
commit
6506b1e22c
@ -18,7 +18,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from mediagoblin import mg_globals
|
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):
|
class FileTypeNotSupported(Exception):
|
||||||
@ -49,13 +49,7 @@ def get_media_managers():
|
|||||||
Generator that returns all available media managers
|
Generator that returns all available media managers
|
||||||
'''
|
'''
|
||||||
for media_type in get_media_types():
|
for media_type in get_media_types():
|
||||||
try:
|
|
||||||
__import__(media_type)
|
__import__(media_type)
|
||||||
except ImportError as e:
|
|
||||||
raise Exception(
|
|
||||||
_('ERROR: Could not import {media_type}: {exception}').format(
|
|
||||||
media_type=media_type,
|
|
||||||
exception=e))
|
|
||||||
|
|
||||||
yield media_type, sys.modules[media_type].MEDIA_MANAGER
|
yield media_type, sys.modules[media_type].MEDIA_MANAGER
|
||||||
|
|
||||||
|
@ -31,42 +31,6 @@ from mediagoblin.processing import BaseProcessingFail, \
|
|||||||
# Media processing initial steps
|
# 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):
|
def process_image(entry):
|
||||||
"""
|
"""
|
||||||
|
@ -94,8 +94,8 @@ class VideoThumbnailer:
|
|||||||
self.videosink = gst.element_factory_make('fakesink', 'videosink')
|
self.videosink = gst.element_factory_make('fakesink', 'videosink')
|
||||||
self.playbin.set_property('video-sink', self.videosink)
|
self.playbin.set_property('video-sink', self.videosink)
|
||||||
|
|
||||||
#self.audiosink = gst.element_factory_make('fakesink', 'audiosink')
|
self.audiosink = gst.element_factory_make('fakesink', 'audiosink')
|
||||||
#self.playbin.set_property('audio-sink', self.audiosink)
|
self.playbin.set_property('audio-sink', self.audiosink)
|
||||||
|
|
||||||
self.bus = self.playbin.get_bus()
|
self.bus = self.playbin.get_bus()
|
||||||
self.bus.add_signal_watch()
|
self.bus.add_signal_watch()
|
||||||
|
@ -19,7 +19,7 @@ from celery.task import Task
|
|||||||
from mediagoblin.db.util import ObjectId
|
from mediagoblin.db.util import ObjectId
|
||||||
from mediagoblin import mg_globals as mgg
|
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
|
from mediagoblin.media_types import get_media_manager
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user