Fixed bug when jarvis wouldn't start outside pycharm
This commit is contained in:
parent
60f558c9dd
commit
b0c515761c
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,7 +11,7 @@ __pycache__/
|
|||||||
*.so
|
*.so
|
||||||
|
|
||||||
intent_cache/*
|
intent_cache/*
|
||||||
**/intent_cache/**
|
intent_cache/**
|
||||||
|
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append('../')
|
@ -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())
|
||||||
|
@ -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:
|
||||||
|
@ -15,8 +15,10 @@ 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
|
|
||||||
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:
|
if 'artist' in data and 'song' not in data:
|
||||||
self.speak_dialog("play_from_artist", {'artist': song_lists_matching[0]['artists'][0]['name']})
|
self.speak_dialog("play_from_artist", {'artist': song_lists_matching[0]['artists'][0]['name']})
|
||||||
|
11
run.py
Normal file
11
run.py
Normal 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()
|
Reference in New Issue
Block a user