Fixed bug when jarvis wouldn't start outside pycharm

This commit is contained in:
Mathieu 2021-08-22 18:44:32 +02:00
parent 60f558c9dd
commit b0c515761c
6 changed files with 24 additions and 7 deletions

2
.gitignore vendored
View File

@ -11,7 +11,7 @@ __pycache__/
*.so *.so
intent_cache/* intent_cache/*
**/intent_cache/** intent_cache/**
# Distribution / packaging # Distribution / packaging

View File

@ -0,0 +1,3 @@
import sys
sys.path.append('../')

View File

@ -10,7 +10,8 @@ from jarvis.skills.productivity.speedtest import SpeedTestSkill
from jarvis.skills.research.wikipedia import WikipediaSkill from jarvis.skills.research.wikipedia import WikipediaSkill
from jarvis.utils import languages_utils, flask_utils from jarvis.utils import languages_utils, flask_utils
if __name__ == '__main__':
def start():
# Load lingua franca in the memory # Load lingua franca in the memory
# Supported : English French German Hungarian Italian Portuguese Swedish # Supported : English French German Hungarian Italian Portuguese Swedish
lingua_franca.load_language(lang=languages_utils.get_language_only_country()) lingua_franca.load_language(lang=languages_utils.get_language_only_country())

View File

@ -4,9 +4,9 @@ import random
import threading import threading
import types import types
from jarvis import get_path_file from .. import get_path_file
from jarvis.skills import intent_manager from ..skills import intent_manager
from jarvis.utils import languages_utils, client_utils from ..utils import languages_utils, client_utils
class Skill: class Skill:

View File

@ -15,7 +15,9 @@ class SpotifySkill(Skill, metaclass=SkillRegistering):
data['artist'] if 'artist' in data else None) data['artist'] if 'artist' in data else None)
if song_lists_matching is not None and len(song_lists_matching) >= 1: if song_lists_matching is not None and len(song_lists_matching) >= 1:
# pause the music then speak dialog
# pause the music before speaking dialog
if spotify.is_music_playing():
spotify.get_spotify().pause_playback() spotify.get_spotify().pause_playback()
if 'artist' in data and 'song' not in data: if 'artist' in data and 'song' not in data:

11
run.py Normal file
View File

@ -0,0 +1,11 @@
import os
import sys
# TODO: see if something better could be done
if __name__ == '__main__':
sys.path.append(os.path.realpath('..'))
# doing the import after editing the path otherwise cause issue between running in pycharm or the terminal
from jarvis.main import start
start()