Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 291afa1df17d712b239a37e6a57d9e1e5888ca8a 0 parents
Alan Stanley authored
2  README
@@ -0,0 +1,2 @@
+Audio Solution Pack
+Adds all required Fedora objects to allow users to ingest nd retrieve audio files through the Islandora interface
138 audio_sp.inc
@@ -0,0 +1,138 @@
+
+<?php
+
+// $Id$
+
+class Exiftool {
+
+ private $pid = NULL;
+ private $item = NULL;
+
+ function __construct($pid) {
+ //drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+ $this->pid = $pid;
+ module_load_include('inc', 'fedora_repository', 'api/fedora_item');
+ $this->item = new Fedora_Item($this->pid);
+ }
+
+ function extractMetadata($parameterArray, $dsid, $file, $file_ext) {
+ $system = getenv('System');
+ $file_suffix = '_' . $dsid . '.xml';
+ $returnValue = TRUE;
+ $output = array();
+ exec('exiftool -X ' . escapeshellarg($file) . '', $output);
+ file_put_contents($file . $file_suffix, implode("\n", $output));
+ $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix;
+ return TRUE;
+ }
+
+ function displayMetadata() {
+ $output = '';
+ $exif = $this->item->get_datastream_dissemination('EXIF');
+ if (trim($exif) != '') {
+ $exifDom = DOMDocument::loadXML($this->item->get_datastream_dissemination('EXIF'));
+ if ($exifDom != NULL) {
+ $description = $exifDom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description');
+ if ($description->length > 0) {
+ $description = $description->item(0);
+ $output .= '<div class="fedora_technical_metadata"><ul>';
+ for ($i = 0; $i < $description->childNodes->length; $i++) {
+ $name = $description->childNodes->item($i)->nodeName;
+ $value = $description->childNodes->item($i)->nodeValue;
+ if ($name != '#text' && !preg_match('/^System\:.*$/', $name) && trim($value) != '') {
+ list($type, $name) = preg_split('/\:/', $name);
+ $name = trim(preg_replace('/(?<!^)([A-Z][a-z]|(?<=[a-z])[A-Z])/', " $1", $name));
+ $output .= '<li><b>' . $name . '</b>: ' . $value . ' </li>';
+ }
+ }
+ $output.='</ul></div>';
+
+ $fieldset = array(
+ '#title' => t("!text", array('!text' => 'Technical Metadata')),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#value' => $output
+ );
+ $output = theme('fieldset', $fieldset);
+ }
+ }
+ }
+ return $output;
+ }
+
+}
+
+class AudioManipulation {
+
+ function AudioManipulation() {
+ module_load_include('inc', 'fedora_repository', 'ObjectHelper');
+ }
+
+ function createMP3($parameterArray = NULL, $dsid, $file, $file_ext) {
+ $file_suffix = "_$dsid.$file_ext";
+ $return_value = TRUE;
+
+ $output = array();
+
+ exec('lame "' . $file . $file . 'mp3' . '" -V5 --vbr-new "', $output, $returnValue);
+
+ if ($returnValue == '0') {
+ $_SESSION['fedora_ingest_files']["PROXY_MP3"] = $file . 'mp3';
+ }
+ else {
+ ObjectHelper::warnIfMisconfigured('LAME'); /// need to add this to ObjectHelper
+ }
+ }
+
+}
+
+class SWFAudioPlayer {
+
+ private $pid = NULL;
+
+ function __construct($pid) {
+ $this->pid = $pid;
+ }
+
+ function showMP3() {
+
+ global $base_url;
+ $swfURL = $base_url . base_path() . 'fedora/repository/' . $this->pid . '/PROXY_MP3/MP3.mp3';
+ $swfImageURL = $base_url . base_path() . 'fedora/repository/' . $this->pid . '/TN/tn.jpg';
+
+ //PROXY_MP3 is the datastream id
+ $path = drupal_get_path('module', 'Fedora_Repository');
+ $fullPath = base_path() . $path;
+ $content = "";
+ $pathTojs = "/sites/all/libraries/mediaplayer4/jwplayer.js";
+ drupal_add_js("$pathTojs");
+
+ //swfobject.js is being loaded from swftools module but we are adding the path to jwplayer.js as it is needed as well
+ // if swftools are not enabled uncomment this to here drupal_add_js("sites/all/libraries/swfobject/swfobject.js");
+ // drupal_add_js("sites/all/libraries/swfobject/swfobject.js");
+
+ $content .= '<video id="flashContent"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</video>';
+ $content .= '<div id="dl_link"><a href="' . $swfURL . '">Download MP3</a></div>';
+
+// player bits
+
+ $js_string = <<<ENDJS
+
+var swfVersionStr = "10.0.0";
+var flashvars = { file:escape("$swfURL"),image:escape("$swfImageURL"),autostart:'false' };
+var params = { allowfullscreen:'false', allowscriptaccess:'false' };
+var attributes = { id:'AudioViewer', name:'AudioViewer' };
+swfobject.embedSWF('/sites/all/libraries/mediaplayer4/player.swf','flashContent','400','200','9.0.115','false',flashvars, params, attributes);
+swfobject.createCSS("#flashContent", "display:block;text-align:left;");
+ENDJS;
+ drupal_add_js($js_string, 'inline', 'header');
+
+ $collection_fieldset = array(
+ '#title' => t('Audio'),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#value' => $content);
+ return theme('fieldset', $collection_fieldset);
+ }
+
+}
BIN  images/audio-TN.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 islandora_audio_sp.info
@@ -0,0 +1,8 @@
+; $Id$
+name = Islandora Audio Solution Pack
+description = Islandora configurations for persisting and retrieving audio files
+dependencies[] = fedora_repository
+
+package = Islandora
+version = 6.1dev
+core = 6.x
24 islandora_audio_sp.install
@@ -0,0 +1,24 @@
+<?php
+
+function islandora_audio_sp_requirements($phase) {
+ global $base_url;
+
+ $requirements = array();
+
+
+ $requirements['fedora-lame']['title'] = t("Lame in \$PATH");
+ $result = exec('lame');
+ if (!$result) {
+ $requirements['fedora-lame']['value'] = t('Not in $PATH');
+ $requirements['fedora-lame']['description'] = t('Islandora will not be able to process audio. Click <a href="http://lame.sourceforge.net/download.php">here</a> for installation instructions');
+ $requirements['fedora-lame']['severity'] = REQUIREMENT_WARNING;
+ }
+ else {
+ $requirements['fedora-lame']['value'] = t("Available");
+ $requirements['fedora-lame']['severity'] = REQUIREMENT_OK;
+ }
+
+
+
+ return $requirements;
+}
49 islandora_audio_sp.module
@@ -0,0 +1,49 @@
+<?php
+
+// $Id$
+
+
+function islandora_audio_sp_required_fedora_objects() {
+
+
+ $module_path = drupal_get_path('module', 'islandora_audio_sp');
+
+ // array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required)
+ // make database insertions here.
+
+
+ return array(
+ 'islandora_audio_sp' => array(
+ 'module' => 'slandora_audio_sp',
+ 'title' => 'Islandora Audio Solution Pack',
+ 'objects' => array(
+ array(
+ 'foxml_file' => "$module_path/xml/islandora_sp_audioCModel.xml",
+ 'pid' => 'islandora:sp-audioCModel',
+ 'dsid' => NULL,
+ 'datastream_file' => NULL,
+ 'dsversion' => NULL,
+ ),
+
+ array(
+ 'pid' => 'islandora:audio_collection',
+ 'label' => 'Audio Collection',
+ 'cmodel' => 'islandora:collectionCModel',
+ 'parent' => 'islandora:top',
+ 'datastreams' => array(
+ array(
+ 'dsid' => 'COLLECTION_POLICY',
+ 'datastream_file' => "$module_path/xml/audio_collection_policy.xml",
+ ),
+ array(
+ 'dsid' => 'TN',
+ 'datastream_file' => "$module_path/images/audio-TN.jpg",
+ 'mimetype' => 'image/png',
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+}
+
12 xml/audio_collection_policy.xml
@@ -0,0 +1,12 @@
+<collection_policy xmlns="http://www.islandora.ca"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Island Voices Audio Collection"
+ xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
+ <content_models>
+ <content_model dsid="ISLANDORACM" name="New Audio" namespace="audio:collection"
+ pid="islandora:sp-audioCModel"/>
+ <content_model dsid="ISLANDORACM" name="New Collection" namespace="audio:collections"
+ pid="islandora:collectionCModel"/>
+ </content_models>
+ <search_terms/>
+ <relationship>isMemberOfCollection</relationship>
+</collection_policy>
171 xml/islandora_sp_audioCModel.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<foxml:digitalObject VERSION="1.1" PID="islandora:sp-audioCModel"
+xmlns:foxml="info:fedora/fedora-system:def/foxml#"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
+<foxml:objectProperties>
+<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
+<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Audio Content Model"/>
+<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
+<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2010-01-26T21:29:20.416Z"/>
+<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2011-06-17T16:37:06.901Z"/>
+</foxml:objectProperties>
+<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
+<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2010-01-26T21:29:20.416Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="387">
+<foxml:xmlContent>
+<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
+ <dc:title>Audio Content Model</dc:title>
+ <dc:identifier>islandora:sp-audioCModel</dc:identifier>
+</oai_dc:dc>
+</foxml:xmlContent>
+</foxml:datastreamVersion>
+</foxml:datastream>
+<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
+<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="RELS-EXT" CREATED="2011-04-18T01:02:46.107Z" MIMETYPE="text/xml" SIZE="288">
+<foxml:xmlContent>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description rdf:about="info:fedora/islandora:sp-audioCModel">
+ <hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/fedora-system:ContentModel-3.0"></hasModel>
+ </rdf:Description>
+</rdf:RDF>
+</foxml:xmlContent>
+</foxml:datastreamVersion>
+</foxml:datastream>
+<foxml:datastream ID="ISLANDORACM" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
+<foxml:datastreamVersion ID="ISLANDORACM.0" LABEL="Islandora Content Model for Audio" CREATED="2011-05-31T14:32:57.656Z" MIMETYPE="text/xml" SIZE="44664">
+<foxml:xmlContent>
+<content_model xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="audio content model" xsi:schemaLocation="http://www.islandora.ca http://localhost/islandoracm.xsd">
+ <mimetypes>
+ <type>audio/mp3</type>
+ <type>audio/mpeg</type>
+ <type>audio/x-wav</type>
+ <type>audio/vnd.wave</type>
+ </mimetypes>
+ <ingest_rules>
+ <rule>
+ <applies_to>audio/mp3</applies_to>
+ <applies_to>audio/mpeg</applies_to>
+ <applies_to>audio/x-wav</applies_to>
+ <applies_to>audio/vnd.wave</applies_to>
+ <applies_to>audio/ogg</applies_to>
+ <applies_to>audio/x-aiff</applies_to>
+ <ingest_methods>
+ <ingest_method class="Exiftool" dsid="OBJ_EXIFTOOL" file="audio_sp.inc" method="extractMetadata" modified_files_ext="" module="islandora_audio_sp"></ingest_method>
+ </ingest_methods>
+ </rule>
+ <rule>
+ <applies_to>audio/x-wav</applies_to>
+ <applies_to>audio/vnd.wave</applies_to>
+ <applies_to>audio/mp3</applies_to>
+ <applies_to>audio/mpeg</applies_to>
+ <ingest_methods>
+ <ingest_method class="AudioManipulation" dsid="PROXY_MP3" file="audio_sp.inc" method="createMP3" modified_files_ext="mp3" module="islandora_audio_sp"></ingest_method>
+ </ingest_methods>
+ </rule>
+ </ingest_rules>
+ <datastreams>
+ <datastream dsid="OBJ"></datastream>
+ <datastream dsid="PROXY_MP3">
+ <display_method class="SWFAudioPlayer" file="audio_sp.inc" method="showMP3" module="islandora_audio_sp"></display_method>
+ </datastream>
+ <datastream dsid="OBJ_EXIFTOOL"></datastream>
+ <datastream dsid="TN"></datastream>
+ </datastreams>
+ <ingest_form dsid="QDC" page="2">
+ <form_builder_method class="QtFormBuilder" file="plugins/QtFormBuilder.php" handler="handleQDCForm" method="buildQDCForm" module=""></form_builder_method>
+ <form_elements>
+ <element label="Title/Caption/Media Name" name="dc:title" required="true" type="textfield">
+ <description>The name given to the file</description>
+ </element>
+ <element label="Creator/" name="dc:creator" type="textfield">
+ <description>An entity primarily responsible for making the
+ content of the resource such as a person, organization or
+ service.</description>
+ </element>
+ <element label="Subject" name="dc:subject" type="select">
+ <description>An entity primarily responsible for making the
+ content of the resource such as a person, organization or
+ service.</description>
+ <authoritative_list>
+ <item>home recording</item>
+ <item>meeting</item>
+ <item>presentation</item>
+ <item>sound</item>
+ </authoritative_list>
+ </element>
+ <element label="Description of Media" name="dc:description" required="true" type="textarea">
+ <description>Examples include an abstract, table of
+ contents, or free-text account of the content of the
+ resource.</description>
+ </element>
+ <element label="Publisher" name="dc:publisher" type="textfield">
+ <description>An entity, (including persons, organizations,
+ or services), responsible for making the resource
+ available.</description>
+ </element>
+ <element label="Contributor" name="dc:contributor" type="textfield">
+ <description>An entity responsible for contributing to the
+ content of the resource such as a person, organization or
+ service.</description>
+ </element>
+ <element label="Date" name="dc:date" type="textfield">
+ <description>Temporal scope of the content if known. Date
+ format is YYYY-MM-DD (e.g. 1890,1910-10,or
+ 2007-10-23)</description>
+ </element>
+ <element label="Resource Type" name="dc:type" type="select">
+ <description>Genre of the content of the resource. Examples
+ include: home page, novel, poem, working paper, technical
+ report, essay, dictionary.</description>
+ <authoritative_list>
+ <item>none</item>
+ <item>video</item>
+ <item>event</item>
+ <item>image</item>
+ <item>interactive resource</item>
+ <item>model</item>
+ <item>party</item>
+ <item>physical object</item>
+ <item>place</item>
+ <item>service</item>
+ <item>software</item>
+ <item>sound</item>
+ <item>text</item>
+ </authoritative_list>
+ </element>
+ <element label="Source" name="dc:source" type="textfield">
+ <description>A reference to a resource from which the
+ present resource is derived.</description>
+ </element>
+ <element label="Identifier" name="dc:identifier" type="textfield">
+ <description>A unique reference to the resource; In this
+ instance, the accession number or collection
+ number.</description>
+ </element>
+ <element label="Language" name="dc:language" type="select">
+ <description>The language of the intellectual content of
+ the resource.</description>
+ <authoritative_list>
+ <item field="eng">English</item>
+ <item field="fre">French</item>
+ </authoritative_list>
+ </element>
+ <element label="Relation" name="dc:relation" type="textfield">
+ <description>Reference to a related resource.</description>
+ </element>
+ <element label="Rights Management" name="dc:rights" type="textarea">
+ <description>Information about intellectual property
+ rights, copyright, and various property
+ rights.</description>
+ </element>
+ </form_elements>
+ </ingest_form>
+ <forms>
+ <form class="" dsid="" file="" module="" name="">
+ </form>
+ </forms>
+</content_model>
+</foxml:xmlContent>
+</foxml:datastreamVersion>
+</foxml:datastream>
+</foxml:digitalObject>
Please sign in to comment.
Something went wrong with that request. Please try again.