<li>2.2 <a href="#dependencies">Dependencies on External Libraries</a></li>
<li>2.3 <a href="#conflicts">Conflict With Other Plugins</a></li>
</ul>
</li>
</ul>
<style type="text/css">
<!--
.code {
background-color: #ddd;
border: 1px solid #bbb;
}-->
</style>
<p>The websubmit_file_metadata library enables extraction and update of file metadata.<br/>
It can be called from Python sources or run from the command line.<br/>
The library can be extended to support various formats thanks to plugins (which must be dropped in <code>/opt/invenio/lib/python/invenio/websubmit_file_metadata_plugins/</code> directory).</p>
<h2><a name="apis">1. APIs</a></h2>
<p>Two main functions can be imported from websubmit_file_metadata:</p>
and <code>can_write_local(..)</code> are called at runtime by the
library on all installed plugin to check which one can process the
given file for the given action. If one of these functions return
true, your plugin will be selected to process the file. You can omit
one or several of these functions (for eg. if you don't support
reading from remote server, simply omit <code>can_read_remote(..)</code>).</p>
<p>If your plugin returned <code>True</code> for a given action, the
corresponding
function <code>read_metadata_local(..)</code>, <code>read_metadata_remote(..)</code>
or <code>write_metadata_local(..)</code> is then called. You <b>must</b> therefore implement the corresponding function (for eg. if you return <code>True</code> for some file with <code>can_write_local(..)</code>, then you must implement <code>write_metadata_local(..)</code>).</p>
<p>Your plugin code should also define
the <code>__required_plugin_API_version__</code>variable, to define
the interface version your plugin is compatible with. For
eg. set <code>__required_plugin_API_version__ = "WebSubmit File Metadata Plugin API 1.0"</code>
</p>
<a name="can_read_local"></a>
<b>def can_read_local(inputfile):</b>
<pre>
Returns True if file can be processed by this plugin.
Parameters:
* inputfile (string) - path to a file to read metadata from
Returns: boolean
True if file can be processed
</pre>
<a name="can_read_remote"></a>
<b>def can_read_remote(inputfile):</b>
<pre>
Returns True if file at remote location can be processed by this plugin.
Parameters:
* inputfile (string) - URL to a file to read metadata from
Returns: boolean
True if file can be processed
</pre>
<a name="can_read_remote"></a>
<b>def can_write_local(inputfile):</b>
<pre>
Returns True if file can be processed by this plugin for writing.
Parameters:
* inputfile (string) - path to a file to update metadata