<commit_before>'use strict';

const CONFIG = require('./config');

const Configstore = require('configstore');
const async = require('async');
const google = require('googleapis');
const electron = require('electron');
const app = electron.app;


const YoutubeApi = require('./youtubeapi')(Configstore, async, google, CONFIG);
const Windows = require('./windows')(electron, CONFIG);
const server = require('./server');
const database = require('./database');

const isOnline = require('is-online');
const youtubeRegex = require('youtube-regex');

// adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')();

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
  Windows.openMainWindow();
  if (app.dock)
    app.dock.setIcon('YouWatch.png');

  server.io.on('connection', (socket) => {
    socket.on('internet/reconnect', launchApp);

    let subscriptions = [];
    let playlist = require('./playlist');

    let videoPlaying = null;
    launchApp();

    socket.on('youtube/auth', () => {
      socket.emit('youtube/waiting');

      YoutubeApi.getAuthUrl((url) => {
        socket.emit('youtube/waitingforuser');
        Windows.openLogInWindow(url);
      });
    });

    socket.on('subscriptions/list', () => {
      if (subscriptions.length)
        return socket.emit('subscriptions/list', subscriptions);
      
      YoutubeApi.getSubscriptions((err, _subscriptions) => {
        if (err) {
          console.error(err);
        } else {
          subscriptions = _subscriptions;<commit_msg>Fix OSX issue<commit_after>'use strict';

const CONFIG = require('./config');

const Configstore = require('configstore');
const async = require('async');
const google = require('googleapis');
const electron = require('electron');
const app = electron.app;


const YoutubeApi = require('./youtubeapi')(Configstore, async, google, CONFIG);
const Windows = require('./windows')(electron, CONFIG);
const server = require('./server');
const database = require('./database');

const isOnline = require('is-online');
const youtubeRegex = require('youtube-regex');

// adds debug features like hotkeys for triggering dev tools and reload
require('electron-debug')();

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
  Windows.openMainWindow();

  server.io.on('connection', (socket) => {
    socket.on('internet/reconnect', launchApp);

    let subscriptions = [];
    let playlist = require('./playlist');

    let videoPlaying = null;
    launchApp();

    socket.on('youtube/auth', () => {
      socket.emit('youtube/waiting');

      YoutubeApi.getAuthUrl((url) => {
        socket.emit('youtube/waitingforuser');
        Windows.openLogInWindow(url);
      });
    });

    socket.on('subscriptions/list', () => {
      if (subscriptions.length)
        return socket.emit('subscriptions/list', subscriptions);
      
      YoutubeApi.getSubscriptions((err, _subscriptions) => {
        if (err) {
          console.error(err);
        } else {
          subscriptions = _subscriptions;
{'fraction_non_alphanumeric': 0.15178032589016294, 'fraction_numerical': 0.0, 'mean_word_length': 3.6558988764044944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '700909', 'n_tokens_mistral': 932, 'n_tokens_neox': 882, 'n_words': 234}