{"id":125,"date":"2014-02-25T14:02:49","date_gmt":"2014-02-25T19:02:49","guid":{"rendered":"http:\/\/provideotech.org\/?p=125"},"modified":"2016-08-18T14:50:25","modified_gmt":"2016-08-18T18:50:25","slug":"alternatep5previews","status":"publish","type":"post","link":"https:\/\/provideotech.org\/?p=125","title":{"rendered":"Alternate P5 preview\/metadata automation"},"content":{"rendered":"<p>In previous articles I&#8217;ve shown how to create custom preview generators using Archiware&#8217;s scripting engine. In addition to using custom preview and metadata scripts, there is a method of automatically adding these items to any archived asset with P5 Archive by preparing the filesystem appropriately.<\/p>\n<p>Lets say we want to archive the file <em>\/Volumes\/MySAN\/Projects\/01-Movie.mov<\/em>.<\/p>\n<p>We also have some metadata we want associated with that file and a proxy that has already been generated. Lets assume our metadata fields are as follows:<\/p>\n<pre>Project: MyProject\r\nProducer: Mike\r\nEditor: Brian\r\n<\/pre>\n<p>We also have a proxy we already created that lives at <em>\/Volumes\/MySAN\/Projects\/proxies\/01-Movie.mp4<\/em><\/p>\n<p>Knowing that these elements exist, we can create a folder containing the elements that will automatically get picked up by P5 when the archive of that file runs.<br \/>\n<!--more--><br \/>\n<strong>Creating Folders<\/strong><br \/>\nFirst, we need to create the folder in the relative location. So if our file is at <em>\/Volumes\/MySAN\/Projects\/01-Movie.mov<\/em>, we will want to create a new folder at <em>\/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/<\/em><\/p>\n<p>Inside this folder, we need to create two more directories, previews and metadata, and in each of those folders, a new folder with the name of the file we want to archive. You should now have the following folders created:<\/p>\n<pre>\r\n\/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/previews\/01-Movie.mov\/\r\n\/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/metadata\/01-Movie.mov\/\r\n<\/pre>\n<p>These folders would need to be created for each and every file you plan on archiving and associating metadata\/previews with.<\/p>\n<p><strong>Associating the Preview<\/strong><br \/>\nIf you&#8217;d like to have P5 pick up your proxy at <em>\/Volumes\/MySAN\/Projects\/proxies\/01-Movie.mp4<\/em> when archiving <em>\/Volumes\/MySAN\/Projects\/01-Movie.mov<\/em>, you could either copy or symlink the file:<\/p>\n<p>This would make a copy of the proxy file which would then be moved into the P5 preview index at archive time:<\/p>\n<pre lang=\"bash\">cp \/Volumes\/MySAN\/Projects\/proxies\/01-Movie.mp4 \/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/previews\/01-Movie.mov\/preview.mp4<\/pre>\n<p>This would simply link to the proxy and still make a copy into the P5 preview index at archive time:<\/p>\n<pre lang=\"bash\">ln -s \/Volumes\/MySAN\/Projects\/proxies\/01-Movie.mp4 \/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/previews\/01-Movie.mov\/preview.mp4<\/pre>\n<p>After running either of these commands, you should now have a valid preview file called <em>preview.mp4<\/em> in your <em>.com.archiware\/presstore\/previews\/<filename>\/<\/em> folder.<\/p>\n<p>Note: this also works with any other format that has a web capable MIME extension, so .jpg,.mp4,.mov, and so on.  P5 will pass this proxy through the default MIME handler on the system.  It determines MIME type by extension, so make sure your preview has a properly formatted name.<\/p>\n<p><strong>Associating the Metadata<\/strong><br \/>\nNow that we&#8217;ve created our copy\/link to our preview, we likely will want to associate metadata as well. First, we will have to determine what fields line up to which elements in P5. For our example above, we will need 3 metadata fields in the P5 archive index to send information into. I&#8217;ve set up these elements in P5 as follows:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-25-at-1.42.04-PM.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"126\" data-permalink=\"https:\/\/provideotech.org\/?attachment_id=126\" data-orig-file=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-25-at-1.42.04-PM.png?fit=945%2C240&amp;ssl=1\" data-orig-size=\"945,240\" 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=\"P5 Metadata Example\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-25-at-1.42.04-PM.png?fit=720%2C183&amp;ssl=1\" class=\"alignnone size-full wp-image-126\" alt=\"P5 Metadata Example\" src=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-25-at-1.42.04-PM.png?resize=720%2C183&#038;ssl=1\" width=\"720\" height=\"183\" srcset=\"https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-25-at-1.42.04-PM.png?w=945&amp;ssl=1 945w, https:\/\/i0.wp.com\/provideotech.org\/wp-content\/uploads\/2014\/02\/Screen-Shot-2014-02-25-at-1.42.04-PM.png?resize=300%2C76&amp;ssl=1 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>These line up to my three fields above:<\/p>\n<pre>Project: MyProject\r\nProducer: Mike\r\nEditor: Brian\r\n<\/pre>\n<p>We will now need to build a standard Apple plist file that contains our metadata map. For more info on Apple&#8217;s plist DTD, see <a title=\"here\" href=\"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\" target=\"_blank\">here<\/a>.<\/p>\n<pre lang=\"xml\">\r\n<dict>\r\n\t<key>user_project<\/key><string>MyProject<\/string>\r\n\t<key>user_producer<\/key><string>Mike<\/string>\r\n\t<key>user_editor<\/key><string>Brian<\/string>\r\n<\/dict>\r\n<\/pre>\n<p>This file needs to be saved as <em>metadata.plist<\/em> in our metadata folder <em>\/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/metadata\/01-Movie.mov\/<\/em>.  You should now have a file in the following location:<\/p>\n<pre>\/Volumes\/MySAN\/Projects\/.com.archiware\/presstore\/metadata\/01-Movie.mov\/metadata.plist<\/pre>\n<p><strong>Use cases<\/strong><br \/>\nClearly this isn&#8217;t all that useful for day to day manual archiving, but if triggering an archive of files from a third party system, you could relatively easily loop through all those files being submitted for archive, create symlinks and plist files, and then submit the archive.  Upon success, it is safe to simply remove the <\/p>\n<pre>.com.archiware<\/pre>\n<p> directory.  This could be done as a post job action in P5 or initiated by your triggering system upon successful job completion.  The benefit of using this method over the standard scripting method is that there is no post-processing needed by Archiware to be done on job completion and no further lookup is required for previews\/metadata.  In situations where it is difficult to determine specific information (paths, metadata) about a file from its full path alone, this method will provide a much easier way of generating this content.<\/p>\n<p><strong>Caveats<\/strong><br \/>\nBecause of the way this method works, it does require write access to the source filesystem and does require writing custom files\/folders into that source.  If working with volume level\/read-only filesystems, it won&#8217;t provide much use.  There also is the post-job management aspect if you&#8217;d like to keep your source filesystem clean.  On *nix filesystems, these directories won&#8217;t show up to clients, but within an Windows or cross-platform environment, it can be quite messy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In previous articles I&#8217;ve shown how to create custom preview generators using Archiware&#8217;s scripting engine. In addition to using custom preview and metadata scripts, there is a method of automatically adding these items to any archived asset with P5 Archive by preparing the filesystem appropriately. Lets say we want to archive the file \/Volumes\/MySAN\/Projects\/01-Movie.mov. We &hellip; <a href=\"https:\/\/provideotech.org\/?p=125\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Alternate P5 preview\/metadata automation&#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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-archiware-p5"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bwLw-21","_links":{"self":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/125","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=125"}],"version-history":[{"count":0,"href":"https:\/\/provideotech.org\/index.php?rest_route=\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/provideotech.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}