本文整理匯總了PHP中progress_bar::set_percent方法的典型用法代碼示例。如果您正苦於以下問題:PHP progress_bar::set_percent方法的具體用法?PHP progress_bar::set_percent怎麽用?PHP progress_bar::set_percent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類progress_bar
的用法示例。
在下文中一共展示了progress_bar::set_percent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: diarize
/**
* Segmente le document numérique et stocke le résultat en base de données
*/
public function diarize()
{
// On commence par supprimer
$query = "delete from explnum_segments where explnum_segment_explnum_num = " . $this->explnum->explnum_id;
mysql_query($query);
$query = "delete from explnum_speakers where explnum_speaker_explnum_num = " . $this->explnum->explnum_id;
mysql_query($query);
// Gestion de la progress_bar
$progress_bar = new progress_bar("upload to server");
$progress_bar->set_percent(0);
$this->speechFile = $this->diarization->sendFile($this->getFile());
// $this->speechFile = $this->diarization->getFile(67);
$status = $this->speechFile->getStatus();
while ($status != "diarization_phase7") {
if ($status == "uploaded") {
$progress_bar->set_percent(round(1 / 8 * 100));
} else {
$nb = str_replace("diarization_phase", "", $status);
$progress_bar->set_percent(round(($nb + 1) / 8 * 100));
}
$progress_bar->set_text($status);
$status = $this->speechFile->getStatus();
sleep(0.5);
}
sleep(10);
$progress_bar->hide();
$speakers = $this->speechFile->getSpeakers();
$speakers_ids = array();
// Tableau associant l'identifiant du speaker avec son identifiant dans la table
foreach ($speakers as $speaker) {
$query = "insert into explnum_speakers (explnum_speaker_explnum_num, explnum_speaker_speaker_num, explnum_speaker_gender) values (" . $this->explnum->explnum_id . ", '" . $speaker->getID() . "', '" . $speaker->getGender() . "')";
mysql_query($query);
$speakers_ids[$speaker->getID()] = mysql_insert_id();
}
$segments = $this->speechFile->getSegments();
foreach ($segments as $segment) {
$query = "insert into explnum_segments (explnum_segment_explnum_num, explnum_segment_speaker_num, explnum_segment_start, explnum_segment_duration, explnum_segment_end) values (" . $this->explnum->explnum_id . ", '" . $speakers_ids[$segment->getSpeaker()->getID()] . "', " . $segment->getStart() . ", " . $segment->getDuration() . ", " . $segment->getEnd() . ")";
mysql_query($query);
}
}