{"id":46,"date":"2011-06-30T09:00:10","date_gmt":"2011-06-30T13:00:10","guid":{"rendered":"http:\/\/provideotech.org\/wp\/?p=46"},"modified":"2012-02-02T01:07:54","modified_gmt":"2012-02-02T06:07:54","slug":"scheduling-kipro-recording-using-apple-ical","status":"publish","type":"post","link":"https:\/\/provideotech.org\/?p=46","title":{"rendered":"Scheduling KiPro recording using Apple iCal"},"content":{"rendered":"<p>The pressure towards automation in our industry is a constant which beats at a more rapid pace every day.  It is now a part of every broadcast facility on the planet.  Whenever there is more to do with less people, scheduling of recorded content can be advantageous. Small market stations often times cannot afford complex automation systems.  Larger market facility has some form of scheduling available, adding additional channels to expensive embedded systems can be cost prohibitive for special events or temporary ingest expansion.<\/p>\n<p>AJA\u2019s KiPro professional video recorder is an ideal tool for handling manual capture and playback.  However, AJA has provided an API to allow other products to control the KiPro, so enabling automation is capable out of the box.  Whether it is capturing multi-cam ISO feeds for special events or simply adding additional expansion, it can easily record video feeds directly to Apple ProRes to be immediately copied to central storage or edited directly from the record drive.<\/p>\n<p>Apple\u2019s iCal calendar software is a cost effective way to accomplish this task as it comes with very basic script tools and is included free of charge with every version of MacOS X dating all the way back to the beginning.  The user interface is simple and can be understood by untrained operators.<\/p>\n<p>Apple\u2019s iCal software has the capability to run Applescripts using its \u201calarm\u201d function.  This workflow involves saving very simple one line Applescripts (two scripts per KiPro, one for stop, one for record) as well as one primary host script that interacts with the KiPro via the *nix CLI application cURL.  This is just one example of control automation using the KiPro.<br \/>\n<!--more--><br \/>\nBelow is a basic overview of the process in action.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"49\" data-permalink=\"https:\/\/provideotech.org\/?attachment_id=49\" data-orig-file=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?fit=767%2C355&amp;ssl=1\" data-orig-size=\"767,355\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Process flow iCal Kipro\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?fit=720%2C333&amp;ssl=1\" class=\"alignnone size-full wp-image-49\" title=\"Process flow iCal Kipro\" src=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?resize=720%2C333&#038;ssl=1\" alt=\"\" width=\"720\" height=\"333\" srcset=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?w=767&amp;ssl=1 767w, https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?resize=300%2C138&amp;ssl=1 300w, https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro-flow.png?resize=500%2C231&amp;ssl=1 500w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a>Lets break down how to write our primary shell script.<\/p>\n<pre>#!\/bin\/sh\r\n\r\n#grab the IP or DNS name of our KiPro as the first CLI argument\r\nmykipro=$1\r\n\r\n#grab the transport command as the first CLI argument\r\ntransport=$2\r\n\r\n#define what to set our transport command to if \"start\" is selected\r\nif [ $transport = \"start\" ]; then\r\n\ttrigger=3\r\nfi\r\n\r\n#define what to set our transport command to if \"stop\" is selected\r\nif [ $transport = \"stop\" ]; then\r\n\ttrigger=4\r\nfi\r\n\r\n#set the value of our transport command for our cURL command\r\nvaluestring=\"newValue=$trigger\"\r\n\r\n#set the KiPro function to be transport control\r\nparamstring=\"paramName=eParamID_TransportCommand\"\r\n\r\n#run cURL\r\n# -s makes for silent output\r\n# -d allows us to use HTTP POST commands to send individual fields\r\n\r\n\/usr\/bin\/curl -s -d $paramstring -d $valuestring http:\/\/$mykipro\/options<\/pre>\n<p>We can save this script anywhere on our system, I\u2019d recommend \/usr\/local\/bin, \/Library\/Scripts, \/usr\/local\/scripts.  I have called this script kipro_trigger.  We need to make sure it is executable.<\/p>\n<pre>shell&gt; chmod +x \/path\/to\/script\/kipro_trigger<\/pre>\n<p>We can save this script anywhere on our system, I\u2019d recommend \/usr\/local\/bin, \/Library\/Scripts, \/usr\/local\/scripts.  I have called this script kipro_trigger.  We need to make sure it is executable.<\/p>\n<pre>shell&gt; \/path\/to\/script\/kipro_trigger ip.of.my.kipro start<\/pre>\n<p>and<\/p>\n<pre>shell&gt; \/path\/to\/script\/kipro_trigger ip.of.my.kipro stop<\/pre>\n<p>If all is working, we should be starting\/stopping our KiPro records each time we run this tool.<\/p>\n<p>Now we need to set up our Applescripts so iCal can be used to trigger our KiPro.  We are going to create two one-line Applescripts per KiPro we want to use.  Since iCal has no way to include variables in its alarm options, we need to hardcode one script for record and one script for stop for each KiPro we want to use.  For this example, my IP address is 192.168.3.168 and my script is \/usr\/local\/scripts\/kipro_trigger<\/p>\n<p>Start script:<\/p>\n<pre>do shell script \"\/usr\/local\/scripts\/kipro_trigger 192.168.3.168 start\"<\/pre>\n<p>Stop script:<\/p>\n<pre>do shell script \"\/usr\/local\/scripts\/kipro_trigger 192.168.3.168 stop\"<\/pre>\n<p>Save as many script pairs as necessary into \/Library\/Scripts\/Applescript.<\/p>\n<p>Name them based on your KiPro naming.  If the system at 192.168.3.168 is called \u201cNews\u201d, name your scripts \u201cNews Start\u201d and \u201cNews Stop\u201d.  In this example, my system is simply called \u201cKiPro\u201d, but we can save as many script pairs as we have KiPros.<\/p>\n<p>The last step is setting up iCal to call these scripts for your scheduled timeframe.  We need to make a new event in our calendar for the name of the recording we want to do.  Set our from\/to time to the event time and then add two alarms to the event.  First alarm should \u201cRun Script\u201d for our Start event and should be set \u201con date\u201d to the same time as the start date.  Second alarm should \u201cRun Script\u201d for our Stop event and be set to \u201con date\u201d for the end time.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"50\" data-permalink=\"https:\/\/provideotech.org\/?attachment_id=50\" data-orig-file=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png?fit=253%2C254&amp;ssl=1\" data-orig-size=\"253,254\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"iCal script interface\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png?fit=253%2C254&amp;ssl=1\" class=\"alignnone size-full wp-image-50\" title=\"iCal script interface\" src=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png?resize=253%2C254&#038;ssl=1\" alt=\"\" width=\"253\" height=\"254\" srcset=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png?w=253&amp;ssl=1 253w, https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 253px) 100vw, 253px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/provideotech.org\/wp-content\/uploads\/2011\/06\/ical-kipro.png\"><\/a>The first script we ran could be used with any scheduling toolkit as well, including Apple\u2019s launchd or linux cron.  Since the software to run this scheduler is fairly light weight, just about any Macintosh system running OS X with a network connection will work, enabling re-use of aging systems and providing budget efficiencies while adding functionality to the plant.<\/p>\n<p>Currently the scripts do not return any information regarding clip naming, so you will have to look at create dates\/modified dates on the files and line them up to your scheduled records.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The pressure towards automation in our industry is a constant which beats at a more rapid pace every day. It is now a part of every broadcast facility on the planet. Whenever there is more to do with less people, scheduling of recorded content can be advantageous. Small market stations often times cannot afford complex &hellip; <a href=\"https:\/\/provideotech.org\/?p=46\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Scheduling KiPro recording using Apple iCal&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-aja"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bwLw-K","_links":{"self":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=46"}],"version-history":[{"count":0,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/46\/revisions"}],"wp:attachment":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}