Disclaimer: If you are not familiar with the command line,property lists and Podcast Producer workflows (e.g. pcastaction)you might find this article challenging, but then you probably won't have any interest for it anyway =)
Objective: Have a master_workflow.pwf call a second_workflow.pwf where second_workflow is choosen from a pool of existing workflows already uploaded in Podcast Producer Server.
A) master_workflow modifications
Edit the template.plist in the master_workflow bundle
vi /path/to/master_workflow.pwf/Contents/Resources/template.plist
This is the XML needed in your taskSpecification block in order to chain the workflows
caveats: --prb and --input are Apple provided Dynamic properties, be sure to understand what they point to.
Watchout for Task Dependencies (DependsOnTasks)
taskSpecifications
dynamic-submit-workflow
arguments
workflow
--prb=$$GLOBAL::Library Bundle Path$$
--input=$$Content File Name$$
--workflow=$$workflow_1$$
--user=PODCAST_USER
--password=PASSWORD
command
/usr/bin/pcastaction
You also need to specify your property in the UserRequirements block. In this example it'd be:
userRequirements
workflow_1
Don't forget to upload/re-upload your modified master_workflow
$ > pcast --installworkflow --path /Path/to/master_workflow.pwf [--overwrite]
B) Generate a plist to use when submitting the file(s) to be processed by the chained workflows.In our case we generate this file dynamically, hence the title of the article (doh!).
vi /path/to/user_metadata.plist
This is what you should have in your plist
workflow_1
NAME_OF_THE_WORKFLOW_AS_IT_APPEARS_IN_SERVER_ADMIN
Note that unlike the "podcast" command the "pcastaction workflow" command needs to be fed the podcast *name* and *not* its UUID.
C) Use the plist generated in B) to start your workflows chain with the podcast cli tool.
Note that unlike the pcastaction workflow command the podcast cli tool requires the workflow UUID.
$ > pcast --submit --file /path/to/file/to/submit --workflow_uuid master_workflow_UUID --metadata /path/to/user_metadata.plist
Recommended ReadingPodcast Producer : Writing Actions
http://developer.apple.com/mac/articles/server/writingpodcastactions.html
Podcast Producer Administration
http://images.apple.com/server/macosx/docs/Podcast_Producer_Admin_v10.6.pdf
Notes
-We successfully chain 3 workflows but there is no reason why you shouldn't be able to chain more
-When in trouble check logs...including /Library/Logs/pcastserved/DiagnosticReports
-Watch your chained workflows progress in Xgrid Admin.
-To see the syntax and options to chain workflows
$ > pcastaction help workflow