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

Inconsistent results when getting the news. Plays an AP News segment .mp3 from 2020 #57

Open
SkyLundy opened this issue Jan 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@SkyLundy
Copy link

SkyLundy commented Jan 8, 2023

Describe the bug:
Inconsistent results when attempting to get the news. When I received my Mark II the news did not work and would cause Mycroft to hang until giving a "stop" command. Setting the news source to AP News in the web UI did not solve the problem.

Attempted to get the news and it plays an .mp3 file from an API for Spreaker. The news contains references to events and people from early 2020. This behavior is static and does not change with the hour.

To Reproduce:
Say "Mycroft, play the news" to Mycroft Mk II

Expected Behavior:
The current news for this hour is played from the selected station

Log Files:
Gist of log entries
Log contains entries from initial news command to completion of the news .mp3 playing. Log contents are from journalctl, there is no directory/file located at /var/log/mycroft/

Environment:

  • Device type: Mark II
  • OS: Dinkum
  • Mycroft-core version: 21.2.1
  • Other versions: Unknown or N/A

Additional Context:

  • No changes other than setting the source to AP News in the Web UI weeks ago.
  • Issue occurs when no changes have been made to any Mycroft on-device configuration files
  • Device has had uninterrupted internet connectivity
  • Device has been running as received in early November
  • Contents of /home/mycroft/skills/news.mark2/settings.json are
    {"station": "AP", "custom_url": ""}

This bug has been reposted here from this issue which was posted to the wrong repository.

@SkyLundy
Copy link
Author

SkyLundy commented Jan 8, 2023

Performed some additional testing. Using the command "mycroft, play NPR news" the Mark II did process the command and eventually played the news. During past attempts I stopped Mycroft due to what looked like a hang.

Letting it continue did end up playing the current and correct news but it took Mycroft ~22 minutes from command to sound output. I replicated this twice with the same results and have included the log from the second attempt. Here are the actions with relative min/sec between steps:

00:00 - Command 'mycroft, play npr news', Mycroft acknowledges, lights indicate processing request
04:30 - Mycroft responds with "Here is this hour's news", UI displays NPR news image/streaming interface
22:00 - NPR news begins playing

Steps I took to attempt fixing the original issue:
I SSHd into Mycroft and did a Git pull of the master branch in /opt/mycroft-dinkum which was several commits ahead of my local version, I couldn't say how many though.

I looked at the source code for the skill and found that the existing NPR URI for the hourly news stream did resolve, but involved a redirect by the NPR server. I replaced the string in stations.py as noted below.

# Original
NPR=RSSStation(
        "NPR",
        "NPR News Now",
        "https://www.npr.org/rss/podcast.php?id=500005",
        "NPR.png",
        "#BE1617",
    ),

# Replaced with destination URI after NPR's redirect
NPR=RSSStation(
        "NPR",
        "NPR News Now",
        "https://feeds.npr.org/500005/podcast.xml",
        "NPR.png",
        "#BE1617",
    ),

I added two LOG.warning() calls within the media_uri method definition to log when the method was called and output the media URI that the method would return. The log timestamps at Jan 08 19:36:40 show that these were output at around the ~4:30min mark after the initial command when Mycroft responded.

I commented out the string split given that the new URI does not contain GET variables, the original URL that was being used would fail because removing the GET variable ?id=500005 redirects to the NPR web page for all podcasts and shows at https://www.npr.org/podcasts-and-shows.

@property
    def media_uri(self) -> str:
        """Get the uri for the media file to be played."""
        media_url = self._get_audio_from_rss()
        # TODO - check on temporary workaround and remove - see issue #87
        # - Remove this because the NPR news feed URL has been updated.
        # - The original URL redirected and the new URL does not contain a GET variable
        # if self._rss_url.startswith("https://www.npr.org/"):
            # media_url = media_url.split("?")[0]
        LOG.warning('Fired media_uri')
        LOG.warning(media_url)
        return media_url

The logs show the following errors each time when attempting to play the news:

Jan 08 19:36:47 localhost.localdomain python[17432]: INFO:mycroft.util.log:Playing background music
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5f6fcc0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5fc7840] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5fc7840] main interface error: no suitable interface module
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5eb16a0] main libvlc error: interface "dbus,none" initialization failed
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5fc66a0] main interface error: no suitable interface module
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5eb16a0] main libvlc error: interface "globalhotkeys,none" initialization failed
Jan 08 19:36:47 localhost.localdomain python[2662]: [00000055b5fc66a0] dummy interface: using the dummy interface module...
Jan 08 19:36:49 localhost.localdomain python[2662]: [0000007f8cc12050] http stream error: local stream 1 error: Cancellation (0x8)

Having been able to confirm that the Skill works with the proper updated station information, the issue now looks to be something within the local process itself.

Logged events for the most recent attempt are viewable here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant