aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/reprocess.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/gmg_commands/reprocess.py')
-rw-r--r--mediagoblin/gmg_commands/reprocess.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/mediagoblin/gmg_commands/reprocess.py b/mediagoblin/gmg_commands/reprocess.py
index 30575033..d6ac99ac 100644
--- a/mediagoblin/gmg_commands/reprocess.py
+++ b/mediagoblin/gmg_commands/reprocess.py
@@ -199,13 +199,35 @@ def _set_media_state(args):
args[0].state = 'processed'
+def extract_entry_and_type(media_id):
+ raise NotImplementedError
+
+
def available(args):
# Get the media type, either by looking up media id, or by specific type
+ try:
+ media_id = int(args.id_or_type)
+ media_type, media_entry = extract_entry_and_type(media_id)
+ except ValueError:
+ media_type = args.id_or_type
+ media_entry = None
+
+ manager_class = hook_handle(('reprocess_manager', media_type))
+ manager = manager_class()
- ### TODO: look up by id
+ if media_entry is None:
+ processors = manager.list_all_processors()
+ else:
+ processors = manager.list_eligible_processors(media_entry)
+
+ print "Available processors:"
+ print "---------------------"
- #
- pass
+ for processor in processors:
+ if processor.description:
+ print " - %s: %s" % (processor.name, processor.description)
+ else:
+ print " - %s" % processor.name
def run(args):
@@ -214,7 +236,6 @@ def run(args):
# Run eagerly unless explicetly set not to
if not args.celery:
os.environ['CELERY_ALWAYS_EAGER'] = 'true'
- commands_util.setup_app(args)
_set_media_state(args)
_set_media_type(args)
@@ -227,6 +248,8 @@ def run(args):
def reprocess(args):
+ commands_util.setup_app(args)
+
if args.reprocess_subcommand == "run":
run(args)
elif args.reprocess_subcommand == "available":