Example #1
0
    /**
     * CONVERT VIDEOS TO FLV FORMAT
     * @param database A database connector object
     */
	function inject($path_flv) {

		defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
		defined('CONVERTPATH') ? null : define('CONVERTPATH', dirname(__FILE__));

		if(substr(PHP_OS, 0, 3) == "WIN") {

			defined('JPATH_SITE') ? null : define('JPATH_SITE', str_replace("\components\com_hwdvideoshare\converters", "", CONVERTPATH) );

		} else {

			defined('JPATH_SITE') ? null : define('JPATH_SITE', str_replace("/components/com_hwdvideoshare/converters", "", CONVERTPATH) );

		}

		// get hwdVideoShare general settings
		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'config.hwdvideoshare.php');
		$c = hwd_vs_Config::get_instance();

		// get hwdVideoShare server settings
		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php');
		$s = hwd_vs_SConfig::get_instance();

		$result = array();

		if(substr(PHP_OS, 0, 3) != "WIN") {
			$cmd_input = $s->flvtool2path.' -U '.$path_flv;
		} else {
			$cmd_input = $s->flvtool2path.' -U "'.$path_flv.'"';
		}

		@exec("$sharedlib $cmd_input 2>&1", $cmd_output);

		$result[0] = 0;              // result of flvtool2 execution
		$result[1] = null;           // ?
		$result[2] = $cmd_input;     // input of flvtool2 execution
		$result[3] = $cmd_output;    // output of flvtool2 execution
		$result[4] = '';             // holder for output text

		if(empty($cmd_output)) {

			$result[0] = 1;

		}

		$result = hwd_vs_InjectMetaData::generateOutput($result);
		return $result;

	}