Cannot repeat spoken title (e.g. Opening Audiobook <book title here>)


#1

Apologies if wrong section, it’s my first post.

I was planning on making an audiobook reader that uses the librivox API, but for some reason, after saying the wake word, Mycroft did not say something like “opening/loading audiobook titled Count of Monte Cristo” where “Count of Monte Cristo” is part of what the user says (“hey Mycroft, read a book on Count of Monte Cristo”).

My copy of the latest attempt can be found here: https://github.com/rekkitcwts/mycroft-skills/tree/19.02/skill-audiobook


#2

Might also be useful to see what’s in the logs. Did the skill load? Did the parsing correctly use said skill? Any other errors? (logs are in /var/log/mycroft/ normally)


#3

There are no errors, but here is a screenshot of mycroft in debug mode:


#4

Screenshots are for image issues.

Did the skill load?
Did the intent get parsed?


#5

Hi rekkitcwts,

Great to see you getting into Skill development!

I’m guessing you were looking at the Speak Skill to get started? That Skill is probably a bit dated. The good news is that we have some easier methods to achieve what you’re trying to do.

I see you made a Words.rx. If you require that in your intent handler you can then access the book title as it’s own entity:

@intent_handler(IntentBuilder("").require("Read").require("Words").require("Audiobook"))
def handle_read_intent(self, message):
    # Get audiobook title from utterance
    book_title = message.data.get('Words')
    self.speak_dialog("loading.audiobook", {'title': book_title})

I’m assuming your current code is failing because repeat.split() creates a list, and the .speak() method requires a string. If you just pass the first element of that list it works:
self.speak(repeat.split()[0])
however I think the new approach using entities is much easier.

A few other little things you might run into:

  • Your regex Words.rx should also be in a language sub-directory eg regex/en-us/Words.rx
  • Alternatively we recently allowed for all of these different language files to live in one folder called locale, so you can replace regex/en-us/, dialog/en-us/ and vocab/en-us/ with a single locale/en-us/
  • The MycroftSkill class has a built-in logger so you can run self.log.debug('some message') to see what’s happening at runtime.

I’ve also noticed that you are working in a fork of the mycroft-skills repo. It’s much easier to create a repo just for your Skill. The Mycroft Skills Kit can handle this for you. Checkout the docs for that here:


#6

The skill loaded; hence the debugger did not show any errors. I tried using the same pattern as the Speak skill but not sure what went wrong when trying to parse.