run initial processing on all failed entries
This commit is contained in:
parent
7584080bf7
commit
4e6013689b
@ -24,7 +24,8 @@ from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
||||
from mediagoblin.tools.pluginapi import hook_handle
|
||||
from mediagoblin.processing import (
|
||||
ProcessorDoesNotExist, ProcessorNotEligible,
|
||||
get_entry_and_processing_manager, get_processing_manager_for_type)
|
||||
get_entry_and_processing_manager, get_processing_manager_for_type,
|
||||
ProcessingManagerDoesNotExist)
|
||||
|
||||
|
||||
def reprocess_parser_setup(subparser):
|
||||
@ -307,6 +308,7 @@ def run(args):
|
||||
reprocess_action=args.reprocess_command,
|
||||
reprocess_info=reprocess_request)
|
||||
|
||||
|
||||
def bulk_run(args):
|
||||
pass
|
||||
|
||||
@ -317,8 +319,19 @@ def thumbs(args):
|
||||
|
||||
|
||||
def initial(args):
|
||||
#TODO initial processing on all failed media
|
||||
pass
|
||||
"""
|
||||
Reprocess all failed media
|
||||
"""
|
||||
query = MediaEntry.query.filter_by(state='failed')
|
||||
|
||||
for entry in query:
|
||||
try:
|
||||
media_entry, manager = get_entry_and_processing_manager(entry.id)
|
||||
run_process_media(
|
||||
media_entry,
|
||||
reprocess_action='initial')
|
||||
except ProcessingManagerDoesNotExist:
|
||||
print 'No such processing manager for {0}'.format(entry.media_type)
|
||||
|
||||
|
||||
def reprocess(args):
|
||||
|
@ -174,6 +174,8 @@ class MediaProcessor(object):
|
||||
class ProcessingKeyError(Exception): pass
|
||||
class ProcessorDoesNotExist(ProcessingKeyError): pass
|
||||
class ProcessorNotEligible(ProcessingKeyError): pass
|
||||
class ProcessingManagerDoesNotExist(ProcessingKeyError): pass
|
||||
|
||||
|
||||
|
||||
class ProcessingManager(object):
|
||||
@ -265,6 +267,9 @@ def get_processing_manager_for_type(media_type):
|
||||
Get the appropriate media manager for this type
|
||||
"""
|
||||
manager_class = hook_handle(('reprocess_manager', media_type))
|
||||
if not manager_class:
|
||||
raise ProcessingManagerDoesNotExist(
|
||||
"A processing manager does not exist for {0}".format(media_type))
|
||||
manager = manager_class()
|
||||
|
||||
return manager
|
||||
|
Loading…
x
Reference in New Issue
Block a user