Commit Graph

888 Commits (3fea4b1e6fa2d3bfd6f620fcd3e188feb4903780)

Author SHA1 Message Date
Steve Penrod 0d64e78d0c Add protection for naive skill authors (#1825)
* Add protection for naive skill authors

It is fairly common for new skill authors to attempt actions in the __init__()
method which are not legal yet, as the Skill has not been fully connected to
the Mycroft system.  This adds an @property protection layer for the two most common
issues:
* Accessing MycroftSkill.bus
* Accessing MycroftSkill.enclosure

Now those are properties instead of variables and provide appropriate warnings
when used before they exist.

Also enhancing the handling of error logs in the CLI to highlight problems such
as this:
* Color "- ERROR -" log messages in red
* Retaining leading characters from log messages, improving readability in formatted messages
2018-10-01 21:41:48 +02:00
Steve Penrod edb126ca44 Fixed typo and updated comments on schedule_event 2018-10-01 12:29:28 +02:00
Steve Penrod 6181fe1484 Reduce much of the noise in the logs (#1819)
This eliminates a lot of the noise in the log files.  Later I'll add features in the CLI to
assist watching the messagebus messages rather than writing them all to logs.

Also corrected some language and formatting in settings.py docstrings.
2018-09-28 12:48:34 +02:00
Åke 2e7179d661 Strip trailing blank lines (#1817)
If a blank line is intended add a single space and it will be included
2018-09-26 22:22:00 -05:00
Steve Penrod 3843f5a657 Add "wait" option to MycroftSkill.speak() and speak_dialog() (#1812)
* Add "wait" option to MycroftSkill.speak() and speak_dialog()

The new "wait" option will cause the speak function to block until all
of the given dialog has been spoken by Mycroft.  This means:
    self.speak("Hello world", wait=True)
is now equivalent to:
    self.speak("Hello world")
    wait_while_speaking()
2018-09-26 22:02:56 +02:00
Steve Penrod 4a8e0e9f4a Add ability to schedule event in seconds (#1813)
* Add ability to schedule event in seconds

The MycroftSkill.schedule_event() method now accepts an integer in addition to
a datetime for the 'when' parameter.  The integer represents the number of
seconds in the future to fire off the event.  E.g.
```python
   self.schedule_event(some_handler, 7)
```
Will invoke some_handler() seven seconds from now.

Also unified language used in event docstrings.
2018-09-26 21:35:14 +02:00
jarbasal f1e8f6922c remove context methods 2018-09-26 20:10:34 +01:00
jarbasal 20b87eeac3 pep8 2018-09-26 19:27:05 +01:00
Steve Penrod fb03ac6cec Order results from translate_namedvalues()
Switch to an OrderedDict() for translate_namedvalues(), maintaining the
sequence of values defined in the original "list.value" file.  This is
useful in circumstances where there are multiple values, but the order
of listing indicates some sort of preference.

This is used in the Alarm skill to allow synonyms like "weekdays"/"weekday",
"Mondays/Monday", but the first value is used when building the status string.
For example "You have an alarm for 8am on Mondays".  Generically, this lets
translators consistently provide preferred names for values by adjusting the
order.
2018-09-26 13:26:56 -05:00
jarbasal efd184fd19 word arg is optional 2018-09-26 19:25:25 +01:00
jarbasal d9b946a22f allow adapt context across skills 2018-09-26 19:18:08 +01:00
Åke 1ad41ef5ec Workaround for adapt issue with context + one_of (#1789)
Adapt doesn't populate the entry from the one_of correctly from context. To work around the issue intent structure is scanned for empty keys and tries to populate them from entities in __tags__
2018-09-24 15:17:13 -05:00
Åke f091f44c85 Audioservice repeat (#1805)
* Add repeat option to audioservice

The audioservice.play() method now accepts a repeat parameter. If this
parameter is True the playlist passed to the audio service will be
repeated.

* Add repeat support to vlc

* Add the repeat parameter to all services

Not functional but playback will work at least. Hacktoberfest?
2018-09-24 15:12:12 -05:00
Åke 0ed9450ca7 Bugfix/skill loading remnants (#1783)
* Add cleanup if the skill loading fails

If a skill throws an exception in initialize the registered handlers
need to be removed. To cleanup this the skill shutdown procedure is
run.

* Don't try converse method on non-loaded skills

Checks if a valid skill instance is present before calling the converse method
to filter out skills that wasn't loaded.

* Mark unloaded skills as inactive in CLI
2018-09-09 02:04:06 -05:00
Steve Penrod c13b40fc25 Fix path in recent locale support
The recent changes to support the 'locale' directory were incorrectly
joining the os.walk() path and filename, resulting in double-directories,
like "./vocab/en-us/./vocab/en-us/Something.voc"
2018-08-29 03:54:30 -05:00
Åke 787ff63d2b Remove trailing references to MycroftSkill.emitter (#1768)
- references in skill_tester.py
- when going through the methods to check for decorations the emitter
was triggered and generated a Warning
2018-08-28 12:26:46 -05:00
Steve Penrod e1ab1c2a47 Merge branch 'feature/simple-audio' of git://github.com/forslund/mycroft-core into forslund-feature/simple-audio
# Conflicts:
#	mycroft/audio/services/simple/__init__.py
2018-08-27 14:32:45 -05:00
Åke 85ae69597b Separate enclosure api from enclosure client (#1760)
This is a step towards abstracting the idea of an Enclosure which ties Mycroft to the hardware that is running Mycroft.

- Move the enclosure API to mycroft.enclosure.api (previously was mycroft.client.enclosure.api)
- Move display_manager out of enclosure client to mycroft.enclosure.display_manager
- Merge EnclosureWeather into EnclosureMouth
- Wrap display manager in a class
2018-08-27 13:44:12 -05:00
Åke 7c6ddb0847 Fix voc_match_cache member (#1765)
Seems like a rebase/merge moved this one around. It's now moved back into
__init__
2018-08-27 12:58:15 -05:00
Steve Penrod a3f1179897 Unify vocab/regex/dialog under new 'locale' directory
* Add MycroftSkill.find_resource() that locates a localization resource file
  from either under the old vocab/regex/dialog folder, or under any folder in
  the new 'locale' folder.  The locale folder unifies the three different
  folders and allows arbitrary subfolders underneath it.
* MycroftSkill.speak_dialog() will now speak the entry name if no dialog file
  is found.  Periods are replaced with spaces, so
  ```self.speak_dialog("this.is.a.test.")``` would return "this is a test" if
  no file named this.is.a.test.dialog is found.
* Remove MycroftSkills.vocab_dir value
* Minor edits to several docstrings
2018-08-27 13:28:46 +02:00
Åke 1d4297d33c Remove announcement parameter from get_response (#1758)
MycroftSkill.get_response() now uses the dialog parameter as either a literal string or a dialog
filename.
2018-08-26 01:56:26 -05:00
Åke 3334316c63 Add MycroftSkill.voc_match (#1719)
The method first tries to use the skill vocab directory and then tries
the mycroft/res/text... directory.

After the vocab is loaded from file once it's stored in a cache
dictionary and further uses of the method won't hit the disk.

Example:
   if self.voc_match(utt, "Yes):
       ...
2018-08-24 20:14:44 -05:00
Michael Nguyen b3c767d912 Web setting typecasting
The initial implementation of web settings returned values as
strings all the time, even Boolean and numeric values.  This
required unnecessarily complicated code, such as:

```python
    if setting["show_time"] == "true":
        # do whatever...
```

Now a value defined in metadata as a "checkbox" gets cast to a boolean,
and values defined in metadata as a "number" is typecast to int or
float, as appropriate.  This allows cleaner code such as:

```python
    if setting["show_time"]:
        # do whatever...
```

NOTE: This can be a breaking change, verify you skill which uses 'checkbox'
webUI types handles this correctly for 18.08.
2018-08-23 23:22:13 -05:00
Åke Forslund 7b4c6ed583 Audio service mimetypes
Add possibility for mimetypes to be passed with each track.
Make simple audio service try to detect mime type if missing
2018-08-23 08:41:01 +02:00
Åke 4aac668a2f Remove depreciated ScheduledSkill (#1731)
- remove the scheduled_skills module
- remove the time_rules module
- remove parsedatetime requirement (only used in scheduled_skills)
2018-08-21 20:53:52 -05:00
Åke 64476eb143 Replace emitter/ws with bus (#1757)
Makes the code a bit more understandable
2018-08-21 20:50:50 -05:00
Matthew D. Scholefield c138fda79e
Merge pull request #1725 from forslund/feature/__main__
Feature/__main__
2018-08-21 10:29:13 -05:00
Åke 4e8972669f
Merge pull request #1750 from MycroftAI/bugfix/removing-scheduled-events
Fix removing scheduled events
2018-08-17 12:35:53 +02:00
Steve Penrod 6838e10965 Fix removing scheduled events
The list holding the names of scheduled events was being populated with decorated names,
but other code assumed it held the "friendly" name.  Corrected this assumption.

Several locations also removed list entries while iterating on the same list, resulting
in entries being skipped and left un-deleted.  This left behind phantom scheduled events
when skills were reloaded, goofing up many schedules after the reload.
2018-08-17 04:48:34 -05:00
Åke Forslund b03e0336ca Move SkillManager from __main__ to separate file 2018-08-16 20:53:27 +02:00
Åke Forslund a66e23d8ab start processess using python -m
- rename process main.py to __main__.py
- update start-mycroft.sh/stop-mycroft.sh scripts to reflect the change
2018-08-16 15:21:22 +02:00
Matthew Scholefield e26904e814 Add feature to install beta skills 2018-08-15 14:06:12 -05:00
Julien Kassar 24a80d60c3 Fix camel case splitting
Signed-off-by: Julien Kassar <github@kassisol.com>
2018-08-12 14:00:28 -04:00
Steve Penrod 609a09bbf3
Allow Padatious to override Adapt (#1713)
Allow a Padatious intent to override Adapt when it is VERY
certain that the utterance is directed at it.  (95% confidence
or greater.)  Right now that only occurs if the intent match
for the given phrase is perfect.

This solves this kind of issue:
* Adapt:  Matching on "Set" and "Alarm"
* Padatious: Handling "is an alarm set"

* Fix logic error for when no Padatious intent
2018-08-03 14:43:17 -05:00
Matthew D. Scholefield d49d991a84 Remove git locks when starting mycroft (#1715)
This is a preventative measure to fix errors with git lock files not being removed when devices are unplugged or processes are killed
2018-08-03 14:41:51 -05:00
Steve Penrod ec73b7d48e
Fix named event scheduling/deleting (#1705)
While working on the Alarm skill I discovered several issues with the
event scheduler.  This PR cleans up those findings and resolves several
other potential issues:

1) To avoid thread synchronization issues, the EventScheduler had several
queues which independently held objects to be added/deleted/updated.  However, the order of the events was undefined and got mixed since they were all batched together.  So, for instance, if skill code performed:
   self.add_event("foo", self.handle_foo)
   if SomeReason:
       self.cancel_event("foo")
The actual order of queue handling would perform Remove first, then Add which resulted in "foo" not being found for delete, but then added and left as an active event.

Now the EventScheduler protects the list using a Lock and the queues have been removed.  Modifications to the list happen immediately after obtaining the lock and are not batched up.

2) One-time events were triggered while the event was still in the EventScheduler list.  Now the entry is removed before invoking the handler.

3) Within the MycroftSkill.add_event(name, handler) is a local 'wrapper' method that actually makes the callback.  The MycroftSkill.remove_event(name) method attempted to find entries in the events list and the associated handler entries in the self.emitter to remove.  However, the emitter actually held the wrapper(handler), not the handler itself.  So the emitter handlers were left behind.

This was a quiet bug until the next time you scheduled an event of the same name.  When that second event finally triggered, it would fire off both the new and the old handler -- which snowballed in the 'skill-alarm:Beep' case, doubling and redoubling with every beep.

Now this cancels all the emitter listeners by name.  There is a very slim chance that someone has registered a listener with the same name, but since it is namespaced to "skill-name:Event" I think this is pretty safe.


Not technically related, but a failure that has been lurking for
some time and is a French unit test that doesn't work depending
on the time of day when the test is run.
2018-07-30 15:08:13 -05:00
Matthew D. Scholefield 3fbe12cc07
Make single thread log nicer 2018-07-26 18:57:36 -05:00
Steve Penrod 0eb29718f3 Remove commented-out code 2018-07-26 18:27:49 -05:00
Steve Penrod edc6ab1ed6 Immediately speak warning while Padatious trains
At startup, Padatious was blocking in the fallback while the
training occurred.  As a result, any attempts to use Mycroft
during that period would queue up rather than giving the
user feedback.  Now it immediately returns False, allowing
user notification to occur elsewhere.
2018-07-26 18:21:48 -05:00
Åke Forslund b60320bcae Fix updating padatious intents after intent reload
Training is called from wait_and_train with None as message, this commit adds propper handling for this case.
2018-07-19 14:06:58 +02:00
Åke c140d5b889
Merge pull request #1690 from MycroftAI/feature/ask-yes-no
Add new MycroftSkill.ask_yesno() method
2018-07-19 09:34:32 +02:00
Åke ad5ebcf63d Bugfix/unmunge (#1688)
* Fix cases where the unmunge misses keywords

The unmunge would invariably miss keys due to the fact that the dict is modified while being iterated. This breaks out the keys into a list before iterating through them to ensure that all original keys are checked.

* Clean up the unmunge function slightly
2018-07-19 02:03:43 -05:00
penrods b005ba6f59 Allow dialog param of get_response() to be a spoken string
This makes the dialog parameter dual-purpose.  It can be used as a
literal spoken string, or a dialog resource.  In the future the
announcement parameter can be retired.
2018-07-19 02:00:17 -05:00
Matthew D. Scholefield 0540229cc4
Merge branch 'dev' into feature/cleanup-setup 2018-07-18 10:44:41 -05:00
penrods 18ab343b80 Add new MycroftSkill.ask_yesno() method
New function allows simple yes/no queries to be asked, capturing common
affirmations (e.g. "yes", "yeah", "yep", "sure", ...) and rejections
("no", "nope", ...) that are consistent across all skills.

The method will return a normalized 'yes', 'no' or whatever else is spoken
for further parsing.  None is also possible.

This also adds the MycroftSkill.is_match() method to assist in matching
translated synonyms within an utterance.
2018-07-17 01:35:55 -05:00
Åke 9c8c6b8852
Merge pull request #1686 from JarbasAl/feature/padatious_enable_disable
Make it possible to enable/disable padatious intents
2018-07-14 11:52:12 +02:00
JarbasAI 0e121f8bcd allow disabling intent registered with decorator in initialize (#1685) 2018-07-14 11:36:16 +02:00
Åke Forslund fad890ff39 Clean up setup scripts
- Remove setup scripts for mycroft-skills-sdk since it's not used anymore
- Rename mycroft-base-setup.in/MANIFEST.in to setup.py and MANIFEST.in
- Remove skill-container, since it hasn't been used or kept up to date since 17.08 and the cli commands to remove and activate skills is easier to work with

==== Environment Notes ====
Small update of the packaging script is needed due to this change
2018-07-14 08:36:50 +02:00
jarbasal 56efe5e489 padatious enable/disable 2018-07-14 04:31:39 +01:00
jarbasal c4cdb85599 padatious enable/disable 2018-07-14 04:00:21 +01:00
penrods e0dc373915 Fix crash during initial skill download
When running on a platform for which there was not DEFAULT.platform
file in the mycroft-skills repo, the downloading of skills would
crash.  Now an informational message is shown and the DEFAULT
skills alone are loaded.
2018-07-06 01:42:16 -05:00
Steve Penrod 17aab53fae Enhance the behavior of the Mark 1 button (#1668)
The Mark 1 button press can now be "consumed" when a skill handles
the Stop command.  When this happens, the button press will not
trigger listening mode.  An additional press would be needed to
trigger listening.

This introduces the "mycroft.stop.handled" messagebus message.  It
carries a data field called "by" which identifies who handled it.
Currently the values are "TTS" for when speaking ends or the name
of a skill which implements Stop and returns True from the call.

Also fixed a potential bug when the flag to clear queued visemes
was left set after a button press.
2018-07-05 20:56:54 +02:00
Åke b1408617bc CLI Feature: skill commands (#1612)
* Update format for skill listing

Now send the skills with id and active status

* Add commands to activate/deactivate skills

* Add "unload all except one" functionallity

* Update after rebasing

- fix identifying skills

* Unload skills if they're removed from disk

* Rename _shutdown to default_shutdown

The method is not intended to be non-public, and this should shut up
codacy bot.

* Handle keep command without argument

* Add new commands to help

- Split help into multiple pages as needed

* Support :activate all
2018-06-22 00:59:51 -05:00
Matthew D. Scholefield abd1fe7571
Merge pull request #1637 from forslund/feature/remove-monotonic
Use time.monotonic instead of monotonic module
2018-06-14 14:59:13 -05:00
Åke 3a22eea5ba
Merge pull request #1636 from MycroftAI/feature/upgrade-msm-padatious
Upgrade msm and padatious
2018-06-13 07:44:16 +02:00
Matthew D. Scholefield 85df3adbb0 Remove Padatious version check
No longer necessary now that we notify users when dependencies are out of date
2018-06-12 16:10:26 -05:00
f-e-l-i-x b239d3dc2f German language support (#1634)
* Add parse and format functions for german
* Add german dialog files
2018-06-12 08:55:21 +02:00
Åke Forslund be8711a438 Use time.monotonic instead of monotonic module
Replace the monotonic time from the monotonic module with the built in time.monotonic
2018-06-11 16:05:50 +02:00
Michael Nguyen 0e1307ddf3
Merge pull request #1622 from MycroftAI/bugfix/e.message
Fix missing attribute in error
2018-06-05 16:01:55 -05:00
Åke Forslund dabc92a9b9 Handle unbuilt AdaptIntents
Switched type(intent) == IntentBuilder to isinstance(intent, IntentBuilder) to handle all derived types.
2018-06-02 08:56:15 +02:00
Matthew D. Scholefield dbdd67f965 Add AdaptIntent alias
It is used so that the init argument isn't required and so that it is imported from within the mycroft module
2018-06-01 20:01:25 -05:00
Matthew D. Scholefield 0a3f743b23 Fix missing attribute in error 2018-06-01 16:11:14 -05:00
Åke a0b0e99ffb
Merge pull request #1592 from MycroftAI/bugfix/skills-dir
Remove all references to /opt/mycroft/skills
2018-05-24 07:29:53 +02:00
Matthew D. Scholefield 509162de50 Support tilda in data_dir 2018-05-23 15:03:01 -05:00
jarbasal 0dee4af24c keep message context 2018-05-23 16:08:22 +02:00
Matthew D. Scholefield b0b88bbd62 Remove all references to /opt/mycroft 2018-05-23 08:22:14 +02:00
Matthew D. Scholefield 14ceb1f1dd Remove all references to /opt/mycroft/skills
The only thing that should reference it is the config
2018-05-23 08:22:14 +02:00
Åke 52abe14209
Merge pull request #1601 from MycroftAI/bugfix/retry-less
Make retrying skill installation less frequent
2018-05-22 17:00:39 +02:00
Åke 1f630f6815
Merge pull request #1527 from MycroftAI/feature/improved-skill-tester
Feature/improved skill tester
2018-05-21 16:13:32 +02:00
Matthew D. Scholefield 457ed15b05 Make retrying skill installation less frequent
This prevents things like modifying a default skill from causing skill updates once every 5 minutes
2018-05-17 23:03:50 -05:00
Matthew D. Scholefield 596834dbc8 Retry skill installation every 5 minutes if default skill install fails
This prevents errors with having a spotty internet connection during default skill installation
2018-05-17 17:23:49 -05:00
Matthew D. Scholefield f3ed6065c5 Check for uuid in response
If the meta already exists on the server, it won't have a uuid field in the response
2018-05-15 16:49:03 -05:00
Matthew D. Scholefield b36408dc39 Log exception in skill settings and fix docstrings 2018-05-15 15:58:36 -05:00
Matthew D. Scholefield afe8641159 Stability improvements 2018-05-14 16:41:19 -05:00
Åke ad487cc9fc
Merge pull request #1586 from MycroftAI/feature/configurable-update-interval
Make skill update interval configurable
2018-05-14 22:39:26 +02:00
Matthew D. Scholefield d6f5dd95c5 Make skill update interval configurable 2018-05-14 15:21:36 -05:00
Matthew D. Scholefield 79bf94e48e Speed up intent tests by responding to converse requests 2018-05-14 14:27:37 -05:00
Matthew D. Scholefield 154ccd59d7 Expose single threaded training option from Padatious Service
This is necessary to prevent a deadlock when training during intent tests using pytest
2018-05-14 14:27:37 -05:00
Matthew D. Scholefield d1358cc0fc Fix skill reloading when files in subdirectories change 2018-05-11 12:04:30 -05:00
Åke Forslund 0087803d5d Fix trying to make integer from skill-id
skill id's are now the skill path, and can't be made into integers. This issue hinders padatious skills from running.
2018-05-11 10:30:06 -05:00
Matthew D. Scholefield fc8424c9ee Make skill ids use skill folder
This is necessary because in Python 3, hash(x) changes every single start of the application. Using the skill folder makes it consistent. In addition, the skill folder makes it easier to debug parts of the application in comparison to using something like an md5sum
2018-05-10 18:52:17 -05:00
Matthew D. Scholefield 033f5dc010 Add configuration values for msm 2018-05-10 13:11:03 -05:00
Åke 98ede52596
Merge pull request #1572 from MycroftAI/feature/py_msm
Cleanup skill loading and implement python msm
2018-05-09 23:25:40 +02:00
Matthew D. Scholefield 6ecf4d986f Reinstall pip dependencies if virtualenv is removed
This keeps track of the skills whose dependencies have already been installed. While it won't automatically register newly installed skills, it will attempt to reinstall dependencies the next boot only one time so it shouldn't be a big issue.
2018-05-09 16:07:04 -05:00
Matthew D. Scholefield e86e0546d7 Make settings meta hashes consistent
str(dict) in python in implementation defined. json.dumps(..., sort_keys=True) is not
2018-05-08 17:17:45 -05:00
Matthew D. Scholefield c301a3ca4d Change skill settings hash to use skill name
This prevents issues with the skill settings being dependent on skill folders. This is an issue because the new msm has a new skill naming scheme
2018-05-08 16:23:53 -05:00
Matthew D. Scholefield a20b5b565c Cleanup skill loading and implement python msm 2018-05-08 13:41:51 -05:00
Åke Forslund 61aeeb8c00 Fix issue using basestring
Checking against basestring was necessary in python two since unicode and string were separate classes. In python3 basestring was removed since different string classes have been removed.
2018-05-04 11:42:13 +02:00
Åke Forslund 8c5911ecf0 Fix code standard issues
- dev_setup.sh - replace `` with $()
- mycroft/skills/core.py remove remove redundant imports
- mycroft/tts/__init__.py remove remove redundant imports
2018-05-03 12:32:21 +02:00
Åke Forslund 5d50d22061 Fix listing skills
python3 dict_keys can't be serialized to json, and needs to be
explicitly converted to list
2018-05-02 08:35:17 +02:00
Matthew D. Scholefield 82a61c76c7 Fix infinite skill reloading by disabling folder checks
Python 3 modifies the __pycache__ folder which makes the parent folders update their timestamps causing an infinite skill reload
2018-04-27 11:44:07 -05:00
Matthew D. Scholefield 0abc3c78b1 Fix counting function arguments in Python 3 2018-04-27 11:42:54 -05:00
Åke Forslund 5447983999 Use sorted json to perform hash of settings 2018-04-27 08:57:48 -05:00
Åke Forslund a2993e4ba6 Remove backwards compatibility with python 2.7 2018-04-27 08:51:47 -05:00
Åke Forslund b200d51d39 Fix test cases under python 3
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
2018-04-27 08:50:46 -05:00
Åke Forslund 8840a43886 Fix hashes in settings for python3
convert strings to bytes before hashing
2018-04-27 08:50:46 -05:00
Sergio Oller 5e8d8eb1a6 Feature: Allow comments in voc and regex files
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 ====
2018-04-14 21:53:14 +02:00
Åke aa4261252b
Merge pull request #1519 from MycroftAI/feature/stop-sigint
Shutdown improvements
2018-04-12 12:07:02 +02:00
Åke Forslund d61e3c2dd0 Extra safety around skill specific shutdown
Catch error in shutdown method of skill and continue with general shutdown
2018-04-12 11:11:04 +02:00
Matthew D. Scholefield fa11ac7dbe Rename MycroftSkill.shutdown to MycroftSkill._shutdown
This removes the need for skills to call Super(MySkill, self).shutdown()
2018-04-11 21:29:14 -05:00
Matthew D. Scholefield 10bd9a1cf3 Change initial kill to SIGINT
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
2018-04-11 21:29:10 -05:00
Matthew D. Scholefield 2e005a99e8 Support triggering skill settings update via a message 2018-04-11 15:24:07 -05:00
Matthew D. Scholefield 8cd8eb65b1 Decrease polling to 60 seconds
Now that the server uses ETags, it should be fine with polling every minute
2018-04-11 15:24:07 -05:00
Michael Nguyen 3e2f008c12
Merge pull request #1523 from forslund/bugfix/shutdown-sheduled-events
Fix cancel_all_repeating_events()
2018-04-10 11:15:11 -05:00
Åke 6d339039de
Merge pull request #1524 from forslund/feature/Jarbas-messagebus-intent-control
Add enable/disable intent using the messagebus.
2018-04-06 13:37:24 +02:00
Åke Forslund 58325a83fd Fix cancel_all_repeating_events
Unnamed repeating events caused an exception in
cancel_all_repeating_events, this makes sure the event name is stored
correctly and fixes the issue.
2018-04-06 11:34:36 +02:00
Jarbas 9f1c5e4cbf External enable/disable intent
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
2018-04-05 23:29:44 +02:00
Greg Cowan dfa9a65e96 Default skill config to empty dict (#1521)
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.
2018-04-04 23:12:55 -05:00
Åke bc74c36713
Merge pull request #1508 from MycroftAI/feature/notify-backend-down
Add proper messages when the backend replies incorrectly
2018-03-29 12:53:34 -05:00
Matthew D. Scholefield eb100706df Add proper messages when the backend replies incorrectly 2018-03-28 11:48:05 -05:00
Michael Nguyen 2caf77bc9d
Merge pull request #1481 from forslund/feature/repeating-event-safety
Feature/repeating event safety
2018-03-27 19:15:32 -05:00
Åke eac0d81e94
Merge pull request #1502 from JarbasAl/bug_fix_audio_service_old_class_style
AudioService - no old style class
2018-03-23 13:17:04 -05:00
jarbasai 8cf915b83e no old style class 2018-03-23 15:07:21 +00:00
InconsolableCellist 7447dbd5ea Simple log output change to prevent confusion (#1497)
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
2018-03-22 13:18:11 -05:00
Michael Nguyen d6b4037258 remove unused function in skill settings 2018-03-21 14:49:31 -05:00
Åke Forslund 764d200d1b Only allow one repeating even of each type
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.
2018-03-15 12:39:25 +01:00
Åke Forslund 6dae1bb328 Do not reschedule an active repeating event
- Hinder multiple events with the same name to be registered
- Automatically cancel repeating events when skill is shutdown
2018-03-15 11:42:08 +01:00
Steve Penrod 8ef691ffb7
Slowing the skill setting poll to once every 5 min
Experiment to see if this is overloading the backend.
2018-03-14 03:37:57 -05:00
Michael Nguyen b884378fbb
Merge pull request #1466 from forslund/feature/quieter-skill-fetching-error
Reduce verbosity when skill settings fetch fails.
2018-03-11 12:34:07 -05:00
Åke Forslund 65cba626fd Reduce verbosity when skill settings fetch fails.
Replace the stack trace with a shorter message, briefly printing the cause.
2018-03-11 17:05:52 +01:00
Åke 2c151fe594
Merge pull request #1458 from MycroftAI/refactor/handler-args
Refactor event handler argument calling
2018-03-08 08:29:40 +01:00
Åke Forslund b4ed9369fd Handle exception in skill shutdown
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
2018-03-07 13:23:45 -06:00
Åke Forslund 11bae2aea3 Fix issue in skill shutdown.
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.
2018-03-07 13:23:45 -06:00
Matthew D. Scholefield 0962a3b6af Fix potential crash in add_event 2018-03-07 10:13:20 -06:00
Matthew D. Scholefield 4131730089 Refactor handler argument calling 2018-03-07 10:12:13 -06:00
Åke 2719f96950
Merge pull request #1454 from MycroftAI/bugfix/intent-mixups
Use function attributes for intent decorators
2018-03-01 08:37:45 +01:00
Åke 5a68908e80 Call callback when remote settings are inited (#1452)
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.
2018-03-01 01:07:55 -06:00
Matthew D. Scholefield 881687012e Train Padatious on mycroft.skills.initialized (#1455)
Fix sporadic issues from training prematurely.
2018-02-28 21:55:14 -06:00
Matthew D. Scholefield 07ce2d98d0 Use function attributes for intent decorators
This prevents needing to use a shared list which misbehaves when multiple skills initialize at once
2018-02-28 19:13:33 -06:00
Matthew D. Scholefield cdb1416252 Check for pairing before performing routine polling (#1451)
This gets rid of error messages during the pairing process
2018-02-28 15:41:23 -06:00
Zachary T Welch a7044f9967 only NTP sync on certain enclosures 2018-02-27 18:00:33 -06:00
Åke 743082734c Fix multiple triggering of repeating events (#1435)
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.
2018-02-27 16:37:29 -06:00
Matthew D. Scholefield ce908b6098 Add message when skills are initialized (#1449)
Posts ```mycroft.skills.initialized``` once the initial skill load completes.
2018-02-27 16:22:40 -06:00
Matthew D. Scholefield efc1c1d71e Wait while speaking before running __get_response (#1432)
This fixes issues with long TTS responses
2018-02-23 01:49:06 -06:00
Åke b58a533e39 Bugfix/munging related issues (#1434)
* 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
2018-02-23 00:51:55 -06:00
Matthew D. Scholefield b57165477c Fix self parameter in decorator functions with single argument 2018-02-15 17:33:03 -06:00
Åke Forslund 7970f5bc9d optional start/completed messages for add_event
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)
2018-02-15 15:31:33 -06:00
Åke ea7c7efee1 Fix cancel_scheduled_event for non-repeating events by updateing pyee to v5.0.0 (#1425)
* 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.
2018-02-15 14:52:18 -06:00
Åke b4c6f63352 Validate message before trying to demunge (#1427)
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.
2018-02-15 14:11:21 -06:00
penrods f54eacbd53 Add default when for schedule_repeating_event()
MycroftSkill.schedule_repeating_event(handler, when, frequency) now
will compute the 'when' as now+frequency seconds if None is passed.
2018-02-15 05:40:38 -06:00
Åke 7fd63f9d5a
Merge pull request #1421 from MycroftAI/feature/doc_cleanup
Internal documentation, typos, remove misleading message
2018-02-15 10:51:33 +01:00
Åke 3271ff3e24
Merge pull request #1420 from MycroftAI/feature/cli_declutter
Reduce CLI log clutter from settings, etc
2018-02-15 10:31:51 +01:00
Åke ed6ab224c9
Merge pull request #1422 from forslund/feature/munge-keywords
Make keywords per skill to fix overlapping keyword names
2018-02-15 09:57:03 +01:00
Steve Penrod 8139727714
Merge branch 'dev' into feature/doc_cleanup 2018-02-15 02:48:10 -06:00
Åke bda8a0cc94 Skip skill update on startup if recent (#1392)
* 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)
2018-02-15 02:43:06 -06:00
Steve Penrod 23302b60d9 Add copyright notice and minor docstring changes 2018-02-15 09:29:04 +01:00
Åke Forslund 378d353572 Move data loading helpers to separate file.
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.
2018-02-15 09:28:27 +01:00
Åke Forslund 51ed5cd810 Munge keywords for intents
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
2018-02-15 09:26:35 +01:00
penrods 2af217bed0 Wrote and cleaned up more docstrings
Made docstrings more consistent with the preferred 'Google Style Docstring'
standard:
http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
2018-02-14 17:25:57 -06:00
Michael Nguyen 50c7ab6c6e
Merge pull request #1364 from forslund/bugfix/scheduled-event
Bugfix/scheduled event
2018-02-13 22:34:51 -06:00
penrods fa589fead4 Quiet PEP8 2018-02-13 03:05:43 -06:00
penrods c68ad44b1c Internal documentation, typos, remove misleading message
* 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
2018-02-13 02:54:12 -06:00
penrods 920845c407 Reduce CLI log clutter from settings, etc
* Drop settings INFO messages to DEBUG
* Add DEBUG filter in the CLI by default
2018-02-13 02:40:44 -06:00
Åke Forslund b632377e0e Check that value exists before checking for change
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.
2018-02-02 15:03:41 +01:00
Michael Nguyen 9c80112fd9 added fix for new schema from backend 2018-02-01 18:44:21 -06:00
Åke 0e3acbada4 add :skills command to list skills in cli (#1395)
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
2018-02-01 02:14:38 -06:00
Åke 2309c9cd33
Merge pull request #1397 from MycroftAI/bugfix/skill-settings-disappearing
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.
2018-02-01 08:56:21 +01:00
Åke b8893a7643 Ignore .files when checking for skill modification (#1378)
This ignores all files starting with . when checking for modifications
of skills
2018-02-01 01:53:57 -06:00
Michael Nguyen 9af4b95650 modified identifier, add .mypy_cache to git ignore 2018-01-31 09:42:44 -06:00
Åke Forslund acdeb0853e Minor fix for code coherency 2018-01-31 15:26:24 +01:00
jarbasai 98960012bb add skill load fail message 2018-01-31 14:58:04 +01:00
jarbasai 93860da4a0 loaded skills bus messages 2018-01-31 14:57:50 +01:00
Åke Forslund aab426a140 Add settable callback on change from backend
If settings are updated a callback can be set to notify the skill that a
change has occured.
2018-01-23 17:12:09 +01:00
penrods 26444c9c5f Tweak UI for NTP checking
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.
2018-01-18 14:44:53 -06:00
penrods a6bfed268b Fix Codacy gripe and add new .dialog 2018-01-17 21:16:39 -06:00
penrods 6c1cdb47b3 Fix startup time-warp issue
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
*
2018-01-17 21:05:51 -06:00
Åke Forslund 6c4f485323 Make handlers for single scheduled events one shot
- 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
2018-01-16 17:39:51 +01:00
Åke Forslund f88acdb60f Fix converse handling
Fallbacks were triggered even if utterance had been handled by converse.
This checks if converse handled the utterance as well.
2018-01-08 18:01:03 -06:00
Åke Forslund 936bd54180 Add a function to build the standard timing report 2018-01-08 18:01:03 -06:00
Åke Forslund fe3b85c755 Add tts into the flow by digging throug the stack
The speak method digs through the stack trying to find a Message object
and if found uses the context from that message when sending the data to
the speech subsystem.
2018-01-08 18:01:03 -06:00
Åke Forslund baa15b98aa Send timing metrics for various subsystems
====  Tech Notes ====
STT, intent handling, intent fallbacks, skill handlers are now timed and
tied together with a ident (consistent through the chain so the flow from
STT until completion of the skill handler can be follewed.

TTS execution time is also measured, right now this is not tied into the
ident due to the nature of the speech.

The report is always called "timing" and always contain the following
fields:

- id: Identifier grouping the metrics into interactions
- system: Which part (STT, intent service, skill handler, etc)
- start_time: timestamp for when the action started
- time: how long it took to execute the action

The different system adds their own specific information, for example
the intent_service adds the intent_type, i.e. which handler was matched.

==== Protocol Notes ====
mycroft.skills.loaded is sent togheter with skill id and skill name
whenever a skill is loaded. This is used in the intent_service to
convert from id to skill name when reporting
2018-01-08 18:01:03 -06:00
Michael Nguyen 5d842fd369 removed log line 2018-01-08 17:02:49 -06:00
Michael Nguyen 884b65f0e4 fixed settings disappearing on load 2018-01-08 17:02:49 -06:00
Åke Forslund b19e73025f Minor cleanup 2018-01-03 10:09:34 +01:00
jarbasai 6bba0f0ae4 Optional auto update 2018-01-03 10:09:25 +01:00
Michael Nguyen 8e2c97484c fixed skill settings migration for web ui 2017-12-20 15:59:09 -06:00
Åke 742558046d Python 2/3 compatibility (#1259)
Add Python 2/3 compatibility

====  Tech Notes ====
This allows the main bus, skills and cli to be run in both python 2.7 and
3.5+.

Mainly trivial changes
- syntax for exceptions
- logic for importing correct Queue module
- .iteritems -> future.utils.iteritems when accessing dicts key value
pairs

* Allow audio service to be run in python 3
* Make speech client work with python 3
* Importing of Queue version dependent
* Exception syntax corrected
* Creating sound buffer is version dependant
- Adapt context use range from builtins
- Use compatible next() instead of .next() when walking the skill
directory

* Make CLI Python 3 Compatible
- Use compatible BytesIO instead of StringsIO
- Open files as text instead of binary
- Make sure integer divisions are used

* Make messagebus send compatible
* Fix failing travis

Re-add future 0.16.0

* Make string checks compatible
* basestring doesn't exist in python 3 so it's imported from the "past"
* Fix latest compatibility issues in speech client
- handle urllib
- handle encoding before calling md5

* Make Api.build_json() python 2/3 compatible
2017-12-18 17:24:21 -06:00
Åke Forslund 9fa4b4e138 Empty except->except Exception:
This fixes pep8-speak issue
2017-12-15 12:40:41 +01:00
penrods de328a43d9 Fix PEP8 2017-12-15 05:19:11 -06:00
penrods 0385f46fcc Add MycroftSkill.translate_namedvalues()
This method will load a translateable (and expandable) list of names
and values from the dialog/xx-xx/ folder of a skill.  For example:

dialog/en-en/Colors.value
```
# List colors and their hex RGB values
alice blue, #F0F8FF
antique white, #FAEBD7
aqua, #00FFFF
```
2017-12-15 05:07:16 -06:00
Michael Nguyen 4b7d6e5526 Feature/overwritten settings (#1304)
prevent settings initalization from skills __init__ to override settings.json values
2017-12-13 23:25:33 +01:00
Michael Nguyen 0bbb05ddd2
Merge pull request #1300 from MycroftAI/feature/meta-crashes
Protect against bad settingsmeta.json
2017-12-13 10:50:54 -06:00
Matthew D. Scholefield b70a3f488e Fix bug in rendering data in __translate_file 2017-12-12 13:47:01 -06:00
Steve Penrod 168b6b4dd5 Protect against bad settingsmeta.json
When there is an error in settingsmeta.json, the load of the skill
would fail.  Now it generates an error message but continues on.
Additionally the exception is caught and now displays information
about where the error in the JSON is (line and column).
2017-12-10 04:48:12 -05:00
Michael Nguyen 136f1af8c3 Bugfix/polling fixes (#1296)
* fixed identifier to be unique across all accounts

* now skills will load on http error and skills will upload once to web once identity2 exist

* extracted stuff out of __init__ so that skills work on load and skills get upload when identiy2 exists

* iniatiated class attribute to None
2017-12-08 21:27:06 -06:00
Michael Nguyen 9ca6f89d69 fixed identifier to be unique across all accounts (#1295)
Now composed by user-uuid, settingsmeta-hash and skill-folder
2017-12-08 22:03:34 +01:00
Åke 21f20b9722
Merge pull request #1294 from MycroftAI/bugfix/settings_update_remote
Add missing variables, check settingsmeta
2017-12-08 21:03:57 +01:00
Michael Nguyen c0de5bcaaf added control flow for settings_meta not existing 2017-12-08 12:34:08 -06:00
Michael Nguyen 6c3c64b041 added missing variable fixes 2017-12-08 11:17:54 -06:00
Åke Forslund dd9135cfbb Handle failure in _save_uuid 2017-12-08 15:22:47 +01:00
Steve Penrod 5b960ca20f Reworked documentation at top of file 2017-12-07 17:11:41 -06:00
Michael Nguyen 5b19892de2 added fix for ake 2017-12-07 17:11:41 -06:00
Michael Nguyen cecf4609f0 added language to explain functionality, and fixed some spelling issues 2017-12-07 17:11:41 -06:00
Michael Nguyen dada5b71aa pep8.. 2017-12-07 17:11:41 -06:00
Michael Nguyen 0c430778cc add missing str() transformation 2017-12-07 17:11:41 -06:00
Michael Nguyen 2e561f8a52 namin conventions... 2017-12-07 17:11:41 -06:00
Michael Nguyen e4bfea9cc0 added new public function update and fixed naming conventions 2017-12-07 17:11:41 -06:00
Michael Nguyen 34da54b266 changed doc string language v3 2017-12-07 17:11:41 -06:00
Michael Nguyen 89e78cd37f changed doc string language v2 2017-12-07 17:11:41 -06:00
Michael Nguyen 5802587741 changed doc string language 2017-12-07 17:11:41 -06:00
Michael Nguyen f95aed1ad3 added ability to change settings from device that created the skill settings 2017-12-07 17:11:41 -06:00
Michael Nguyen 2dc5348b93 bug fix 2017-12-07 17:11:41 -06:00
Michael Nguyen f4b8e2b4e1 Global Sync for skill settings
====  Tech Notes ====
Share settings across devices
2017-12-07 17:11:41 -06:00
Steve Penrod 50a5b21482 Rename method for the nitpicky ;) 2017-12-07 16:11:35 -06:00
Steve Penrod 522511e0c6 Extend timeout, randomize repeat announcement
Extended the timeout to longer than the listener default (in case of
operating in a noisy environment).
2017-12-07 16:11:35 -06:00
Steve Penrod 9f3269100b Remove unused 'isfile' import 2017-12-07 16:11:35 -06:00
Steve Penrod b145e149e6 Tweak get_response() doc and behavior
Several minor documentation changes, plus:
* 'cancel' now has to be an exact match
* Cancel events return None instead of the spoken cancelation string
* Reduced timeout to 10 seconds instead of 20
* Changed 'text' to 'announcement' and simplified logic
2017-12-07 16:11:35 -06:00
Matthew D. Scholefield 35d057ff9b Add get_response method as a synchronous alternative to converse 2017-12-07 16:11:35 -06:00
Åke Forslund 0a0fd8d3c5 Only show reference counting if debugging is set
Since the garbage collection can be on a bit on the slow side it
shouldn't be done at a normal user's device.

A developer can still enable this by setting the configuration flag
"debug" to true.
2017-12-07 10:52:14 -06:00
Åke Forslund 3dde676424 Make reference leak detection more reliable
The reference count sometimes reported that references were remaining
even if they actually weren't. By enforcing a garbage collector run
after shutting down a skill the false possitives are reduced if not
removed all together.
2017-12-07 10:52:14 -06:00
penrods fdafab8d63 Edit docstrings to match style guidelines 2017-12-07 01:42:07 -06:00
Matthew D. Scholefield caf26bd8ea Add helper translate methods to MycroftSkill 2017-12-07 01:42:07 -06:00
Åke deb2b56464
Merge pull request #1280 from MycroftAI/feature/default-intent-name
- Add support for unnamed intents.
- Add more debugging information for skill handler errors
- Clean up skill name for pronounciation
- Update docstring for initialize method
2017-12-06 11:08:27 +01:00
penrods 4555e3f697 And a PEP8 error... 2017-12-06 03:57:56 -06:00
penrods 49062bfa59 Fix based on review, improve error handling
Corrected my refinement after a previous review.

Also added support for splitting the name of a skill before running it through
TTS, making "VolumeSkill" sound like "Volume Skill" and such.  Plus a log
message before raising some errors in the skill wrapper.
2017-12-06 03:55:54 -06:00
penrods 0ca157685c Refined comments and made implementation more Pythonic 2017-12-05 17:57:28 -06:00
penrods 553b95643e Add support for unnamed intents
This allows skill writers to ignore naming intents.  Combined with a
forthcoming change to Adapt that creates a default of None for IntentBuilder()

This allows the current:
    @intent_handler(IntentBuilder("CurrentWeatherIntent").require(
        "Weather").optionally("Location").build())
    def handle_current_weather(self, message):
        ...

To become:
    @intent_handler(IntentBuilder().require("Weather").optionally("Location"))
    def handle_current_weather(self, message):
        ...

Which will automatically name the Intent "handle_current_weather".

Also dropped the log message in the default initialize() method since it is
common to not override it now.
2017-12-05 11:18:12 -06:00
Matthew D. Scholefield 7f7d8f703c Fix skill metrics 2017-12-01 15:17:40 -06:00
Matthew D. Scholefield be638de12b Add general metrics 2017-11-22 23:39:14 -06:00
gaurav 3a40014122 Issue-1227 Fix arg =[] and ={}
Issue-1227 fixed line length

Issue-1227 fixed pep 8 E124

Issue-1227 fixed formatting
2017-11-22 23:17:16 -06:00
Michael Nguyen 689687ef60
Merge pull request #1249 from MycroftAI/feature/namless-label
Allow name-less label in settingmeta.json
2017-11-22 16:07:16 -06:00
penrods c8a0cffa53 Allow name-less label in settingmeta.json
A type='label' field in the settingmeta.json might not have a field name,
which was causing a crash.
2017-11-22 15:34:40 -06:00
Michael Nguyen 4c6b57c5c5
Merge pull request #1197 from forslund/feature/audioservice-update
Feature/audioservice update
2017-11-22 13:27:15 -06:00
Matthew D. Scholefield 0cf5c44f7c Add send_email method to skills 2017-11-22 13:03:50 -06:00
Åke Forslund bfa26e6916 Fix issues reported by codacy 2017-11-10 10:24:59 +01:00
Åke Forslund 441436adbf Add queue command to audio service
==== Tech Notes ====
queue command will start playback if no playback is running.
mpg123 and vlc services updated support queueing tracks while playing

==== Protocol Notes ====
mycroft.audio.service.queue message added
2017-11-10 10:24:59 +01:00
Åke Forslund 7699da9b84 Minor corrections of settings docstrings 2017-11-09 13:43:04 +01:00
Åke Forslund 8da1589ce2 Fix pep8 issues 2017-11-09 13:24:42 +01:00
penrods bf61cae4de Add optional skill announcement message
A Skill can now implement the get_intro_message() method, which can return a
string to be spoken the very first time a skill is run.  This is intended to
be an announcement, such as further steps necessary to setup the skill.

Also stopped generation of the Error message when the expected StopIteration
occurs on a intent failure.  This confused new developers and poluted the logs.

Finally, corrected some documentation typos.
2017-11-09 04:34:00 -06:00
Åke a6cbe4539e
Merge pull request #1195 from akailash/dev
Adding a stop() function to audioservice.py
2017-11-08 00:02:37 +01:00
Åke Forslund 9050bad696 Add some more docstrings 2017-11-03 08:10:12 +01:00
Åke Forslund 3004aada98 Add test cases for EventScheduler class
====  Tech Notes ====
- Add test cases
- Slight refactoring of EventScheduler class to make it easier to test
2017-11-03 08:10:12 +01:00
Michael Nguyen 28e0ae9200
Merge pull request #1198 from MycroftAI/bugfix/active-skills
Fix Padatious problems
2017-11-02 16:56:35 -05:00
Matthew D. Scholefield 9d9d615904 Increment Padatious version to 0.3.7 2017-11-02 15:21:47 -05:00
Michael Nguyen 228758975d fixes 2017-11-02 14:57:13 -05:00
Michael Nguyen 369de8a4d2 added error handling and changed function names to be more expressive 2017-11-02 12:34:05 -05:00
Anu 482f1b1619 Fix #1194 2017-11-02 08:57:54 +09:00
Matthew D. Scholefield 384c66cbd2 Fix active skills for Padatious 2017-11-01 16:55:07 -05:00
Michael Nguyen c80a320a5f removed unused import 2017-11-01 12:41:51 -05:00
Michael Nguyen d5473c09c2 removed self reference, added timeout and raise excewption on timeout 2017-11-01 12:37:07 -05:00
Michael Nguyen a7596988a7 added mechanism to query event status 2017-10-31 19:27:58 -05:00
Michael Nguyen b7844df596 bug fixes 2017-10-31 12:54:24 -05:00
Michael Nguyen f9ce4f5358 made variables more expressive 2017-10-30 08:17:46 -07:00
Michael Nguyen 1d14929590 Added remove_event skills/core.py
====  Tech Notes ====
This allows you to remove message bus messages inside core.py. When canceling scheduling events, the message bus messages were not removed which could caused duplicate listeners and handlers for the same intent. Adding remove_event function removes the actual messages from the bus to prevent potential duplicates.
2017-10-30 08:13:44 -07:00
Åke 0afc56beeb
Merge pull request #1183 from MycroftAI/feature/quiet-no-internet
Fix no-internet prompt
2017-10-28 10:24:15 +02:00
Åke Forslund 92f25f2922 Remove Location as a default context word
====  Tech Notes ====
Location was added as a default context keyword when the context manager
was added as an example of how the context feature could be used.
However in the current greedy implementation in can cause some confusion
with lingering context providing incorrect Location.

The feature can still be turned on in configuration if someone wants to
experiment with it.
2017-10-28 03:21:02 -05:00
penrods 0986df6b4b Fix no-internet prompt
The prompt during skill downloads was occurring even when the "speak" flag was
set to False.  Now it is honored.

Also removed the "no network connection.dialog" which essentially was a copy of
the "not connected to the internet.dialog" file.
2017-10-28 03:14:22 -05:00
penrods 147bbd2dd7 Fix for Configuration.get()
Several more Configuration.get() mistakes corrected.
2017-10-28 01:41:39 -05:00
Åke Forslund 1f4c98f29c Fix PEP-8 2017-10-26 19:02:32 -04:00
Åke Forslund 3e878bd59f Replace ConfigurationManger with Configuration 2017-10-26 19:02:32 -04:00