add reprocess_all function. still need to add code to reprocess all failed entries
This commit is contained in:
parent
99b34c4ce6
commit
6fc8aaf65f
@ -16,6 +16,7 @@
|
|||||||
from mediagoblin.db.models import MediaEntry
|
from mediagoblin.db.models import MediaEntry
|
||||||
from mediagoblin.gmg_commands import util as commands_util
|
from mediagoblin.gmg_commands import util as commands_util
|
||||||
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
||||||
|
from mediagoblin.tools.pluginapi import hook_handle
|
||||||
|
|
||||||
|
|
||||||
def reprocess_parser_setup(subparser):
|
def reprocess_parser_setup(subparser):
|
||||||
@ -81,7 +82,34 @@ def _set_media_type(args):
|
|||||||
' set the --type flag'))
|
' set the --type flag'))
|
||||||
|
|
||||||
|
|
||||||
|
def _reprocess_all(args):
|
||||||
|
if not args[0].type:
|
||||||
|
if args[0].state == 'failed':
|
||||||
|
if args[0].available:
|
||||||
|
print '\n Available reprocess actions for all failed' \
|
||||||
|
' media_entries: \n \t --initial_processing'
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
#TODO reprocess all failed entries
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise Exception(_('You must set --type when trying to reprocess'
|
||||||
|
' all media_entries, unless you set --state'
|
||||||
|
' to "failed".'))
|
||||||
|
|
||||||
|
if args[0].available:
|
||||||
|
return hook_handle(('reprocess_action', args[0].type), args)
|
||||||
|
else:
|
||||||
|
return hook_handle(('media_reprocess', args[0].type), args)
|
||||||
|
|
||||||
|
|
||||||
def reprocess(args):
|
def reprocess(args):
|
||||||
commands_util.setup_app(args[0])
|
commands_util.setup_app(args[0])
|
||||||
|
|
||||||
|
if not args[0].state:
|
||||||
|
args[0].state = 'processed'
|
||||||
|
|
||||||
|
if args[0].all:
|
||||||
|
return _reprocess_all(args)
|
||||||
|
|
||||||
_set_media_type(args)
|
_set_media_type(args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user