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
intent_cache/*
**/intent_cache/**
intent_cache/**
# 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.utils import languages_utils, flask_utils
if __name__ == '__main__':
def start():
# Load lingua franca in the memory
# Supported : English French German Hungarian Italian Portuguese Swedish
lingua_franca.load_language(lang=languages_utils.get_language_only_country())

View File

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

View File

@ -15,8 +15,10 @@ class SpotifySkill(Skill, metaclass=SkillRegistering):
data['artist'] if 'artist' in data else None)
if song_lists_matching is not None and len(song_lists_matching) >= 1:
# pause the music then speak dialog
spotify.get_spotify().pause_playback()
# pause the music before speaking dialog
if spotify.is_music_playing():
spotify.get_spotify().pause_playback()
if 'artist' in data and 'song' not in data:
self.speak_dialog("play_from_artist", {'artist': song_lists_matching[0]['artists'][0]['name']})

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