
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()


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
    print("Starting PulseAudio")
    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()

Add a print when running pulseaudio
Add a print when running pulseaudio

  
  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
+     print("Starting PulseAudio")
      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()
  
Add a print when running pulseaudio
## Code Before:

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()

## Instruction:
Add a print when running pulseaudio
## Code After:

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
    print("Starting PulseAudio")
    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()
