<commit_before>var express = require('express');
var path = require('path');
var bodyParser = require('body-parser')
var fs = require('fs');
var cp = require('child_process');
var irc = require('irc');
var app = express();

app.use(bodyParser.urlencoded({ extended: false }));

var ircclient = new irc.Client('irc.freenode.net', 'XiphAWCY', {
    channels: ['#daala'],
});
ircclient.addListener('error', function(message) {
    console.log('error: ', message);
});

var job;
var job_queue = [];
var job_in_progress = false;

var key = fs.readFileSync('secret_key', {encoding: 'utf8'}).trim();

function check_key(req,res,next) {
  if (key != req.body.key) {
    console.log(req.body.key.trim());
    console.log(key);
    res.status(403).send('Key verification failed.\n');
    return;
  }
  next();
};

function process_queue() {
  cp.exec('node generate_list.js');
  if (job_in_progress) { return; };
  if (job_queue.length > 0) {
    job_in_progress = true;
    job = job_queue.pop();
    console.log('Starting job '+job.run_id);
    ircclient.say('#daala','AWCY: Starting '+job.run_id);
    cp.execFile('./run_video_test.sh',[job.commit,job.run_id,job.task],
    { env: { 'PYTHONIOENCODING': 'utf-8' } }, function(error,stdout,stderr) {
      if (error == null) {
        console.log('video test succeeded');
        ircclient.say('#daala','AWCY: Finished '+job.run_id);
      } else {
        console.log(stdout);
        console.log(stderr);
        ircclient.say('#daala','AWCY: Exploded '+job.run_id+
          ' see https://arewecompressedyet.com/error.txt');
        fs.writeFile('error.txt',stdout+stderr);
      }
      job_in_progress = false;
      job = null;
      process_queue();
    });
  }
};

app.use(express.static(__dirname + '/www'));
app.use('/runs',express.static(__dirname + '/runs'));
app.use('/sets.json',express.static(__dirname + '/rd_tool/sets.json'));
app.use('/error.txt',express.static(__dirname + '/error.txt'));
app.use('/list.json',express.static(__dirname + '/list.json'));

app.get('/run_list.json',function(req,res) {<commit_msg>Use irc nick field<commit_after>var express = require('express');
var path = require('path');
var bodyParser = require('body-parser')
var fs = require('fs');
var cp = require('child_process');
var irc = require('irc');
var app = express();

app.use(bodyParser.urlencoded({ extended: false }));

var ircclient = new irc.Client('irc.freenode.net', 'XiphAWCY', {
    channels: ['#daala'],
});
ircclient.addListener('error', function(message) {
    console.log('error: ', message);
});

var job;
var job_queue = [];
var job_in_progress = false;

var key = fs.readFileSync('secret_key', {encoding: 'utf8'}).trim();

function check_key(req,res,next) {
  if (key != req.body.key) {
    console.log(req.body.key.trim());
    console.log(key);
    res.status(403).send('Key verification failed.\n');
    return;
  }
  next();
};

function process_queue() {
  cp.exec('node generate_list.js');
  if (job_in_progress) { return; };
  if (job_queue.length > 0) {
    job_in_progress = true;
    job = job_queue.pop();
    console.log('Starting job '+job.run_id);
    ircclient.say('#daala',job.nick+': Starting '+job.run_id);
    cp.execFile('./run_video_test.sh',[job.commit,job.run_id,job.task],
    { env: { 'PYTHONIOENCODING': 'utf-8' } }, function(error,stdout,stderr) {
      if (error == null) {
        console.log('video test succeeded');
        ircclient.say('#daala',job.nick+': Finished '+job.run_id);
      } else {
        console.log(stdout);
        console.log(stderr);
        ircclient.say('#daala',job.nick+': Exploded '+job.run_id+
          ' see https://arewecompressedyet.com/error.txt');
        fs.writeFile('error.txt',stdout+stderr);
      }
      job_in_progress = false;
      job = null;
      process_queue();
    });
  }
};

app.use(express.static(__dirname + '/www'));
app.use('/runs',express.static(__dirname + '/runs'));
app.use('/sets.json',express.static(__dirname + '/rd_tool/sets.json'));
app.use('/error.txt',express.static(__dirname + '/error.txt'));
app.use('/list.json',express.static(__dirname + '/list.json'));

app.get('/run_list.json',function(req,res) {
{'fraction_non_alphanumeric': 0.1985576923076923, 'fraction_numerical': 0.0028846153846153848, 'mean_word_length': 3.947681331747919, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5849856', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1425, 'n_words': 239}