<commit_before><?php
/**
 * @module Q
 */
/**
 * @class Q_Muse
 */
class Q_Video_Muse {
	/**
	 * Upload file to muse.ai
	 * @method upload
	 * @static
	 * @param {string} $filePath
	 * @return {array}
	 */
	static function upload($filePath)
	{
		$uploadEndPoint = Q_Config::get("Q", "video", "muse", "uploadEndPoint", null);
		$museApiKey = Q_Config::get("Q", "video", "muse", "key", null);
		if (!$museApiKey) {
			throw new Exception("Muse API key not found");
		}
		if (!$uploadEndPoint) {
			throw new Exception("Muse end point url not found");
		}

		$fileName = basename($filePath);
		$mimeType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $filePath);
		$cFile = curl_file_create($filePath, $mimeType, $fileName);
		$headers = array(
			"Content-type: multipart/form-data",
			"Key: $museApiKey"
		);
		$fields = array(
			"file" => $cFile,
			"visibility" => "unlisted"
		);

		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $uploadEndPoint);
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($ch, CURLOPT_POST,1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		$result = Q::json_decode(curl_exec($ch), true);
		curl_close($ch);

		if ($error = Q::ifset($result, "error", null)) {
			throw new Exception($error);
		}

		$result["videoId"] = $result["svid"];

		return $result;
	}
};<commit_msg>Updated Q_Video_Muse class. Use "videoUrl" instead "mp4" and fixed this url generation.<commit_after><?php
/**
 * @module Q
 */
/**
 * @class Q_Muse
 */
class Q_Video_Muse {
	/**
	 * Upload file to muse.ai
	 * @method upload
	 * @static
	 * @param {string} $filePath
	 * @return {array}
	 */
	static function upload($filePath)
	{
		$uploadEndPoint = Q_Config::get("Q", "video", "muse", "uploadEndPoint", null);
		$museApiKey = Q_Config::get("Q", "video", "muse", "key", null);
		if (!$museApiKey) {
			throw new Exception("Muse API key not found");
		}
		if (!$uploadEndPoint) {
			throw new Exception("Muse end point url not found");
		}

		$fileName = basename($filePath);
		$mimeType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $filePath);
		$cFile = curl_file_create($filePath, $mimeType, $fileName);
		$headers = array(
			"Content-type: multipart/form-data",
			"Key: $museApiKey"
		);
		$fields = array(
			"file" => $cFile,
			"visibility" => "unlisted"
		);

		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $uploadEndPoint);
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($ch, CURLOPT_POST,1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		$result = Q::json_decode(curl_exec($ch), true);
		curl_close($ch);

		if ($error = Q::ifset($result, "error", null)) {
			throw new Exception($error);
		}

		$result["videoId"] = $result["svid"];
		$result["videoUrl"] = Q::ifset($result, "mp4", preg_replace("/\/data$/", "/videos/video.mp4", $result["url"]));

		return $result;
	}
};
{'fraction_non_alphanumeric': 0.1813358302122347, 'fraction_numerical': 0.004057428214731586, 'mean_word_length': 4.743727598566308, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7568413', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1215, 'n_words': 247}