<commit_before><?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
require_once dirname(__FILE__) . '/../videos/configuration.php';
require_once '../objects/Encoder.php';

$config = new Configuration();

//$r = Encoder::sendFile("{$global['systemRootPath']}videos/1_tmpFile.mp4", 1, "mp4");var_dump($r);return;
$obj = new stdClass();
$obj->queue_size = 0;
$obj->is_encoding = false;
$obj->queue_list = array();
$obj->msg = "";
$obj->encoding = new stdClass();
$obj->cmd = "";
$obj->encoding_status = array();
$obj->version = $config->getVersion();

$obj->encoding = Encoder::areEncoding();
//$obj->transferring = Encoder::isTransferring();
$obj->queue_list = Encoder::getAllQueue();
$obj->queue_size = count($obj->queue_list);

if(count($obj->encoding) == 0) {
    if(empty($obj->queue_list)){
        $obj->msg = "There is no file on queue";
    }else{
        execRun();
        $obj->msg = "We send the file to encode";
    }
}else{
    $obj->is_encoding = true;
    $msg = (count($obj->encoding) == 1) ? "The file " : "The files ";
    for ($i = 0; $i < count($obj->encoding); $i++) {
        $obj->encoding_status[$i] = Encoder::getVideoConversionStatus($obj->encoding[$i]['id']);
        $obj->download_status[$i] = Encoder::getYoutubeDlProgress($obj->encoding[$i]['id']);
        $msg .= "[{$obj->encoding[$i]['id']}] {$obj->encoding[$i]['filename']}";
        if (count($obj->encoding) > 1 && $i < count($obj->encoding) - 1)
            $msg .= ", ";
    }
    $msg .= (count($obj->encoding) == 1) ? " is encoding" : " are encoding";
    $obj->msg = $msg;
}

if(!empty($_GET['serverStatus'])){
    require_once '../objects/ServerMonitor.php';
    require_once '../objects/functions.php';<commit_msg>Report how many concurent job the encoder can do<commit_after><?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
require_once dirname(__FILE__) . '/../videos/configuration.php';
require_once '../objects/Encoder.php';

$config = new Configuration();

//$r = Encoder::sendFile("{$global['systemRootPath']}videos/1_tmpFile.mp4", 1, "mp4");var_dump($r);return;
$obj = new stdClass();
$obj->queue_size = 0;
$obj->concurrent = 1;
$obj->is_encoding = false;
$obj->queue_list = array();
$obj->msg = "";
$obj->encoding = new stdClass();
$obj->cmd = "";
$obj->encoding_status = array();
$obj->version = $config->getVersion();

if (!empty($global['concurrent']))
    $obj->concurrent = $global['concurrent'];

$obj->encoding = Encoder::areEncoding();
//$obj->transferring = Encoder::isTransferring();
$obj->queue_list = Encoder::getAllQueue();
$obj->queue_size = count($obj->queue_list);

if(count($obj->encoding) == 0) {
    if(empty($obj->queue_list)){
        $obj->msg = "There is no file on queue";
    }else{
        execRun();
        $obj->msg = "We send the file to encode";
    }
}else{
    $obj->is_encoding = true;
    $msg = (count($obj->encoding) == 1) ? "The file " : "The files ";
    for ($i = 0; $i < count($obj->encoding); $i++) {
        $obj->encoding_status[$i] = Encoder::getVideoConversionStatus($obj->encoding[$i]['id']);
        $obj->download_status[$i] = Encoder::getYoutubeDlProgress($obj->encoding[$i]['id']);
        $msg .= "[{$obj->encoding[$i]['id']}] {$obj->encoding[$i]['filename']}";
        if (count($obj->encoding) > 1 && $i < count($obj->encoding) - 1)
            $msg .= ", ";
    }
    $msg .= (count($obj->encoding) == 1) ? " is encoding" : " are encoding";
    $obj->msg = $msg;
}

if(!empty($_GET['serverStatus'])){
    require_once '../objects/ServerMonitor.php';
    require_once '../objects/functions.php';
{'fraction_non_alphanumeric': 0.23339763020115734, 'fraction_numerical': 0.006337834114081014, 'mean_word_length': 4.127118644067797, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6838314', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1210, 'n_words': 223}