<commit_before>#!/usr/bin/env python3

import bot as chat_bot
from intercom import Intercom
import logging
from facerecognition import FaceRecognition
import nodered
import subprocess 

icom = Intercom()
facerec = FaceRecognition()
doorBellServer = nodered.NodeRedDoorbellServerThread(icom)
doorBellServer.start()

subprocess.call(["pulseaudio", "-D"])

def onBellPressed():
    if chat_bot.chat_id is None:
        logging.warning('Bell is pressed but we have no user in the chat')
    chat_bot.verify_image(chat_bot.updater, icom.takePicture())

def onTakeSnap():
    pic = icom.takePicture()
    chat_bot.uploadSnap(chat_bot.updater, pic)

icom.registerOnBellPressedCallback(onBellPressed)
chat_bot.registerOnSnapButtonCallback(onTakeSnap)

chat_bot.run_bot()<commit_msg>Only start pulseaudio on linux<commit_after>#!/usr/bin/env python3

import bot as chat_bot
from intercom import Intercom
import logging
from facerecognition import FaceRecognition
import nodered
import subprocess 
from sys import platform

icom = Intercom()
facerec = FaceRecognition()
doorBellServer = nodered.NodeRedDoorbellServerThread(icom)
doorBellServer.start()

if platform == "linux" or platform == "linux2":
    # linux
    subprocess.call(["pulseaudio", "-D"])

def onBellPressed():
    if chat_bot.chat_id is None:
        logging.warning('Bell is pressed but we have no user in the chat')
    chat_bot.verify_image(chat_bot.updater, icom.takePicture())

def onTakeSnap():
    pic = icom.takePicture()
    chat_bot.uploadSnap(chat_bot.updater, pic)

icom.registerOnBellPressedCallback(onBellPressed)
chat_bot.registerOnSnapButtonCallback(onTakeSnap)

chat_bot.run_bot()
{'fraction_non_alphanumeric': 0.09189842805320435, 'fraction_numerical': 0.0018137847642079807, 'mean_word_length': 5.700404858299595, 'pattern_counts': {'":': 1, '<': 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': '184520', 'n_tokens_mistral': 566, 'n_tokens_neox': 536, 'n_words': 128}