<commit_before>'use strict';

function get(metric, metricName, pos) {
  return `drawtext=enable='between(t,${Number(metric) /
    1000},30)':x=(w-tw)/2: y=H-${pos}:fontcolor=white:fontsize=26:box=1:boxcolor=0x000000AA:text='${metricName} ${metric}'`;
}

module.exports = function addTimingMetrics(metrics, options) {
  let extras = '';
  const vm = metrics.visualMetrics;
  // we only add if we collect VisualMetrics
  // but soon we can add things like
  // const pt = metrics.browserScripts.timings.pageTimings;
  if (options.visualMetrics) {
    const speedIndex = get(vm.SpeedIndex, 'SpeedIndex', 124);
    const firstVisualChange = get(
      vm.FirstVisualChange,
      'FirstVisualChange',
      180
    );
    const visualComplete85 = get(vm.VisualComplete85, 'VisualComplete85', 152);
    const lastVisualChange = get(vm.LastVisualChange, 'LastVisualChange', 96);
    extras += `,${speedIndex}, ${lastVisualChange}, ${visualComplete85}, ${firstVisualChange}`;
  }
  return extras;
};<commit_msg>simplify position of timing metrics in the video<commit_after>'use strict';

function get(metric, metricName, pos) {
  return `drawtext=enable='between(t,${Number(metric) /
    1000},30)':x=(w-tw)/2: y=H-${pos}:fontcolor=white:fontsize=26:box=1:boxcolor=0x000000AA:text='${metricName} ${metric}'`;
}

module.exports = function addTimingMetrics(metrics, options) {
  let extras = '';
  const vm = metrics.visualMetrics;
  const position = 180;
  const gap = 28;
  // we only add if we collect VisualMetrics
  // but soon we can add things like
  // const pt = metrics.browserScripts.timings.pageTimings;
  if (options.visualMetrics) {
    const firstVisualChange = get(
      vm.FirstVisualChange,
      'FirstVisualChange',
      position
    );
    const visualComplete85 = get(
      vm.VisualComplete85,
      'VisualComplete85',
      position - gap
    );
    const speedIndex = get(vm.SpeedIndex, 'SpeedIndex', position - gap * 2);
    const lastVisualChange = get(
      vm.LastVisualChange,
      'LastVisualChange',
      position - gap * 3
    );
    extras += `,${speedIndex}, ${lastVisualChange}, ${visualComplete85}, ${firstVisualChange}`;
  }
  return extras;
};
{'fraction_non_alphanumeric': 0.13990825688073394, 'fraction_numerical': 0.031192660550458717, 'mean_word_length': 4.107728337236534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7655377', 'n_tokens_mistral': 731, 'n_tokens_neox': 676, 'n_words': 154}