Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fixing and new feature #64

Closed
wants to merge 10 commits into from
29 changes: 18 additions & 11 deletions Jarvis2_4windows.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import configparser # isort: skip
import os # isort: skip
import configparser
import os

import gui # isort: skip
import speech_recognition as sr # isort: skip
from actions import ( # isort: skip
import requests
import speech_recognition as sr

import gui
from actions import (
change_rate,
change_voice,
change_volume,
search_engine_selector,
set_gui_speak,
speak,
wish_me
wish_me,
)
from commands import ( # isort: skip
from commands import (
command_bye,
command_hello,
command_mail,
Expand All @@ -24,7 +26,7 @@
command_stop_music,
command_unpause_music,
command_whatsup,
command_wikipedia
command_wikipedia,
)

popular_websites = {
Expand Down Expand Up @@ -138,11 +140,16 @@ def take_command():
main(search_engine, take_command, debug)


if os.path.isfile('./config.ini'): # Checks if config.ini exists.
# Checks if config.ini exists and you have internet access.
status_code = requests.get("https://github.com", timeout=5).status_code
if os.path.isfile('./config.ini') and status_code == 200:
config = configparser.ConfigParser() # if exists loads library.
config.read('config.ini') # and also the file.
run() # Then it launches the main program
else:
# if it doesn't exist it drops an error message and exits.
print('You need a config.ini file.')
print('Check the documentation in the Github Repository.')
if os.path.isfile('./config.ini') is False:
print('You need a config.ini file.')
print('Check the documentation in the Github Repository.')
if status_code != 200:
print("I couldn't stablish an internet connection.")
Binary file modified __pycache__/actions.cpython-37.pyc
Binary file not shown.
Binary file modified __pycache__/commands.cpython-37.pyc
Binary file not shown.
Binary file modified __pycache__/gui.cpython-37.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def change_rate(query, take_command):
def change_voice(query, take_command):
try:
voice = query.split('to')[-1]
if voice == "male":
if voice == " male":
engine.setProperty('voice', voices[0].id)
speak("¿Do you want to keep this config?")
if take_command() == "yes":
Expand All @@ -103,7 +103,7 @@ def change_voice(query, take_command):
else:
pass

elif voice == "female":
elif voice == " female":
engine.setProperty('voice', voices[1].id)
speak("¿Do you want to keep this config?")
answer = take_command()
Expand Down