From 3c163bec15b8474ba323b902e15288c83b3c76ff Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 24 Nov 2010 09:00:44 -0500 Subject: [PATCH] apply patch from cbeer/islandora#video to islandora git --- collection_policies/qt_collection_policy.xml | 35 ++ collection_views/Video-COLLECTION_VIEW.xml | 64 ++++ content_models/BASIC_AUDIO.xml | 218 +++++++++++ content_models/BASIC_VIDEO.xml | 218 +++++++++++ content_models/STANDARD_QT.xml | 137 +++++++ content_models/islandora_qtCModel.xml | 163 +++++++++ js/AC_Quicktime.js | 362 +++++++++++++++++++ plugins/Exiftool.inc | 24 ++ plugins/Ffmpeg.inc | 35 ++ plugins/QtFormBuilder.php | 102 ++++++ plugins/qt_viewer.inc | 138 +++++++ 11 files changed, 1496 insertions(+) create mode 100644 collection_policies/qt_collection_policy.xml create mode 100644 collection_views/Video-COLLECTION_VIEW.xml create mode 100644 content_models/BASIC_AUDIO.xml create mode 100644 content_models/BASIC_VIDEO.xml create mode 100644 content_models/STANDARD_QT.xml create mode 100644 content_models/islandora_qtCModel.xml create mode 100644 js/AC_Quicktime.js create mode 100644 plugins/Exiftool.inc create mode 100644 plugins/Ffmpeg.inc create mode 100644 plugins/QtFormBuilder.php create mode 100644 plugins/qt_viewer.inc diff --git a/collection_policies/qt_collection_policy.xml b/collection_policies/qt_collection_policy.xml new file mode 100644 index 00000000..2f8df517 --- /dev/null +++ b/collection_policies/qt_collection_policy.xml @@ -0,0 +1,35 @@ + + + + + + + +dc.title + +dc.creator + +dc.description + +dc.date + +dc.identifier + +dc.language + +dc.publisher + +dc.rights + +dc.subject + +dc.relation + +dcterms.temporal + +dcterms.spatial + + +isMemberOfCollection + + diff --git a/collection_views/Video-COLLECTION_VIEW.xml b/collection_views/Video-COLLECTION_VIEW.xml new file mode 100644 index 00000000..f52dea89 --- /dev/null +++ b/collection_views/Video-COLLECTION_VIEW.xml @@ -0,0 +1,64 @@ + + + + + + + + +
+ +

+ +
+ + + +

