Skip to content
Snippets Groups Projects
Commit ff8b88c2 authored by Tim Steiner's avatar Tim Steiner
Browse files

More podcast producer stuff.

parent 52a637da
Branches
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ class Unl_Plist
static public function arrayToPlist($array)
{
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$root = $dom->createElement('plist');
$root->setAttribute('version', '1.0');
$dom->appendChild($root);
......
......@@ -43,6 +43,17 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
return Unl_Service_PodcastProducer_Workflow::fromXML($response);
}
public function getWorkflow($uuid)
{
$selectedWorkflow = null;
foreach ($this->getWorkflows() as $workflow) {
if ($workflow->getUuid() == $uuid) {
$selectedWorkflow = $workflow;
}
}
return $selectedWorkflow;
}
public function getCameras()
{
$uri = clone $this->_uri;
......@@ -57,6 +68,17 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
return Unl_Service_PodcastProducer_Camera::fromXML($response);
}
public function getCamera($uuid)
{
$selectedCamera = null;
foreach ($this->getCameras() as $camera) {
if ($camera->getUuid() == $uuid) {
$selectedCamera = $camera;
}
}
return $selectedCamera;
}
public function getCameraPreview(Unl_Service_PodcastProducer_Camera $camera)
{
curl_setopt($this->_curl, CURLOPT_URL, $camera->getPreviewUrl());
......@@ -64,7 +86,7 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
return $response;
}
public function createForFile(Unl_Service_PodcastProducer_Workflow $workflow, $filePath)
public function createForFile(Unl_Service_PodcastProducer_Workflow $workflow, $filePath, $metadata = array())
{
$fileContents = file_get_contents($filePath);
$fileSize = strlen($fileContents);
......@@ -101,13 +123,16 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
echo $response . "\n\n\n";
$plist = Unl_Plist::arrayToPlist($metadata);
$plistLength = strlen($plist);
curl_setopt($this->_curl, CURLOPT_URL, $uploadUri);
curl_setopt($this->_curl, CURLOPT_HTTPHEADER, array(
'File-name: user_metadata.plist',
'Recording-UUID: ' . $recordingUUID
));
curl_setopt($this->_curl, CURLOPT_POST, true);
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, '');
curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $plist);
$response = curl_exec($this->_curl);
echo $response . "\n\n\n";
......@@ -118,7 +143,7 @@ class Unl_Service_PodcastProducer extends Zend_Service_Abstract
curl_setopt($this->_curl, CURLOPT_POST, true);
curl_setopt($this->_curl, CURLOPT_POSTFIELDS,
'submission_uuid=' . $UUID
. '&submitted_files=user_metadata.plist:0;' . $fileName . ':' . $fileSize
. '&submitted_files=user_metadata.plist:' . $plistLength . ';' . $fileName . ':' . $fileSize
. '&primary_content_file=' . $fileName
. '&recording_uuid=' . $recordingUUID
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment