Lots of minor fixes including, sorting dicts, making ints of strings,
MagicMock file spec and some other things
A couple of issues in the mycroft-core code base were identified and
fixed. Most notably the incorrect version check for python three when
adding basestring.
Update .travis.yml
- Engines now specify if they support ssml rather than the configuration
- The text client strips out ssml tags
- Engines can modify tags via the `self.modify_tag` method
When loading voc and regex files, lines starting with "#" are now
ignored, so developers and translators can use them to document their
decisions.
==== Fixed Issues ====
This sends a ctrl+c signal to each process which will allow code to exit properly by handling KeyboardInterrupt
Other notable changes:
- create_daemon method used to clean up create daemon threads
- create_echo_function used to reduce code duplication with messagebus
echo functions
- wait_for_exit_signal used to wait for ctrl+c (SIGINT)
- reset_sigint_handler used to ensure SIGINT will raise KeyboardInterrupt
Allow intents to be enabled or disabled from outside of the skill via
the messagebus.
Adds mycroft.skill.enable_intent and mycroft.skill.disable_intent
This defaults skill's configs to an empty dict instead of None,
which simplifies getting specific values in the config for skills.
It removes the check for None config.
==== Fixed Issues ====
==== Documentation Notes ====
Skill writers no longer need to check for None configs.
The emitted event "open" will in many cases call ws.emit, and this will
lock if the connected_event isn't set. This makes sure that the
connected_event is set before emitting the open event.
If the sentence is normalized the utterance_remainder() method fails if
the intent keyword expects normalization.
Example the joking skill has an intent "tell me joke" which is the
normalized equivalent of "tell me a joke". In this case the intent wouldn't be removed from the remainder and instead of an empty string the utterance remainder would contain "tell me joke"
Modified the debugging message output after an utterance is complete, to
make it clear that metric data is only sent if opt_in is enabled.
This addresses #1494, which I filed in error, thinking that opt_in was
never checked (due to reading the log output and not knowing it was
checked elsewhere)
==== Fixed Issues ====
==== Localization Notes ====
Slight change to existing, unlocalized text
Previously if duplicates of a skill should be launched or a skill isn't properly
shutdown when reloaded multiple handlers could be registred. This commit disables multiples of repeating events.
An exception raised during the shutdown would previously cause the skill reload process to halt. This catches any exception and reports the error without halting the SkillManager
If super's shutdown was called before trying to cancel events an exception would be thrown since shutdown removed all registered events by setting self.events to None.
This replaces this with an empty list to allow skills to try to remove events/cancel events without incidents.
When a fresh image first updates the settings after pairing it is handled somewhat differently and this was missed in the original implementation of the callback handling.
This minor change includes this case as well.
If the scheduler was frozen for some time and the repeating event
scheduled time passes it would trigger the event constantly until the
next time is in the future again.
This will make the scheduler to disallow scheduling in the past and
instead schedule the next call one repeat period from now.
This can be replaced by ensuring the final except clause is 'except Exceptions'. This works because SystemExit and KeyboardInterrupt do not inherit from the base 'Exception' class
Several tweaks to CLI behavior
* The "show/hide meter" setting is now persisted
* Fix behavior when scrolled back and logs are rolling off
* Fix potential crash when no logs exist
* Add Ctrl+R to force a refresh (undocumented for now-- help page is getting long and we need an automated system to resize help for smaller screens)
The calulated limit ensures that at least one message will be displayed.
Using a hard-coded constant is ugly, but such are scattered throughout
the script. Untangling those constants has been left for future patch.
* Fix error message for enable_intent
The error was printed for each intent name mismatch instead of after all intents had been checked.
* Make sure intents aren't munged multiple times
Previously intents could be munged multiple times (This happened when enabling a disabled intent), resulting in an invalid name.
* Add test case for disable/enable intent
* Improve unmunging of messages
This make sure that only skill id's in the beginning of messages are removed and should speed up the process slightly
* Fix munging for register_vocab and register_regex
* Add testcases for register vocab and regex
When creating event handlers with add_event now by default there are no
messages about start and completion of the handler.
The handler info base name is now passed as an argument to the method
allowing for custom messages. skill intent handlers still report
skill.handler.start and skill.handler.complete but for example scheduled
events wont send these start/stop (but could instead trigger for example
skill.scheduled_event.start/complete)
* Update pyee to v5.0.0
The old version of pyee (1.0.1) could not remove events registered as "once" (instead of "on")
This fixes canceling scheduled events
* Restore MycroftSkill.remove_event() return value
The return statement in remove_event() was missing, probably lost while handling a conflict.
The data field of the message sent to the event handler may not always be a dictionary, (Example case Timer skill, which sets data to the timer name)
This validates the message type and the type of the data field before trying to unmunge.
* Add interface to Mark 1 faceplace capabilities
This adds API interfaces for two Mark 1 faceplace capabilities to the
mycroft.client.enclosure.EnclosureAPI()
EnclosureAPI.setpixel(index, r,g,b)
- Set individual eye pixels to any color. The indices go from 0-23 with
the 0-12 corresponding to the right eye and 11-23 to the left.
EnclosureAPI.fill(percentage)
- Fill the eyes to a percentage, for use in meters or countdowns. The
right eye is 0-50%, the left eye also fills if going up to 100%.
* Skip skill update on startup if recent
Skills aren't updated on startup if the last update was less than 12
hours ago.
- msm adds a .msm file in the skills directory with a timestamp and a
list of the skills installed by default
- the UPDATING screen message is moved to the SkillManger when direct
update is scheduled.
- On internet connection the skill update time is scheduled
- Skills (other than priority skills) are not loaded until
- The timeout for when direct update is necessary is settable in the
config.
internet connection has been verified (message on messagebus)
All methods relating to loading vocabulary, dialog and regular
expressions has grown quite large. To make the core functionallity of
the skills more readable these are moved to the new module skill_data.
Additional method documentation has been addedi as well.
Convert keyword names to unique names by prepending the keyword with a
letter string derived from the unique skill id.
This commit modifies required keywords, optional keywords, one_of
keywords and regex matches.
This also munges the context keyword when that is sent to match the
intent correctly
Many thanks to mikonse for troubleshooting and suggesting this fix.
==== Fixed Issues ====
==== Tech Notes ====
Disabling this exception should free up the audio producer thread to
continue deliver the available sound data.
* Add wait_for_response method to Websock client
The client handles the basic case when wanting to do a syncronous
request-response action.
The method sets up a handler waits for the response and handles timeout.
The expected format is that the reply message should have the same type as
the original message with ".response" appended.
An method in the Message class has been added to create a standard response for
a message.
* Let the :skills command use wait_for_response
* Minor docstring changes
Fixed typos and refined text
* Made MycroftSkill.remove_event() return a bool, preventing unnecessary/misleading message from being posted by MycroftSkill.cancel_scheduled_event()
* More doc and several minor renames around intent processing
* Several minor typo and doc corrections
An error occured when testing skill settings when checking if the settings should be sent when trying to upload a field without a value. To guard against this there is a check if the field has a value before checking.
SkillManager now handles the skillmanager.list message and will reply with the
mycroft.skills.list message including a list of the loaded skills.
==== Protocol Notes ====
Added messages:
- skillmanager.list: skill manager send list of skills on messagebus
- mycroft.skills.list message with skill list
The bug was due to identifier collisions in the backend as well as settingsmeta schemas with a label field with no name attribute. This fix will make sure there are no more identifier collisions with already existing broken settingsmeta schemas in the database.
Add support for:
* mycroft.util.format.nice_time()
* mycroft.util.format.prounce_number()
* implemented unittests for above
Also renamed the helper method convert_number() to
_convert_to_mixed_fraction()
* Add support for deepspeech_server
deepspeech_server is a server running deepspeech (obviously). It's quite
easy to install and run (package available in pip and then a config file
pointing to the model)
This pr adds the DeepSpeechServerTTS class, a STT interface allowing
mycroft to use one of these servers.
config needed:
"stt": {
"module": "deepspeech_server",
"deepspeech_server": {
"uri": "http://IP-ADDRESS:PORT/stt"
}
}
* Add deepspeech_server example to mycroft.conf
Withe the NTP checks in place, the sequence of visual and audio queues
was a little clunky. This refines it slightly for normal use and to
play better with the pairing process.
* Implement max-line to limit memory usage
The major point of the PR is to limit the memory usage of the CLI by
implementing a maximum log limit. It defaults to 5000.
Other changes:
* Add "--debug" option to support troubleshooting/debugging the CLI itself
* Add support for jumping to the top (Ctrl+T/Ctrl+PgUp) or bottom (Ctrl+B/Ctrl+PgDn) of the logs.
* Remove the "OLDEST" message from the log. It was really no longer necessary since the log navigation issues got straightened out, and it complicated the max log line logic.
Raspberry Pi's don't have a built-in clock, so at boot-up the clock just picks up from when they were last running. Normally this is corrected very quickly by NTP from an internet server, but if there is no network connection that cannot happen.
When an out-of-the-box Mark 1 or Picroft is being setup, the clock is set to whenever the image was created. Upon completing the Wifi setup step the NTP service can finally sync with the internet, so time suddenly "jumps" to weeks later -- usually. In either case (when the date jumps or when the date is erronously months old), there is potential for havoc.
These changes deal with that situation. Upon network connection, an NTP synchonization is forced. If it is detected that a major time jump happened
(more than 1 hour), then the user is notified that the clock change requires
a reboot and the system restarts.
Other changes:
* use the new "system." message namespace
* add pause before the system.reboot during a WIPE, allowing reset to totally complete
*
==== Tech Notes ====
When a new track starts playing the audio service will send a message
indicating which track has started.
==== Protocol Notes ====
"mycroft.audio.service.track_start" message added
- add_event() now accepts the parameter once, registring the event as a one shot event.
- remove_event for non-existing events is handled
- added a test for this