function _jobParameters($type) { $uc_type = ucwords($type) . 'r'; $type_length = strlen($uc_type); $file = MovieMasher::fromConfig($this->getOption('PathConfiguration'), 'File'); $a = array(); foreach ($this->_options as $k => $v) { if (strlen($k) > 5 && substr($k, 0, 5) == 'Coder' || substr($k, 0, $type_length) == $uc_type) { $a[$k] = $this->getOption($k); } } if ($this->getOption('Verbose')) { $a['Verbose'] = '1'; } return $a; }
The script attempts to check on the progress of the job and either: * redirects client back to itself, if job is still processing, by setting 'url' attribute * directs client to refresh browser view if job is finished * displays javascript alert if error is encountered, by setting 'get' attribute If possible, the response to client is logged. */ $err = ''; // load MovieMasher if (!$err && !@(include_once 'MovieMasher/MovieMasher.php')) { $err = 'Problem loading MovieMasher.php'; } // load objects from configuration if (!$err) { try { $moviemasher_client =& MovieMasher::fromConfig('MovieMasher.xml', 'Client'); $moviemasher_file =& MovieMasher::fromConfig('MovieMasher.xml', 'File'); } catch (Exception $ex) { $err = xml_safe($ex->getMessage()); } } // load utilities if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) { $err = 'Problem loading utility script'; } // see if the user is autheticated (will NOT exit) if (!$err && !authenticated()) { $err = 'Unauthenticated access'; } // check to make sure required parameters have been sent if (!$err) { $job = empty($_REQUEST['job']) ? '' : $_REQUEST['job'];
/* This script is called directly from the web browser. The HTML page is returned, as long as the user can be authenticated via HTTP. This document includes styles needed for a full window, liquid interface layout. The Movie Masher applet is embedded using the swfObject JavaScript library. */ $err = ''; // load MovieMasher if (!$err && !@(include_once 'MovieMasher/MovieMasher.php')) { $err = 'Problem loading MovieMasher.php'; } // load objects from configuration if (!$err) { try { $moviemasher =& MovieMasher::fromConfig('MovieMasher.xml', 'Client'); } catch (Exception $ex) { $err = xml_safe($ex->getMessage()); } } // load utilities if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) { $err = 'Problem loading utility script'; } // autheticate the user (will exit is not possible) if (!$err && !authenticated()) { authenticate(); } // if error encountered output it and exit, otherwise content below will output if ($err) { print $err;
/* This script receives the decoded mash from Movie Masher Server as a video file in $_FILES. If the file is okay, it's moved to the directory named $id in the server/media/upload directory. If an error is encountered a 400 header is returned and it is logged, if possible. */ $err = ''; // load MovieMasher if (!$err && !@(include_once 'MovieMasher/MovieMasher.php')) { $err = 'Problem loading MovieMasher script'; } // load objects from configuration if (!$err) { try { $moviemasher_client =& MovieMasher::fromConfig('MovieMasher.xml', 'Client'); $moviemasher_file =& MovieMasher::fromConfig('MovieMasher.xml', 'File'); $moviemasher_coder =& MovieMasher::fromConfig('MovieMasher.xml', 'Coder', 'Encoder'); } catch (Exception $ex) { $err = xml_safe($ex->getMessage()); } } // load utilities if (!$err && !@(include_once 'MovieMasher/lib/authutils.php')) { $err = 'Problem loading utility script'; } // see if the user is autheticated (will NOT exit) if (!$err && !authenticated()) { $err = 'Unauthenticated access'; } // check to make sure required parameters have been sent if (!$err) { $id = empty($_REQUEST['id']) ? '' : $_REQUEST['id'];
function &_encoder() { if (!isset($this->__encoder)) { $path_configuration = $this->getOption('PathConfiguration'); if (!$path_configuration) { throw new UnexpectedValueException('Configuration option PathConfiguration required'); } $this->__encoder =& MovieMasher::fromConfig($path_configuration, 'Coder', 'Encoder'); } return $this->__encoder; }
function __storeFile($comp_file) { if (!file_exists($comp_file)) { throw new RuntimeException('No file was coded'); } if (!is_dir($comp_file) && !($file_size = filesize($comp_file))) { throw new RuntimeException('Coded file was empty'); } $coder_file_url = $this->_options['CoderFileURL']; if ($coder_file_url) { $url = parse_url($coder_file_url); if ($url) { $scheme = empty($url['scheme']) ? 'System' : $url['scheme']; $options = array(); $options['url'] = $comp_file; $options['path'] = substr($coder_file_url, strlen($scheme) + 2); $options['delete'] = $this->_options['CoderFileDelete']; $file = ''; switch ($scheme) { case 'http': case 'https': $file = 'HTTP'; break; default: $file = ucwords($scheme); } if ($file) { $path_configuration = $this->_options['PathConfiguration']; if (!$path_configuration) { throw new UnexpectedValueException('Configuration option PathConfiguration required'); } $file = MovieMasher::fromConfig($path_configuration, 'File', $file, $this->_options); $this->_progressStep('StoreFile', 10, "Storing File"); $options['ignore'] = $this->_ignore; try { $file->put($options); } catch (Exception $ex) { if (empty($this->_options['CoderIgnoreFileError'])) { throw new RuntimeException('Problem transfering file to: ' . $coder_file_url); } } $this->_progressStep('StoreFile', 100, 'Stored File'); } } else { throw new RuntimeException('Could not parse URL: ' . $coder_file_url); } } else { $this->_progressStep('StoreFile', 100, "Saved to {$comp_file}"); } }