+
+
+
+
+ + + + + + + + +
+
+ + + + /fedora/repository/ + + + + + + /fedora/repository/ + + /THUMBNAIL + + + +
+
+ + + + + /fedora/repository/ + /-/ + + + + +
+ +
+
+
+
diff --git a/content_models/BASIC_AUDIO.xml b/content_models/BASIC_AUDIO.xml new file mode 100644 index 00000000..e3030f9f --- /dev/null +++ b/content_models/BASIC_AUDIO.xml @@ -0,0 +1,218 @@ + + + + video/quicktime + + + + + plugins/qt_viewer.inc + ShowQtStreamsInFieldSets + showQt + + + + + plugins/ShowStreamsInFieldSets.inc + ShowStreamsInFieldSets + showQdc + + + + + + + + video/quicktime + + + + + + + plugins/QtFormBuilder.php + QtFormBuilder + buildQDCForm + handleQDCForm + + + + + + dc:title + textfield + The name given to the Video + true + + + + dc:creator + textfield + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + + dc:subject + select + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + + home recording + home recording + + + meeting + meeting + + + presentation + presentation + + + sound + sound + + + + + + + dc:description + textarea + Examples include an abstract, table of contents, or free-text account of the content of the resource. + true + + + + dc:publisher + textfield + An entity, (including persons, organizations, or services), responsible for making the resource available. + false + + + + dc:contributor + textfield + An entity responsible for contributing to the content of the resource such as a person, organization or service. + false + + + + dc:date + textfield + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + false + + + + dc:type + select + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + false + + + none + none + + + video + video + + + + event + event + + + image + image + + + interactive resource + interactive resource + + + model + model + + + party + party + + + physical object + physical object + + + place + place + + + service + service + + + software + software + + + sound + sound + + + text + text + + + + + + dc:source + textfield + A reference to a resource from which the present resource is derived. + false + + + + dc:identifier + textfield + A unique reference to the resource; In this instance, the accession number or collection number. + false + + + + dc:language + select + The language of the intellectual content of the resource. + false + + + eng + English + + + fre + French + + + + + + dc:relation + textfield + Reference to a related resource. + false + + + + dc:rights + textarea + Information about intellectual property rights, copyright, and various property rights. + false + + + + diff --git a/content_models/BASIC_VIDEO.xml b/content_models/BASIC_VIDEO.xml new file mode 100644 index 00000000..e3030f9f --- /dev/null +++ b/content_models/BASIC_VIDEO.xml @@ -0,0 +1,218 @@ + + + + video/quicktime + + + + + plugins/qt_viewer.inc + ShowQtStreamsInFieldSets + showQt + + + + + plugins/ShowStreamsInFieldSets.inc + ShowStreamsInFieldSets + showQdc + + + + + + + + video/quicktime + + + + + + + plugins/QtFormBuilder.php + QtFormBuilder + buildQDCForm + handleQDCForm + + + + + + dc:title + textfield + The name given to the Video + true + + + + dc:creator + textfield + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + + dc:subject + select + An entity primarily responsible for making the content of the resource such as a person, organization or service. + false + + + + home recording + home recording + + + meeting + meeting + + + presentation + presentation + + + sound + sound + + + + + + + dc:description + textarea + Examples include an abstract, table of contents, or free-text account of the content of the resource. + true + + + + dc:publisher + textfield + An entity, (including persons, organizations, or services), responsible for making the resource available. + false + + + + dc:contributor + textfield + An entity responsible for contributing to the content of the resource such as a person, organization or service. + false + + + + dc:date + textfield + Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23) + false + + + + dc:type + select + Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary. + false + + + none + none + + + video + video + + + + event + event + + + image + image + + + interactive resource + interactive resource + + + model + model + + + party + party + + + physical object + physical object + + + place + place + + + service + service + + + software + software + + + sound + sound + + + text + text + + + + + + dc:source + textfield + A reference to a resource from which the present resource is derived. + false + + + + dc:identifier + textfield + A unique reference to the resource; In this instance, the accession number or collection number. + false + + + + dc:language + select + The language of the intellectual content of the resource. + false + + + eng + English + + + fre + French + + + + + + dc:relation + textfield + Reference to a related resource. + false + + + + dc:rights + textarea + Information about intellectual property rights, copyright, and various property rights. + false + + + + diff --git a/content_models/STANDARD_QT.xml b/content_models/STANDARD_QT.xml new file mode 100644 index 00000000..5d95e27b --- /dev/null +++ b/content_models/STANDARD_QT.xml @@ -0,0 +1,137 @@ + + + + video/quicktime + video/mp4 + + audio/mp3 + audio/x-aiff + + + + video/quicktime + video/mp4 + + audio/mp3 + audio/x-aiff + + + + + + + + + + + + + 92x92 + + + + + + + + + + + + + + + + + + + + + + The name given to the file + + + An entity primarily responsible for making the + content of the resource such as a person, organization or + service. + + + An entity primarily responsible for making the + content of the resource such as a person, organization or + service. + + home recording + meeting + presentation + sound + + + + Examples include an abstract, table of + contents, or free-text account of the content of the + resource. + + + An entity, (including persons, organizations, + or services), responsible for making the resource + available. + + + An entity responsible for contributing to the + content of the resource such as a person, organization or + service. + + + Temporal scope of the content if known. Date + format is YYYY-MM-DD (e.g. 1890,1910-10,or + 2007-10-23) + + + Genre of the content of the resource. Examples + include: home page, novel, poem, working paper, technical + report, essay, dictionary. + + none + video + event + image + interactive resource + model + party + physical object + place + service + software + sound + text + + + + A reference to a resource from which the + present resource is derived. + + + A unique reference to the resource; In this + instance, the accession number or collection + number. + + + The language of the intellectual content of + the resource. + + English + French + + + + Reference to a related resource. + + + Information about intellectual property + rights, copyright, and various property + rights. + + + + + diff --git a/content_models/islandora_qtCModel.xml b/content_models/islandora_qtCModel.xml new file mode 100644 index 00000000..0323fc31 --- /dev/null +++ b/content_models/islandora_qtCModel.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + Quicktime Content Model + islandora:qtCModel + + + + + + + + + + video/quicktime + video/mp4 + audio/mp3 + audio/x-aiff + + + + video/quicktime + video/mp4 + + audio/mp3 + audio/x-aiff + + + + + + + + + + + + + 92x92 + + + + + + + + + + + + + + + + + + + + + + The name given to the file + + + An entity primarily responsible for making the + content of the resource such as a person, organization or + service. + + + An entity primarily responsible for making the + content of the resource such as a person, organization or + service. + + home recording + meeting + presentation + sound + + + + Examples include an abstract, table of + contents, or free-text account of the content of the + resource. + + + An entity, (including persons, organizations, + or services), responsible for making the resource + available. + + + An entity responsible for contributing to the + content of the resource such as a person, organization or + service. + + + Temporal scope of the content if known. Date + format is YYYY-MM-DD (e.g. 1890,1910-10,or + 2007-10-23) + + + Genre of the content of the resource. Examples + include: home page, novel, poem, working paper, technical + report, essay, dictionary. + + none + video + event + image + interactive resource + model + party + physical object + place + service + software + sound + text + + + + A reference to a resource from which the + present resource is derived. + + + A unique reference to the resource; In this + instance, the accession number or collection + number. + + + The language of the intellectual content of + the resource. + + English + French + + + + Reference to a related resource. + + + Information about intellectual property + rights, copyright, and various property + rights. + + + + + + + + diff --git a/js/AC_Quicktime.js b/js/AC_Quicktime.js new file mode 100644 index 00000000..182dc0b5 --- /dev/null +++ b/js/AC_Quicktime.js @@ -0,0 +1,362 @@ +/* + +File: AC_QuickTime.js + +Abstract: This file contains functions to generate OBJECT and EMBED tags for QuickTime content. + +Version: <1.2> + +Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple +Computer, Inc. ("Apple") in consideration of your agreement to the +following terms, and your use, installation, modification or +redistribution of this Apple software constitutes acceptance of these +terms. If you do not agree with these terms, please do not use, +install, modify or redistribute this Apple software. + +In consideration of your agreement to abide by the following terms, and +subject to these terms, Apple grants you a personal, non-exclusive +license, under Apple's copyrights in this original Apple software (the +"Apple Software"), to use, reproduce, modify and redistribute the Apple +Software, with or without modifications, in source and/or binary forms; +provided that if you redistribute the Apple Software in its entirety and +without modifications, you must retain this notice and the following +text and disclaimers in all such redistributions of the Apple Software. +Neither the name, trademarks, service marks or logos of Apple Computer, +Inc. may be used to endorse or promote products derived from the Apple +Software without specific prior written permission from Apple. Except +as expressly stated in this notice, no other rights or licenses, express +or implied, are granted by Apple herein, including but not limited to +any patent rights that may be infringed by your derivative works or by +other works in which the Apple Software may be incorporated. + +The Apple Software is provided by Apple on an "AS IS" basis. APPLE +MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION +THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND +OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. + +IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, +MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED +AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), +STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +Copyright © 2006-2007 Apple Computer, Inc., All Rights Reserved + +*/ + +/* + * This file contains functions to generate OBJECT and EMBED tags for QuickTime content. + */ + +/************** LOCALIZABLE GLOBAL VARIABLES ****************/ + +var gArgCountErr = 'The "%%" function requires an even number of arguments.' + + '\nArguments should be in the form "atttributeName", "attributeValue", ...'; + +/******************** END LOCALIZABLE **********************/ + +var gTagAttrs = null; +var gQTGeneratorVersion = 1.2; +var gQTBehaviorID = "qt_event_source"; +var gQTEventsEnabled = false; + +function AC_QuickTimeVersion() { return gQTGeneratorVersion; } + +function _QTComplain(callingFcnName, errMsg) +{ + errMsg = errMsg.replace("%%", callingFcnName); + alert(errMsg); +} + +function _QTIsMSIE() +{ + var ua = navigator.userAgent.toLowerCase(); + var msie = /msie/.test(ua) && !/opera/.test(ua); + + return msie; +} + + +function _QTGenerateBehavior() +{ + return objTag = ''; +} + +function _QTPageHasBehaviorObject(callingFcnName, args) +{ + var haveBehavior = false; + var objects = document.getElementsByTagName('object'); + + for ( var ndx = 0, obj; obj = objects[ndx]; ndx++ ) + { + if ( obj.getAttribute('classid') == "clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598" ) + { + if ( obj.getAttribute('id') == gQTBehaviorID ) + haveBehavior = false; + break; + } + } + + return haveBehavior; +} + + +function _QTShouldInsertBehavior() +{ + var shouldDo = false; + + if ( gQTEventsEnabled && _QTIsMSIE() && !_QTPageHasBehaviorObject() ) + shouldDo = true; + + return shouldDo; +} + + +function _QTAddAttribute(prefix, slotName, tagName) +{ + var value; + + value = gTagAttrs[prefix + slotName]; + if ( null == value ) + value = gTagAttrs[slotName]; + + if ( null != value ) + { + if ( 0 == slotName.indexOf(prefix) && (null == tagName) ) + tagName = slotName.substring(prefix.length); + if ( null == tagName ) + tagName = slotName; + return ' ' + tagName + '="' + value + '"'; + } + else + return ""; +} + +function _QTAddObjectAttr(slotName, tagName) +{ + // don't bother if it is only for the embed tag + if ( 0 == slotName.indexOf("emb#") ) + return ""; + + if ( 0 == slotName.indexOf("obj#") && (null == tagName) ) + tagName = slotName.substring(4); + + return _QTAddAttribute("obj#", slotName, tagName); +} + +function _QTAddEmbedAttr(slotName, tagName) +{ + // don't bother if it is only for the object tag + if ( 0 == slotName.indexOf("obj#") ) + return ""; + + if ( 0 == slotName.indexOf("emb#") && (null == tagName) ) + tagName = slotName.substring(4); + + return _QTAddAttribute("emb#", slotName, tagName); +} + + +function _QTAddObjectParam(slotName, generateXHTML) +{ + var paramValue; + var paramStr = ""; + var endTagChar = (generateXHTML) ? ' />' : '>'; + + if ( -1 == slotName.indexOf("emb#") ) + { + // look for the OBJECT-only param first. if there is none, look for a generic one + paramValue = gTagAttrs["obj#" + slotName]; + if ( null == paramValue ) + paramValue = gTagAttrs[slotName]; + + if ( 0 == slotName.indexOf("obj#") ) + slotName = slotName.substring(4); + + if ( null != paramValue ) + paramStr = '' + + _QTAddObjectParam("src", generateXHTML); + var embedTag = ''; +} + + +// return the object/embed as a string +function QT_GenerateOBJECTText() +{ + var txt = _QTGenerate("QT_GenerateOBJECTText", false, arguments); + if ( _QTShouldInsertBehavior() ) + txt = _QTGenerateBehavior() + txt; + return txt; +} + +function QT_GenerateOBJECTText_XHTML() +{ + var txt = _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments); + if ( _QTShouldInsertBehavior() ) + txt = _QTGenerateBehavior() + txt; + return txt; +} + +function QT_WriteOBJECT() +{ + var txt = _QTGenerate("QT_WriteOBJECT", false, arguments); + if ( _QTShouldInsertBehavior() ) + document.writeln(_QTGenerateBehavior()); + document.writeln(txt); +} + +function QT_WriteOBJECT_XHTML() +{ + var txt = _QTGenerate("QT_WriteOBJECT_XHTML", true, arguments); + if ( _QTShouldInsertBehavior() ) + document.writeln(_QTGenerateBehavior()); + document.writeln(txt); +} + +function QT_GenerateBehaviorOBJECT() +{ + return _QTGenerateBehavior(); +} + +function QT_ReplaceElementContents() +{ + var element = arguments[0]; + var args = []; + + // copy all other arguments we want to pass through to the fcn + for ( var ndx = 1; ndx < arguments.length; ndx++ ) + args.push(arguments[ndx]); + + var txt = _QTGenerate("QT_ReplaceElementContents", false, args); + if ( txt.length > 0 ) + element.innerHTML = txt; +} + + +function QT_ReplaceElementContents_XHTML() +{ + var element = arguments[0]; + var args = []; + + // copy all other arguments we want to pass through to the fcn + for ( var ndx = 1; ndx < arguments.length; ndx++ ) + args.push(arguments[ndx]); + + var txt = _QTGenerate("QT_ReplaceElementContents_XHTML", true, args); + if ( txt.length > 0 ) + element.innerHTML = txt; +} + diff --git a/plugins/Exiftool.inc b/plugins/Exiftool.inc new file mode 100644 index 00000000..7d27bc02 --- /dev/null +++ b/plugins/Exiftool.inc @@ -0,0 +1,24 @@ + '00:00:10', 's' => null); + $params = array_merge($defaults, $parameterArray); + $system = getenv('System'); + $file_suffix = '_'. $dsid . '.' . $file_ext; + $returnValue=TRUE; + $output=array(); + $size = ''; + + if($params['s'] != null) { + $size = ' -s ' . escapeshellarg($params['s']); + } + exec('ffmpeg -i ' . escapeshellarg($file) . ' -r 1 -ss ' . escapeshellarg($params['ss']) . ' ' . $size . ' -t 1 ' . escapeshellarg($file . $file_suffix)); + + if (!file_exists($file . $file_suffix)) { + return false; + } + + $_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix; + return TRUE; + } +} diff --git a/plugins/QtFormBuilder.php b/plugins/QtFormBuilder.php new file mode 100644 index 00000000..af66ed31 --- /dev/null +++ b/plugins/QtFormBuilder.php @@ -0,0 +1,102 @@ +getType($file); + //$fileUrl = 'http://'.$_SERVER['HTTP_HOST'].$file; + $fileUrl = $base_url.'/'.drupal_urlencode($file); + $beginIndex = strrpos($fileUrl,'/'); + $dtitle = substr($fileUrl,$beginIndex+1); + $dtitle = substr($dtitle, 0, strpos($dtitle, ".")); + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID","OBJ"); + $ds1->setAttribute("STATE","A"); + $ds1->setAttribute("CONTROL_GROUP","M"); + $ds1v= $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID","OBJ.0"); + $ds1v->setAttribute("MIMETYPE","$dformat"); + $ds1v->setAttribute("LABEL","$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF","$fileUrl"); + $ds1content->setAttribute("TYPE","URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + +if(empty($_SESSION['fedora_ingest_files']) || !isset($_SESSION['fedora_ingest_files']['TN'])) { + $createdFile = drupal_get_path('module', 'Fedora_Repository').'/images/qtThumb.jpg'; + $fileUrl = $base_url.'/'.drupal_urlencode($createdFile);//'http://'.$_SERVER['HTTP_HOST'].'/'.$createdFile; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID","TN"); + $ds1->setAttribute("STATE","A"); + $ds1->setAttribute("CONTROL_GROUP","M"); + $ds1v= $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID","TN.0"); + $ds1v->setAttribute("MIMETYPE","image/jpeg"); + $ds1v->setAttribute("LABEL","Thumbnail"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF","$fileUrl"); + $ds1content->setAttribute("TYPE","URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); +} + + if (!empty($_SESSION['fedora_ingest_files'])) { + + + + foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { + $createdFile = strstr($createdFile, $file); + $dformat = $mimetype->getType($createdFile); + $fileUrl = $base_url . '/'. drupal_urlencode($createdFile); + $beginIndex = strrpos($fileUrl, '/'); + $dtitle = substr($fileUrl, $beginIndex + 1); + $dtitle = urldecode($dtitle); + $dtitle = $dtitle; + $ds1 = $dom->createElement("foxml:datastream"); + $ds1->setAttribute("ID", "$dsid"); + $ds1->setAttribute("STATE", "A"); + $ds1->setAttribute("CONTROL_GROUP", "M"); + $ds1v= $dom->createElement("foxml:datastreamVersion"); + $ds1v->setAttribute("ID", "$dsid.0"); + $ds1v->setAttribute("MIMETYPE", "$dformat"); + $ds1v->setAttribute("LABEL", "$dtitle"); + $ds1content = $dom->createElement('foxml:contentLocation'); + $ds1content->setAttribute("REF", "$fileUrl"); + $ds1content->setAttribute("TYPE", "URL"); + $ds1->appendChild($ds1v); + $ds1v->appendChild($ds1content); + $rootElement->appendChild($ds1); + } + } + + + + } + + + + } +?> diff --git a/plugins/qt_viewer.inc b/plugins/qt_viewer.inc new file mode 100644 index 00000000..996b12b6 --- /dev/null +++ b/plugins/qt_viewer.inc @@ -0,0 +1,138 @@ +pid = $pid; + } + + function fedoraObject() { + return new fedora_item($this->pid); + } + + function technicalMetadata($defaults = array(), $dsid = 'OBJ_EXIFTOOL') { + $data = $defaults; + + try { + $src = ObjectHelper::getStream($this->pid, $dsid); + + $doc = new SimpleXMLElement($src); + $doc->registerXPathNamespace('File', 'http://ns.exiftool.ca/File/1.0/'); + $doc->registerXPathNamespace('Composite', 'http://ns.exiftool.ca/Composite/1.0/'); + $mime = reset($doc->xpath('//File:MIMEType')); + $data['mime'] = $mime; + if(strpos($mime, 'audio/') !== false) { + $data['width'] = 300; + $data['height'] = 0; + } else { + $size = reset($doc->xpath('//Composite:ImageSize/text()')); + list($width, $height) = explode('x', $size); + $data['width'] = $width; + $data['height'] = $height; + } + + $data['doc'] = $src; + } catch(Exception $e) { + $data = $defaults; + } + + return $data; + } + + function getPosterFrameDatastreamInfo($dsid = 'FULL_SIZE') { + $p = ObjectHelper::getDatastreamInfo($this->pid, $dsid); + if(empty($p) || $p == ' ' || $p === false) { + return false; + } + return $p; + } + + function getMediaDatastreamInfo($dsid = 'OBJ', $alt = array('')) { + $p = ObjectHelper::getDatastreamInfo($this->pid, $dsid); + if(empty($p) || $p == ' ' || $p === false) { + if(!empty($alt)) { + $ds = array_shift($alt); + return $this->getMediaDatastreamInfo($ds, $alt); + } + return false; + } + + return $p; + } + + function enableDownload() { + return false; + } + + function showQt() { + module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + + $info = $this->technicalMetadata(array('width' => 640, 'height' => 480)); + $width = $info['width']; + $height = $info['height']; + + $pframe = $this->getPosterFrameDatastreamInfo(); + $media = $this->getMediaDatastreamInfo('PROXY', array('OBJ')); + if($media === false ) { + return ''; + } + global $base_url; + $path = drupal_get_path('module', 'Fedora_Repository'); + $fullPath=base_path().$path; + $content= ''; + $pathTojs = drupal_get_path('module', 'Fedora_Repository').'/js/AC_Quicktime.js'; + drupal_add_js($pathTojs); + + $divid = 'player'.md5($this->pid).'MOV'; + $content .= '
'; + if($pframe !== false) { + $content .= '
'; + $content .= ''; + $content .= '
'; + $content .= '
'; + } + $content .= '
'; + if($this->enableDownload()) { + $url = base_path().'fedora/repository/'.$this->pid.'/OBJ/MOV.mov'; + $content .= 'Download Media File'; + } + $src = base_path().'fedora/repository/'.$this->pid.'/' . $media->ID. '/MOV.mov'; +$qtparams = ''; + $qtparams .= "'autostart', '" . ($pframe !== false ? 'true' : 'false') . "', "; + $init = << t('Quicktime'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + '#value' => $content); + return theme('fieldset',$collection_fieldset); + } +}