Skip to content

Commit

Permalink
Refactor to remove mycroft module imports
Browse files Browse the repository at this point in the history
Ensure all dependencies are listed in `requirements.txt`
  • Loading branch information
NeonDaniel committed May 10, 2024
1 parent a110ae0 commit 25f1943
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 10 additions & 10 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
from neon_utils.file_utils import get_most_recent_file_in_dir
from neon_utils.message_utils import request_from_mobile

from mycroft.skills.core import intent_file_handler
from mycroft.util.parse import extract_number
from mycroft.util import play_wav
from ovos_workshop.decorators import intent_handler
from lingua_franca.parse import extract_number
from ovos_utils.sound import play_audio
from subprocess import DEVNULL, STDOUT
from ovos_utils import classproperty
from ovos_utils.log import LOG
Expand Down Expand Up @@ -133,7 +133,7 @@ def handle_camera_activity(self, activity):
self.gui["singleshot_mode"] = False
self.gui.show_page("Camera.qml", override_idle=60)

@intent_file_handler('TakePicIntent.intent')
@intent_handler('TakePicIntent.intent')
def handle_take_pic_intent(self, message):
if ("picture" or "pic" or "photo") in message.data.get("utterance"):
LOG.info("In picture")
Expand Down Expand Up @@ -164,7 +164,7 @@ def handle_take_pic_intent(self, message):
self.bus.emit(message.forward("neon.metric", {"name": "audio-response"}))
else:
if self.cam_dev is not None:
play_wav(self.shutter_sound)
play_audio(self.shutter_sound)
self.bus.emit(message.forward("neon.metric", {"name": "audio-response"}))
# LOG.debug(f"TIME: to_speak, {time.time()}, {message.data['utterance']}, {message.context}")
os.system(f"fswebcam -d {self.cam_dev} --delay 2 --skip 2 "
Expand All @@ -179,7 +179,7 @@ def handle_take_pic_intent(self, message):
# if ("user" or "my") in message.data.get("utterance"):
# self.save_user_info(newest_pic, "picture")

@intent_file_handler('ShowLastIntent.intent')
@intent_handler('ShowLastIntent.intent')
def handle_show_last_intent(self, message):
if "picture" in message.data.get("utterance"):
if request_from_mobile(message):
Expand Down Expand Up @@ -240,7 +240,7 @@ def display_latest_vid(self, profile_vid=False, requested_user="local"):
def display_image(self, image, secs=15, notify=True):
# notification sound
if notify:
play_wav(self.notify_sound)
play_audio(self.notify_sound)

# method of displaying image
# if self.configuration_available["devVars"]["devType"] in ("pi", "neonPi"):
Expand All @@ -250,7 +250,7 @@ def display_image(self, image, secs=15, notify=True):
else:
os.system("timeout " + str(secs) + " eog " + image)

@intent_file_handler('TakeVidIntent.intent')
@intent_handler('TakeVidIntent.intent')
def handle_take_vid_intent(self, message):
if "video" in message.data.get("utterance"):
try:
Expand Down Expand Up @@ -297,7 +297,7 @@ def handle_take_vid_intent(self, message):
else:
self.speak_dialog("DefaultDuration", {"duration": duration}, private=True)
self.vidid += 1
play_wav(self.record_sound)
play_audio(self.record_sound)
vid_path = os.path.join(self.vid_path, get_message_user(message))
if not os.path.exists(vid_path):
LOG.debug(f"Creating video path: {vid_path}")
Expand All @@ -307,7 +307,7 @@ def handle_take_vid_intent(self, message):
("user" or "my") in message.data.get("utterance") else \
vid_path + "user_video_v" + str(self.vidid) + ".avi"
os.system(f"streamer -f rgb24 -i {self.cam_dev} -t 00:00:{secs} -o {path}.avi")
play_wav(self.notify_sound)
play_audio(self.notify_sound)
# if ("user" or "my") in message.data.get("utterance"):
# self.save_user_info(path, 'video')

Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
neon-utils~=1.0
ovos-utils~=0.0, >=0.0.28
ovos-utils~=0.0, >=0.0.28
ovos-workshop~=0.0.15
ovos-lingua-franca~=0.4

0 comments on commit 25f1943

Please sign in to comment.