PyCroft : Hey Mycroft, play the news - play duplicate news mp3s


#1

Hey Mycroft, play the news - skill

Often lately when I request news first time of the day , Mycroft says it will play npr news.

However nothing is played.

When I request news second time Mycroft says play npr news and then plays both npr npr files at once … amusing the first time.

Assume there is some play mp3 * code going on.

any tips on how to get round this as its one of my fav skills

Version

{
“coreVersion”: “0.8.6”,
“enclosureVersion”: “0.1.21”
}


#2

I’ll file a bug report, but right now not sure how to fix the issue.

It’s basically just fetching from an RSS feed and playing the MP3, so not sure what would be going wrong there.

What are you running Mycroft on? It shouldn’t matter, I’m just curious.

Also, what times are these that you either get no response or duplicates?


#3

Hi … if you tell me what part of the code this news skill runs in I can put some debugging code in and send you some logs.
I am running MyCroft on a Pi3 / Wifi
On the first call Mycroft response with “… here is the NPR top of the news …” and then nothing happens .
I thought perhaps the MP3 file had not downloaded from NPR (e.g. timing issue … does the code need to wait till the file exists before calling the MP3 player ) but on the second attempt it seems to be there.


#4

That’s odd.

The code is in the NPR Skill, which you can see here on github:
https://github.com/MycroftAI/mycroft-core/tree/dev/mycroft/skills/npr_news

The specific code segment is just this:

    def handle_intent(self, message):
        try:
            data = feedparser.parse(self.url_rss)
            self.speak_dialog('npr.news')
            time.sleep(3)
            self.process = play_mp3(
                re.sub(
                    'https', 'http', data['entries'][0]['links'][0]['href']))

The web address is stored in the configuration file, which I really should move out, but the RSS feed is from:

  "NPRNewsSkill": {
    "url_rss": "http://www.npr.org/rss/podcast.php?id=500005"
  },

I’ll also look into it, as well, but haven’t seen that issue myself.

If you do figure out the problem, feel free to add more info to the issue I created:


or submit a PR.

Thanks for anything you can add to figuring out what’s going on!


#5

thanks Karl
Prob should update the issuse as well …
Have been looking for the source on my Pi and grep-ed
/home/mycroft/.mycroft/skills/NPRNewsSkill
But there is not .py code in there
Q:Where does the skills code live on a RPi?
I have run some tests yesterday which had the same duplicate problem inc playing old alarms and then today where there was no problem.
My theory is that is it related to periodically slow internet ( copper ) and the MP3 play is starting before the MP3 has downloaded.