コード例 #1
0
ファイル: maintenance.php プロジェクト: rkern21/videoeditor
   /**
	* system cleanup
	*/
	function ajax_WarpHdSync()
	{
		global $smartyvs;
		$db = & JFactory::getDBO();
		$c = hwd_vs_Config::get_instance();

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'warp'.DS.'infin-lib.php');
		$accountKey = $c->warpAccountKey;
		$secretKey = $c->warpSecretKey;

		$query = 'SELECT * FROM #__hwdvidsvideos WHERE video_type = "warphd"';
		$db->SetQuery($query);
		$rows = $db->loadObjectList();

		for ($i=0, $n=count($rows); $i < $n; $i++)
		{
			$row = $rows[$i];

			$infinVideo = new InfinovationVideo($accountKey, $secretKey);
			$videoInfo = $infinVideo->getVideoInfo($row->video_id);

			$duration = hwd_vs_tools::sec2hms($videoInfo->duration);

			$db->SetQuery("UPDATE #__hwdvidsvideos SET video_length = \"$duration\" WHERE id = $row->id");
			if ( !$db->query() )
			{
				echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
				exit();
			}
		}

		echo "Synchronised ".count($rows)." WarpHD videos";
		exit;
	}