<commit_before>const { remote } = require('electron');
const path       = require('path');
const Config     = require('electron-config');

const DEFAULT_BASE_DESTINATION = path.join(remote.app.getPath('videos'), 'YouTube');

const KEYS = {
  BASE_DESTINATION: 'base_destination',
  PROXY: 'proxy',
  DOWNLOADS: 'downloads',
};

let config;
export var init = function () {
  config = new Config();

  if (! config.has(KEYS.BASE_DESTINATION)) {
    config.set(KEYS.BASE_DESTINATION, DEFAULT_BASE_DESTINATION);
  }

  if (! config.has(KEYS.DOWNLOADS)) {
    config.set(KEYS.DOWNLOADS, {});
  }
};

export var clear = function () {
  config.clear();
}

export var save = function (key, value) {
  config.set(key, value);
};

export var get = function (key) {
  config.get(key);
};

// base dest setting
export var getBaseDestination = function () {
  return config.get(KEYS.BASE_DESTINATION);
}

export var setBaseDestination = function (baseDestination) {
  config.set(KEYS.BASE_DESTINATION, baseDestination);
}

// proxy setting
export var getProxy = function () {
  return config.get(KEYS.PROXY);
}

export var setProxy = function (proxy) {
  config.set(KEYS.PROXY, proxy);
}

// Downloads
export var getDownloads = function () {
  return config.get(KEYS.DOWNLOADS);
}

export var hasVideoInDownloads = function (id) {
  return Object.keys(getDownloads()).indexOf(id) > -1;
}

export var addVideoInDownloads = function (id, info) {
  const downloads = config.get(KEYS.DOWNLOADS);
  if (hasVideoInDownloads(id)) {<commit_msg>Use internal Config method to check if has video<commit_after>const { remote } = require('electron');
const path       = require('path');
const Config     = require('electron-config');

const DEFAULT_BASE_DESTINATION = path.join(remote.app.getPath('videos'), 'YouTube');

const KEYS = {
  BASE_DESTINATION: 'base_destination',
  PROXY: 'proxy',
  DOWNLOADS: 'downloads',
};

let config;
export var init = function () {
  config = new Config();

  if (! config.has(KEYS.BASE_DESTINATION)) {
    config.set(KEYS.BASE_DESTINATION, DEFAULT_BASE_DESTINATION);
  }

  if (! config.has(KEYS.DOWNLOADS)) {
    config.set(KEYS.DOWNLOADS, {});
  }
};

export var clear = function () {
  config.clear();
}

export var save = function (key, value) {
  config.set(key, value);
};

export var get = function (key) {
  config.get(key);
};

// base dest setting
export var getBaseDestination = function () {
  return config.get(KEYS.BASE_DESTINATION);
}

export var setBaseDestination = function (baseDestination) {
  config.set(KEYS.BASE_DESTINATION, baseDestination);
}

// proxy setting
export var getProxy = function () {
  return config.get(KEYS.PROXY);
}

export var setProxy = function (proxy) {
  config.set(KEYS.PROXY, proxy);
}

// Downloads
export var getDownloads = function () {
  return config.get(KEYS.DOWNLOADS);
}

export var hasVideoInDownloads = function (id) {
  return config.has(KEYS.DOWNLOADS + '.' + id);
}

export var addVideoInDownloads = function (id, info) {
  const downloads = config.get(KEYS.DOWNLOADS);
  if (hasVideoInDownloads(id)) {
{'fraction_non_alphanumeric': 0.14150943396226415, 'fraction_numerical': 0.00032530904359141186, 'mean_word_length': 4.404217926186292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1321745', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1050, 'n_words': 234}