aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/reprocess.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2013-08-09 12:13:53 -0500
committerRodney Ewing <ewing.rj@gmail.com>2013-08-16 15:30:15 -0700
commit85ead8ac3cf59aeee12ddd3b33ecfeb03c3aa946 (patch)
treed41cbce28dab9eb632153ec7659137ad5b977567 /mediagoblin/gmg_commands/reprocess.py
parent58bacb33aca6505673f90460d31811ed487bcb4c (diff)
downloadmediagoblin-85ead8ac3cf59aeee12ddd3b33ecfeb03c3aa946.tar.lz
mediagoblin-85ead8ac3cf59aeee12ddd3b33ecfeb03c3aa946.tar.xz
mediagoblin-85ead8ac3cf59aeee12ddd3b33ecfeb03c3aa946.zip
"initial" reprocessing subcommand now works!
We are on our way now to a working reprocessing system under this redesign! This commit sponsored by Bjarni RĂșnar Einarsson. Thank you!
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":