Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alan Stanley
committed
Sep 7, 2011
0 parents
commit 291afa1
Showing
8 changed files
with
404 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Oops, something went wrong.