<commit_before>var electron = require('electron')
var debug = require('debug')('webtorrent-app:ipcMain')
var ipcMain = electron.ipcMain
var windows = require('./windows')

module.exports = {
  init: init
}

function init () {
  ipcMain.on('addTorrentFromPaste', function (e) {
    addTorrentFromPaste()
  })

  ipcMain.on('setBounds', function (e, bounds) {
    setBounds(bounds)
  })

  ipcMain.on('setAspectRatio', function (e, aspectRatio, extraSize) {
    setAspectRatio(aspectRatio, extraSize)
  })

  ipcMain.on('setBadge', function (e, text) {
    setBadge(text)
  })

  ipcMain.on('setProgress', function (e, progress) {
    setProgress(progress)
  })
}

function addTorrentFromPaste () {
  debug('addTorrentFromPaste')
  var torrentIds = electron.clipboard.readText().split('\n')
  torrentIds.forEach(function (torrentId) {
    torrentId = torrentId.trim()
    if (torrentId.length === 0) return
    windows.mainWindow.send('addTorrent', torrentId)
  })
}

function setBounds (bounds) {
  debug('setBounds %o', bounds)
  if (windows.mainWindow) {
    windows.mainWindow.setBounds(bounds, true)
  }
}

function setAspectRatio (aspectRatio, extraSize) {
  debug('setAspectRatio %o %o', aspectRatio, extraSize)
  if (windows.mainWindow) {
    windows.mainWindow.setAspectRatio(aspectRatio, extraSize)
  }
}

// Display string in dock badging area (OS X)
function setBadge (text) {
  debug('setBadge %s', text)
  electron.app.dock.setBadge(String(text))
}

// Show progress bar. Valid range is [0, 1]. Remove when < 0; indeterminate when > 1.
function setProgress (progress) {
  debug('setProgress %s', progress)
  if (windows.mainWindow) {
    windows.mainWindow.setProgressBar(progress)
  }
}<commit_msg>Fix IPC calls after PR #4<commit_after>var electron = require('electron')
var debug = require('debug')('webtorrent-app:ipcMain')
var ipcMain = electron.ipcMain
var windows = require('./windows')

module.exports = {
  init: init
}

function init () {
  ipcMain.on('addTorrentFromPaste', function (e) {
    addTorrentFromPaste()
  })

  ipcMain.on('setBounds', function (e, bounds) {
    setBounds(bounds)
  })

  ipcMain.on('setAspectRatio', function (e, aspectRatio, extraSize) {
    setAspectRatio(aspectRatio, extraSize)
  })

  ipcMain.on('setBadge', function (e, text) {
    setBadge(text)
  })

  ipcMain.on('setProgress', function (e, progress) {
    setProgress(progress)
  })
}

function addTorrentFromPaste () {
  debug('addTorrentFromPaste')
  var torrentIds = electron.clipboard.readText().split('\n')
  torrentIds.forEach(function (torrentId) {
    torrentId = torrentId.trim()
    if (torrentId.length === 0) return
    windows.main.send('addTorrent', torrentId)
  })
}

function setBounds (bounds) {
  debug('setBounds %o', bounds)
  if (windows.main) {
    windows.main.setBounds(bounds, true)
  }
}

function setAspectRatio (aspectRatio, extraSize) {
  debug('setAspectRatio %o %o', aspectRatio, extraSize)
  if (windows.main) {
    windows.main.setAspectRatio(aspectRatio, extraSize)
  }
}

// Display string in dock badging area (OS X)
function setBadge (text) {
  debug('setBadge %s', text)
  electron.app.dock.setBadge(String(text))
}

// Show progress bar. Valid range is [0, 1]. Remove when < 0; indeterminate when > 1.
function setProgress (progress) {
  debug('setProgress %s', progress)
  if (windows.main) {
    windows.main.setProgressBar(progress)
  }
}
{'fraction_non_alphanumeric': 0.14180424528301888, 'fraction_numerical': 0.003242924528301887, 'mean_word_length': 4.420127795527157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4755062', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1159, 'n_words': 245}