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.
This commit is contained in:
@@ -25,12 +25,23 @@ from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ProgressCallback(object):
|
||||
def __init__(self, entry):
|
||||
self.entry = entry
|
||||
|
||||
def __call__(self, progress):
|
||||
if progress:
|
||||
self.entry.transcoding_progress = progress
|
||||
self.entry.save()
|
||||
|
||||
|
||||
def create_pub_filepath(entry, filename):
|
||||
return mgg.public_store.get_unique_filepath(
|
||||
['media_entries',
|
||||
unicode(entry._id),
|
||||
filename])
|
||||
|
||||
|
||||
class FilenameBuilder(object):
|
||||
"""Easily slice and dice filenames.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user