I searched around on the web for SFTP upload examples but found none that did exactly what I wanted. I did find that Apple posted this tutorial which includes a ruby script that uses SFTP to publish files for a transcription service. I downloaded the example workflow from http://connect.apple.com and the edited files I needed to suit my needs.
First Step
Copied the upload_to_transcription_service.rb and renamed it to upload_to_unix.rb. removed unneeded pieces of the code and added chmod.
sftp.setstat(movie_destination_path, :permissions => 0664)
Second step
Created a basic workflow with podcast capture and then edited the template.
<key>upload-to-cunix</key>
<dict>
<key>arguments</key>
<array>
<string>shell</string>
<string>--prb=$$GLOBAL::Library Bundle Path$$</string>
<string>--</string>
<string>$$Workflow Resource Path$$/Tools/upload_to_cunix.rb</string>
<string>$$SOURCE::0::Filename$$</string>
<string>$$SFTP CUNIX$$</string>
<string>$$SFTP CUNIX Folder path 2010$$</string>
<string>$$SFTP CUNIX Username$$</string>
<string>$$Global Resource Path$$/id_rsa</string>
</array>
<key>command</key>
<string>/usr/bin/pcastaction</string>
<key>dependsOnTasks</key>
<array>
<string>preflight</string>
</array>
</dict>
0 comments:
Post a Comment