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

沉浸式插件有办法自动退出沉浸式吗? #351

Open
mylovexx opened this issue Feb 26, 2025 · 0 comments
Open

沉浸式插件有办法自动退出沉浸式吗? #351

mylovexx opened this issue Feb 26, 2025 · 0 comments

Comments

@mylovexx
Copy link

我想让本地音乐播放器仅播放一首歌曲就停止,所以改写了MusicPlayer类的play函数:

def play(self, idx=None):
logger.debug("MusicPlayer play")
if idx == None:
path = self.playlist[self.idx]
super().stop()
super().play(path, False, self.next)
else:
path = self.playlist[idx]
super().stop()
super().play(path, False, self.pause)

但是报了如下错误:

2025-02-25 23:08:40,695 - asyncio - ERROR - Exception in callback SoxPlayer.executeOnCompleted(True, >)
handle: <Handle SoxPlayer.executeOnCompleted(True, >)>
Traceback (most recent call last):
File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/pi/intelligent_screen/robot/Player.py", line 91, in executeOnCompleted
res and onCompleted and onCompleted()
^^^^^^^^^^^^^
File "/home/pi/intelligent_screen/robot/Player.py", line 215, in pause
os.kill(self.proc.pid, signal.SIGSTOP)
ProcessLookupError: [Errno 3] No such process

之后在唤醒wukong-robot的时候又出现了如下错误:

2025-02-25 23:11:45,195 - robot.Player - INFO - 寮€濮嬫挱鏀鹃煶棰戯細/home/pi/intelligent_screen/static/beep_hi.wav
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/intelligent_screen/wukong.py", line 98, in run
detector.initDetector(self)
File "/home/pi/intelligent_screen/robot/detector.py", line 60, in initDetector
wukong.conversation.interrupt()
File "/home/pi/intelligent_screen/robot/Conversation.py", line 111, in interrupt
self.brain.pause()
File "/home/pi/intelligent_screen/robot/Brain.py", line 117, in pause
plugin.pause()
File "/home/pi/intelligent_screen/plugins/LocalPlayer.py", line 98, in pause
self.player.pause()
File "/home/pi/intelligent_screen/robot/Player.py", line 215, in pause
os.kill(self.proc.pid, signal.SIGSTOP)
ProcessLookupError: [Errno 3] No such process

请问有好的解决办法吗?另外看沉浸式插件代码如果用户不输入退出命令的话,插件自己完成任务后似乎无法主动退出沉浸式状态,不知我的理解是否正确,谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant