MycroftAI / skill-npr-news

Mycroft AI official News Skill, providing the latest news report from your favorite broadcast.
https://mycroft.ai/skills
Apache License 2.0
9 stars 42 forks source link

Can't choose where the news plays #125

Closed pconrad-fb closed 2 years ago

pconrad-fb commented 2 years ago

Describe the bug When I play BBC News, it plays on my connected analog speaker. When I play NPR News, it goes looking for an audio sink on my network and never plays on my connected speaker. This doesn't seem to be selectable or configurable, so I can't play NPR News on my Picroft's connected speaker.

At first, it played on my bedroom speaker, which I don't want because it's not useful to play in a different room from where I made the request. I rebooted the bedroom speaker, hoping that would tell Mycroft to use the local speaker. Instead, it now plays NPR News nowhere, it just silently sends the audio somewhere I can't hear it. But I can still hear BBC News.

To Reproduce Steps to reproduce the behavior:

  1. "Hey Mycroft, play NPR News."

Expected behavior Should play NPR News on the connected speaker. Doesn't.

Log files If possible, add log files from /var/log/mycroft/ to help explain your problem.

Before rebooting bedroom speaker:

2022-04-14 22:42:57.108 | INFO     |  1603 | mycroft.audio.audioservice:get_serv
ices:63 | Loading services from /home/pi/mycroft-core/mycroft/audio/services/
2022-04-14 22:42:57.111 | INFO     |  1603 | mycroft.audio.audioservice:load_int
ernal_services:135 | Loading chromecast
2022-04-14 22:43:05.286 | INFO     |  1603 | pychromecast | Querying device stat
us
2022-04-14 22:43:05.410 | INFO     |  1603 | audioservice_chromecast:autodetect:
165 | Bedroom speaker found.

After rebooting bedroom speaker:

2022-04-16 04:28:08.453 | INFO     |   754 | mycroft.audio.speech:mute_and_speak:127 | Speak: Here is this hour's news on NPR News Now.
Playing WAVE '/tmp/mycroft/cache/tts/Mimic2/fd290cffb5c9e64d8f4c14e5a3bd3055.wav' : Signed 16 bit Little Endian, Rate 22000 Hz, Mono
2022-04-16 04:28:11.826 | INFO     |   754 | audioservice_chromecast:supported_uris:67 | Chromecasts found: Chromecast('192.168.1.81', port=8009, device=DeviceStatus(friendly_name='Bedroom speaker', model_name='Google Home Mini', manufacturer='Unknown manufacturer', uuid=UUID('cab5b072-4ff6-9c46-8763-75d1aa303f04'), cast_type='audio'))
2022-04-16 04:28:11.888 | INFO     |   754 | audioservice_chromecast:supported_uris:67 | Chromecasts found: Chromecast('192.168.1.81', port=8009, device=DeviceStatus(friendly_name='Bedroom speaker', model_name='Google Home Mini', manufacturer='Unknown manufacturer', uuid=UUID('cab5b072-4ff6-9c46-8763-75d1aa303f04'), cast_type='audio'))
2022-04-16 04:28:12.322 | INFO     |   754 | pychromecast | Quiting current app
2022-04-16 04:28:12.322 | INFO     |   754 | pychromecast.controllers | Receiver:Stopping current app 'None'
2022-04-16 04:28:12.348 | INFO     |   754 | pychromecast.controllers | Receiver:Launching app CC1AD845
2022-04-16 04:28:45.987 | INFO     |   754 | pychromecast | Quiting current app
2022-04-16 04:28:45.987 | INFO     |   754 | pychromecast.controllers | Receiver:Stopping current app 'CC1AD845'
2022-04-16 04:28:45.989 | INFO     |   754 | mycroft.audio.audioservice:_stop:354 | END Stop
2022-04-16 04:28:51.579 | ERROR    |   754 | concurrent.futures | exception calling callback for <Future at 0xb11e9350 state=finished raised AttributeError>
Traceback (most recent call last):
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 324, in _invoke_callbacks
    callback(self)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_executor.py", line 56, in _callback
    self.emit('error', exc)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 116, in emit
    self._emit_handle_potential_error(event, args[0] if args else None)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 86, in _emit_handle_potential_error
    raise error
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/pi/mycroft-core/mycroft/audio/audioservice.py", line 395, in _restore_volume_after_record
    restore_volume()
  File "/home/pi/mycroft-core/mycroft/audio/audioservice.py", line 387, in restore_volume
    self.current.restore_volume()
AttributeError: 'NoneType' object has no attribute 'restore_volume'
2022-04-16 04:29:06.213 | WARNING  |   754 | pychromecast.socket_client | [192.168.1.81:8009] Heartbeat timeout, resetting connection
2022-04-16 04:29:06.213 | WARNING  |   754 | pychromecast.socket_client | [192.168.1.81:8009] Heartbeat timeout, resetting connection
2022-04-16 04:29:11.223 | ERROR    |   754 | pychromecast.socket_client | [192.168.1.81:8009] Failed to connect, retrying in 2.0s
2022-04-16 04:29:18.231 | ERROR    |   754 | pychromecast.socket_client | [192.168.1.81:8009] Failed to connect. No retries.
2022-04-16 04:29:21.522 | INFO     |   754 | mycroft.audio.speech:mute_and_speak:127 | Speak: Here is this hour's news on NPR News Now.
2022-04-16 04:29:21.526 | INFO     |   754 | mycroft.tts.tts:_get_sentence_from_cache:407 | Found fd290cffb5c9e64d8f4c14e5a3bd3055.wav in TTS cache

You may also include screenshots, however screenshots of log files are often difficult to read and parse.

If you are running Mycroft, the Support Skill helps to automate gathering this information. Simply say "Create a support ticket" and the Skill will put together a support package and email it to you.

Environment (please complete the following information):

Additional context It used to always play on the bedroom speaker (which I didn't want). I rebooted the bedroom speaker, and now it plays nowhere.

Please think carefully about whether you have modified anything in Mycroft's code or configuration files. If so, can you reproduce this on a clean installation of Mycroft? Many "bugs" turn out to be non-standard configuration errors.

forslund commented 2 years ago

I think it's because the skill perfers to use a https-enabled backend and the remote is the only available. I submitted a quick fix for the issue. if you have the possibility to try that PR (#126) it would be great. An alternative is to install vlc and that should make the local vlc backend work

pconrad-fb commented 2 years ago

Thanks. I did a bunch of rebooting of both the Pi and the Google speaker and can no longer reproduce it. If I see it happening again, I'll pull that file and see if it makes a difference. Ultimately, of course, it would be super cool to be able to say "Play NPR on {device}" but have it default to whatever's connected locally.