Commit Graph

2686 Commits (10b8e93b7419126864d9bab2effbe813962865ee)

Author SHA1 Message Date
Kris Gesling 0197a7ee39 frames to read must be greater than 0 2019-11-01 08:13:26 +01:00
Chris Veilleux 183649ac5e Merge remote-tracking branch 'remotes/origin/dev' into feature/geolocation-api 2019-10-31 13:11:58 -05:00
Åke Forslund 3e905165e6 Fix Shutdown of removed skills
Verify that skill directory exists before writing to ensure that the
shutdown method doesn't throw exception if a skill is unloaded due to
being removed.
2019-10-31 11:40:41 +01:00
Åke 024274a5ca
Merge pull request #2372 from forslund/feature/speech-error-handling
Speech client error handling
2019-10-31 10:01:45 +01:00
Åke Forslund 3aea18c7be fix remove_all_events
The threaded event emitter did not remove the wrapper mapping when
remove_all_events were called causing trailing references to objects.
2019-10-31 09:42:24 +01:00
Åke Forslund d4a7193fe8 Remove circular reference during skill shutdown
This cleans up the extra skills references making the ref count trigger
correctly.
2019-10-31 09:38:46 +01:00
Åke 5f1cc40d0e
Merge pull request #2374 from forslund/feature/tts-create-error-handling
Fallback to Mimic if launch of TTS fails
2019-10-29 14:03:43 +01:00
Åke Forslund 39a38bc641 Move send function away from __main__ file
This resolves the Runtime Warning "'mycroft.messagebus.send' found in sys.modules after import of package 'mycroft.messagebus', but prior to execution of 'mycroft.messagebus.send'; this may result in unpredictable behaviour"
2019-10-29 09:14:49 +01:00
Åke Forslund c8328526b1 Fallback to Mimic if launch of TTS fails
Logs the exception and fallsback to Mimic as TTS backend if there is an
issue with the selected TTS backend or if the choice is invalid.
2019-10-28 14:20:01 +01:00
Åke Forslund 8d4413db9c Update account id fetching
Account ID will now be refetched if invalid the first time.

This also adds some general exception handling to avoid client crashing due
to the servers invalid 204 response.
2019-10-26 09:35:03 +02:00
Åke Forslund 8bdeddb965 Catch and log errors starting up the speech client 2019-10-26 09:34:28 +02:00
Åke Forslund 741cc1c8db Fallback to default STT if loading fails
If a STT backend fails to load log the exception and fallback to the
MycroftSTT.
2019-10-26 09:30:07 +02:00
Åke Forslund 0811df3831 Don't load remote settings for send command 2019-10-25 14:04:23 +02:00
devs-mycroft a3e35d736b Version bump from 19.8.1 to 19.8.2 2019-10-21 13:51:34 +00:00
Åke f234354783
Merge pull request #2365 from forslund/bugfix/lock-mic-mute-unmute
Lock mic mute unmute
2019-10-20 14:12:53 +02:00
Åke 2c1367f6f8
Merge pull request #2368 from MycroftAI/feature/restart-mic
Feature/restart mic
2019-10-20 14:06:06 +02:00
Åke Forslund bc2bfb6c77 Ignore overflow errors as before 2019-10-20 09:48:52 +02:00
Åke Forslund 3da5dece0c Stop restarting mic after 20 attempts 2019-10-20 09:47:12 +02:00
Åke Forslund 149a236e30 Attemt to restart the mic if there's an IOError
If mic produces an IOError try to restart the microphone's input stream
to recover.
2019-10-20 09:01:17 +02:00
Åke Forslund 6597ccc398 Send listen flag for special picroft case as well 2019-10-18 17:16:55 +02:00
Åke Forslund 5d8c3c6c92 Minor cleanup of mic docstrings, etc 2019-10-18 12:19:45 +02:00
Åke Forslund 9f555015e7 Add lock to mute unmute of mic stream
This should alleviate a potential (or possibly an existing) problem if
mute is triggered while reading of the mic occurs.
2019-10-18 12:12:48 +02:00
Åke Forslund 4bf0e89fb5 Update docstrings to match behaviour 2019-10-17 11:33:25 +02:00
ChanceNCounter 738ba6cf00 edit for pep8 compliance (#15) 2019-10-17 11:07:51 +02:00
jarbasal 978ece53ca feat/ask_selection 2019-10-17 11:07:51 +02:00
Åke 324fe988aa
Merge pull request #2356 from ChanceNCounter/spanish-language-parsers
fix bug in isFractional_es and improve coverage
2019-10-14 16:04:57 +02:00
devs-mycroft 913f29d3d5 Version bump from 19.8.0 to 19.8.1 2019-10-10 13:56:15 +00:00
David Wagner ddad8d1569 Pass listen to end_audio() 2019-10-10 12:11:11 +00:00
David Wagner feac64b2b0 Add listen arg to other TTS classes 2019-10-10 12:09:50 +00:00
David Wagner d9523fd30f Pass listen to end_audio() 2019-10-10 11:54:58 +00:00
David Wagner e45f527af3 Default to False 2019-10-10 11:50:48 +00:00
Åke 88e8b661e7
Merge pull request #2351 from forslund/feature/listen-on-last
Send listen on last sentence of utterance
2019-10-08 14:51:53 +02:00
David Wagner 1a9a51fe56
Merge pull request #2354 from forslund/bugfix/settings-delitem
Add missing __delitem__ method
2019-10-07 10:44:48 -05:00
Kris Gesling ab860306d3
Merge pull request #2353 from MycroftAI/bugfix/tail_scheduling_events
Remove event before running event handler
2019-10-07 21:55:29 +09:30
Åke 8126bcafce
Merge pull request #2346 from ChanceNCounter/tests/util-parse-en
fix bug, redundancy in parse_en; improve coverage
2019-10-07 13:22:23 +02:00
ChanceNCounter 1c41e523ce fix bug in isFractional_es and improve coverage
- Fix: isFractional_es() parsed fractions incorrectly
- Update: earlier commit msg suggested another fix:
  - Month parsing not fixed
  - Several failing tests (skipped) document problem
  - TODO and an issue also created
- Substantially improve parse_es.py test coverage
- TODO or comment several found bugs
  - Many lines remain uncovered, incl possible bugs
2019-10-05 14:46:09 -07:00
Åke Forslund 24d6cf9ea0 Add missing __delitem__ method
The delitem method is apparently used, for example by the alarm skill
2019-10-04 20:43:46 +02:00
Åke Forslund 08d38dea75 Remove event before running event handler
Allow events to reschedule themselves. The reference is removed before
the handler is executed to not remove anything added by the handler.
2019-10-04 18:29:11 +02:00
Åke Forslund abf8a90f07 Add description of the playback thread loop 2019-10-04 15:14:56 +02:00
Åke Forslund 29db163a78 Move listen trigger to last chunk of sentence
If rendering a chunk of a sentence takes too long time, the audio queue
may run out and trigger the listening.

This moves the listening trigger to after the last chunk.
2019-10-04 15:09:45 +02:00
Åke 8ffad68251
Merge pull request #2347 from ChanceNCounter/extractnumber-es-fix-and-add-extractnumbers
Fix extractnumber_es, add extract_numbers_es
2019-10-04 08:46:03 +02:00
Åke 90ceaa3c88
Merge pull request #2342 from ChanceNCounter/fix/convert-mixed-fraction-param-default
add default value to nice_number param
2019-10-04 08:43:15 +02:00
ChanceNCounter 1107f5d6cc Fix extractnumber_es, add extract_numbers_es
- Fix bug causing extractnumber_es to return a sum instead of a list
- Add Spanish parser to extract_numbers and extract_number

==== Fixed Issues ====
Closes #2310

====  Tech Notes ====
Further obscures #2056: short_scale and ordinals parameters added to the
Spanish parsers, but they don't do anything. Present for compat only.
There is a TODO for this.

==== Localization Notes ====
It's all Spanish stuff!

This will require a native Spanish speaker to analyze the relationship
between extractnumber and isFractional, and determine why certain
fractions do not parse correctly. There is a TODO for this.
2019-10-03 17:11:39 -07:00
ChanceNCounter 16d6bf4b22 fix bug, redundancy in parse_en; improve coverage
- Remove unreachable conditions from parse_en:1122-1133
  - input string passed through clean_string() on line 763
  - articles stripped from input before line 1122
  - removed conditions relied on presence of "the" in input
- Improved test coverage on parse_en.py by approx 65 statements
  - Directly test certain helper functions which are difficult to
invoke indirectly
  - Add tests for certain missed conditions
  - Approx. 20 uncovered statements remain
2019-10-03 14:41:21 -07:00
Åke 15233f8929
Merge pull request #2336 from forslund/feature/load-skill-settings-once
Remove duplicate load of skill settings
2019-10-03 19:46:11 +02:00
Åke Forslund b480dda90f Clean up docstrings
Minor cleanup of docstrings in the files affected by the previous commit
2019-10-03 19:13:02 +02:00
Åke Forslund 46b0b94631 Don't go through FS when triggering listener.
This adds a separate handler for triggering listening on the
"mycroft.mic.listen" message
2019-10-03 19:12:56 +02:00
ChanceNCounter 8c50fe9700 add optional 'clock' param for displayed output
Add one more optional parameter: bool clock, always produces
digital clock-like output. "0h 3m" becomes "0:03:00".

Has no effect on resolutions YEARS or DAYS, and MINUTES won't print hrs.
2019-10-02 07:55:22 +02:00
ChanceNCounter 4253929d2c - make nice_duration handle years, datetimes, and ms
- Companion enum:
mycroft.util.format.TimeResolution
offers YEARS, DAYS, HOURS, MINUTES, SECONDS, or MILLISECONDS

- Will only return ms if MILLISECONDS is chosen. Default: SECONDS

- Update tests
2019-10-02 07:55:22 +02:00
ChanceNCounter 388d9afaa7 add default value to nice_number param
Add default value to nice_number & convert_mixed_fraction `denominator`

Add tests for convert_mixed_fraction
2019-10-01 06:55:44 -07:00
Kris Gesling ab04fe6b60
Merge pull request #2338 from forslund/bugfix/clear_once_events
Fix clearing of once events
2019-10-01 15:10:31 +09:30
Åke b298061ddc
Merge pull request #2289 from UltraCoderRU/dev
Add Yandex TTS support
2019-09-30 20:29:17 +02:00
Kirill Kirilenko 58931310e9 Add Yandex TTS support 2019-09-30 20:13:04 +02:00
Kirill Kirilenko 1faf7b2210 Add Yandex STT support 2019-09-30 17:38:36 +02:00
Åke Forslund 425feb0590 Store correct function for once events
The handler was always stored even when the event was a once event and
thus was wrapped in once_wrapper.

This handles the once correctly.
2019-09-30 13:31:53 +02:00
Åke 87a7821926
Merge pull request #2335 from ChanceNCounter/bug/day-after-tomorrow
Fixes index error in parse_en.extract_datetime()
2019-09-30 11:20:13 +02:00
Åke Forslund 8f50217ee9 Merge branch 'bug/day-after-tomorrow' of https://github.com/ChanceNCounter/mycroft-core into ChanceNCounter-bug/day-after-tomorrow 2019-09-30 11:00:12 +02:00
Åke Forslund 9254ee0229 Remove duplicate load of skill settings
Instead of loading skill settings from disk twice, a copy is made into the
_initial_settings member after load.
2019-09-29 18:39:07 +02:00
ChanceNCounter a44167a3a4 Fixes index error in parse_en.extract_datetime()
==== Fixed Issues ====
#2333

====  Tech Notes ====
extract_datetime("day after tomorrow") attempted to check the previous
word. This resulted in an index error. Fixed by introducing a nested
condition. Seems to have solved it.

A similar bug is present in other parts of this file, such as line 843.

I have also discovered a number of other oddities, but they may be
outside the scope of this issue. At least Mycroft can now extract from
"day after tomorrow."

==== Localization Notes ====
I haven't checked parsers for any other languages.
2019-09-28 14:31:59 -07:00
Chris Veilleux 364c3991e7 fixed a spelling error 2019-09-28 12:55:31 -05:00
Chris Veilleux eca875558a added log message and docstring to help demystify regex intent handling 2019-09-28 12:21:28 -05:00
Chris Veilleux f16989c2ec Add log messages that provide insight into the disambiguation behavior 2019-09-28 12:20:22 -05:00
Chris Veilleux 5980779e48 Refactored module level docstring and import ordering 2019-09-28 12:17:12 -05:00
David Wagner 86b6ef16e5 Log IOErrors 2019-09-27 22:25:54 +00:00
David Wagner 4536de7a06 Add Exception logging 2019-09-27 21:50:24 +00:00
Chris Veilleux dfd776cab9 add a geolocation api for things like time and weather in requested locations 2019-09-26 16:24:11 -05:00
Åke bf38812ddf
Merge pull request #2297 from ChanceNCounter/prevent-repeating-dialog-lines
Cycle through dialog files to avoid repeating the same line
2019-09-26 16:23:08 +02:00
ChanceNCounter 30bd84bc85 Astd minor fix in core.dialog
Assign hardcoded value from MustacheDialogRenderer.render() to variable.
Fix its value to properly accommodate short dialog files.

Remove superfluous check on lines 104-105 of mycroft.dialog.init

====  Tech Notes ====
The new dialog logic, which prevents Mycroft from repeating itself, uses
a list of recently-spoken lines from the skill's .dialog files.
The size of this list is capped, currently at 3. However, .dialog files
can be shorter than 3 entries. An offset is used to accommodate this.

In the previous commit, the offset was wrong. Now it's 2.

====  Documentation Notes ====
If presented with a .dialog file containing 4 or more entries,
Mycroft will avoid saying the same one for at least a few rounds. If the
dialog file contains only 3 entries, Mycroft will avoid saying the same
line twice in a row. If only 1-2 entries are present in a .dialog file,
Mycroft will just pick one and say it, without retaining a history.
2019-09-26 16:20:43 +02:00
ChanceNCounter 4c8ce58f8e When able, cycle lines in .dialog files
Attempt to use a different line each time a .dialog file is invoked.

====  Tech Notes ====
MustacheDialogRenderer:
  - Keep a running list of recently spoken lines (up to 3)
  - If there's more than one line in a dialog file, don't repeat lines
  - Pop lines from the list when full or when dialog file is running low

====  Documentation Notes ====
Consider encouraging skill authors to include multi-line .dialog files,
as this will help to give Mycroft a more natural feel
2019-09-26 16:20:43 +02:00
Åke 7c7d7f47bb
Merge pull request #2262 from KishCom/bugfix/marytts-config-issue#2127
Fix missing param when setting up MaryTTS and how it validates a conn…
2019-09-26 16:14:53 +02:00
Andrew Kish 1d2cabd421 Fix missing param when setting up MaryTTS and how it validates a connection 2019-09-26 16:11:02 +02:00
Åke d30c50e752
Merge pull request #2283 from forslund/refactor/config-properties
Replace config properties to simpler instances
2019-09-26 14:51:56 +02:00
David Wagner 6bf66bf1f3
Merge pull request #2326 from MycroftAI/feature/remove-ntp-reboot
Remove ntp sync reboot
2019-09-25 14:53:13 -05:00
David Wagner 7cb1ca7282 Remove unused methods 2019-09-25 10:58:51 -05:00
David Wagner b0c7d3072c Update text client parsing of mic_level file 2019-09-25 12:23:11 +02:00
David Wagner a66ec9388d Write mic level with mute 2019-09-25 11:54:22 +02:00
Åke f1a95e79cb
Merge pull request #2323 from forslund/bugfix/logline
Catch inspect error in logger
2019-09-25 07:53:02 +02:00
David Wagner 3fc389dbf3 Remove ntp sync reboot 2019-09-24 20:35:11 +00:00
Åke Forslund 39d0053493 Catch inspect error in logger
Inspect would in certain cases fail to find the line number. This
catches the exception and provides a basic name for the logger.
2019-09-24 20:58:34 +02:00
devs-mycroft b746f365c9 Version bump from 19.8.-1 to 19.8.0 2019-09-24 05:42:59 +00:00
Åke Forslund c8b33704ce Update version number in preparation for 19.08 2019-09-23 09:58:09 +02:00
Åke 6c228d00a9
Merge pull request #2320 from MycroftAI/bugfixes/skills-manifest
Bugfixes/skills manifest
2019-09-20 22:57:57 +02:00
Åke Forslund 62bba61da0 Make sure skill manifest is synced with backend
Send skill manifest all startups
2019-09-20 16:40:30 +02:00
Åke Forslund 347e8c9d1e Work on copy when managing the skills manifest
Fixes possible modification of input data when adding device uuid to the
manifest before sending.
2019-09-20 15:02:51 +02:00
Åke Forslund c6b1e3dc92 Make logging a little easier to decipher 2019-09-20 12:20:46 +02:00
Åke Forslund fcc4df6351 Clear msm device_skill_state before update/upload
Make sure to re-read the device_skill_state from disk before doing
changes so no information is lost.
2019-09-20 08:07:03 +02:00
Åke eddc3c45bc
Merge pull request #2318 from krisgesling/feature/yes-affirmative
add 'affirmative' to yes vocab
2019-09-19 20:24:07 +02:00
Åke Forslund 2cb2c56572 Install priority skills and save info
Use the msm.install method to install the priority skills so the skill
details are registered in the manifest
2019-09-19 20:07:21 +02:00
Åke Forslund e0cb16eab8 Clean up skill_manager exceptions
- BaseException -> Exception
- Remove unused vaiables
2019-09-19 20:07:21 +02:00
Åke Forslund c016903b77 Update skills manifest if a skill is reloaded.
When a skill is reloaded it is quite possible that a new skill gid has
been assigned to it and the backend needs to be informed of the change.
2019-09-19 20:07:21 +02:00
Åke Forslund 3474d725b8 Stop settingmeta upload on skill shutdown
This makes sure to shutdown any Timer handling settingsmetadata upload
on skill shutdown to make sure no duplicates are running.

(Easily occurs when a skill gid doesn't match the one sent in skill
manifest)
2019-09-19 15:25:55 +02:00
Kris Gesling 6421509f35 add 'affirmative' to yes vocab 2019-09-19 10:47:20 +09:30
David Wagner af08f82aad
Merge pull request #2314 from forslund/bugfix/no-skill-gid
Restructure to get skill_gid after startup
2019-09-18 13:22:12 -05:00
David Wagner d67d76ad66
Merge pull request #2316 from forslund/feature/safety-harness
Add a safety harness in skill_manager main loop
2019-09-18 13:14:04 -05:00
Åke Forslund b9097e43f2 Restructure to get skill_gid after startup 2019-09-18 19:59:13 +02:00
Åke Forslund 4860b5657f Add a safety harness in skill_manager main loop
This captures any unhandled expressions and will at least make sure
they're logged properly. (Exceptions in threads are mostly not printed
to stdout).

This sleeps slightly longer than normal (10 seconds) and then tries to resume
normal operation.
2019-09-18 19:55:39 +02:00
Åke 11a52af507
Merge pull request #2313 from forslund/bugfix/uuid-pickup
Apply skill uuid directly after reload from disk
2019-09-18 13:52:22 +02:00
Åke 35bf4c88b9
Merge pull request #2312 from MycroftAI/bug/settingsmeta-upload-device-uuid
settingsMeta API call to be issued without a device ID in the URL.
2019-09-18 10:01:40 +02:00
Åke Forslund 09c0651872 Apply skill uuid directly after reload from disc
The uuid is now applied to the path after it has been checked and
reloaded if needed.
2019-09-18 08:48:40 +02:00
David Wagner f4865286ab
Merge pull request #2299 from forslund/bugfix/skills-reload-error
Catch exceptions when reloading skills
2019-09-17 19:24:04 -05:00
Chris Veilleux a5af2adb6d fixed an issue where a potential race condition can cause the settingsMeta API call to be issued without a device ID in the URL. 2019-09-17 15:31:48 -05:00
Åke fa6d826244
Merge pull request #2311 from forslund/bugfix/gotta-catch-em-all
Catch all exceptions from upload device info
2019-09-17 12:07:32 +02:00
Åke a41284e10e
Merge pull request #2287 from MycroftAI/refactor/skill-settings-split
Refactor/skill settings split
2019-09-17 11:40:35 +02:00
Chris Veilleux 9c0c20e96d added deprecation warning for settingsmeta fields no longer used. 2019-09-17 11:24:10 +02:00
Chris Veilleux 0d897cf4e8 don't emit settings change event if there are no settings 2019-09-17 11:24:10 +02:00
Chris Veilleux 02a6f00b03 new log message indicating that a skill got new settings from the backend 2019-09-17 11:24:10 +02:00
Chris Veilleux 1e5c2986d3 fix bug where saving settings to disk crashed when the settings passed to the function are a instance of the Settings class. 2019-09-17 11:24:10 +02:00
Chris Veilleux 21dd5b2bed fixed a bug with skill settings where the last download value was not properly initialized. added some logging 2019-09-17 11:24:10 +02:00
Chris Veilleux 4cfd48104d deal with empty settings file 2019-09-17 11:24:10 +02:00
Chris Veilleux fa1db1b9cf changed device API to hit new settings retrieval endpoint. 2019-09-17 11:24:10 +02:00
Åke Forslund 30104b58c1 Fix broken tests
- Correct settingsmeta upload endpoint
- Remove test for delete settingsmeta endpoint

- Fix usage of Pathlib for python 3.4 and 3.5
2019-09-17 11:24:10 +02:00
Chris Veilleux 826c822a74 only save settings to disk if a change is detected. 2019-09-17 11:24:10 +02:00
Chris Veilleux b1a63638c1 implemented a stop-gap change to keep the skill API from breaking 2019-09-17 11:24:10 +02:00
Chris Veilleux 5c742d2ed0 complete rethink of how settings and settingsmeta are handled in core. 2019-09-17 11:24:10 +02:00
Chris Veilleux bbb288a5f0 small typo fix 2019-09-17 11:15:39 +02:00
Åke Forslund 29dbbe1bee Update to use the old dns connection test aswell
This handles capture portals as well.

The standard connection logic is now

Check outside ip is reachable and after that check that www.google.com
is resolvable and connectable.

TODO: create endpoint on backend with known response to perform check
upon.
2019-09-17 09:27:43 +02:00
Chris Veilleux da3ce2caf5 Change connection check logic to resolve www.google.com
Change logic that checked for an internet connection after an issue occurred during initial boot where the old connection check gave a false positive.

Reordered imports to be PEP8 compliant. Minor refactoring to remove issues identified in PyCharm
2019-09-17 09:27:43 +02:00
Åke Forslund e9922c0fff Catch all exceptions from upload device info 2019-09-17 08:13:58 +02:00
Åke Forslund 5457c265f3 Handle errors when updating device attributes
Capture the correct exceptions when updating device version and
enclosure type. Switches from BackendDown to ConnectionError and
HTTPError.
2019-09-16 10:41:34 +02:00
Åke Forslund 7346e4d1b5 Add status queries to the skill process
mycroft.skills.is_alive: The service is started and priority skills are
loaded.
mycroft.skills.all_loaded: All skills on the system has been loaded.
2019-09-13 17:52:21 +02:00
Åke b79a2a52bf
Merge pull request #2303 from JarbasAl/bugfix/adapt_munging
bugfix/adapt munging
2019-09-13 08:12:39 +02:00
jarbasal 5edf464808 bugfix/adapt munging 2019-09-13 02:06:18 +01:00
David Wagner cf2791634d Fix bug where no utterance is spoken if cache wav is hit with no visemes cached 2019-09-11 18:44:31 +00:00
Åke Forslund 74be9a8a2e Catch exceptions when reloading skills
- Explicitly catch FileNotFoundError
- Do a general catch and log for other exceptions
2019-09-11 14:20:22 +02:00
Åke Forslund 02714cdeaf Don't kill global events when shutting down skill
During skill shutdown remove_all_handlers() was called on all registered
events. This would unregister all global events, such as settings
updating, stop for all skills.

Now the remove only will remove the instance connected to the skills
method.
2019-09-10 11:42:07 +02:00
Åke Forslund 146c3cad0c Log bus messages with debug level 2019-09-06 13:31:32 +02:00
Åke Forslund 43ed3a99a8 Make messagebus service respect loglevel 2019-09-06 13:29:40 +02:00
Åke Forslund 32cfe0d5c4 Fix error enabling/disabling padatious intents
Padatious is still not the greatest at enabling / disabling intents but
it's slightly better.
2019-09-02 18:49:55 +02:00
Åke Forslund c3c12d147a Handle event scheduler methods without message arg
Fix issue when the handler is specified without an argument parameter.
2019-09-02 18:49:41 +02:00
Åke Forslund 3b2c7267e7 Rename Message type arg to msg_type
Name change to remove collision with the builin type.
2019-09-02 13:30:55 +02:00
Åke Forslund e2d5b92bfe Remove deprecated methods and checks 2019-09-02 11:45:32 +02:00
Åke a1656deb63
Merge pull request #2282 from forslund/feature/pulse_role
Enable support for pulseaudio ducking
2019-09-02 07:55:55 +02:00
Åke Forslund ce772dd1ae Replace config properties to simpler instances 2019-09-01 12:18:27 +02:00
Åke Forslund 3fea4b1e6f Remove old manual pulse ducking 2019-08-31 14:27:06 +02:00
Åke Forslund 25bfd1345f Minor cleanup of tts/__init__.py
- Remove unused imports
- Correct docstrings
2019-08-31 14:27:06 +02:00
Åke Forslund 3d37315bc0 Utilize pulseaudio's corking/ducking feature
Pulseaudio allows corking / ducking for streams with prioritized roles
This sets the role for the mycroft speech to "phone" and all other to
"music" if the config tts->pulse_duck is set to true.
2019-08-31 14:27:06 +02:00
Åke Forslund 36eddc294f Mark unused parts of tuples
- use the external iterator instead of accessing the member
2019-08-31 09:04:16 +02:00
Chris Veilleux ed0b4f2719 self.registered_intents was moved to the IntentServiceInterface class but the instance attributes were not changed to reflect this. Also tidied up a few minor issues raised by linter. 2019-08-30 16:49:35 -05:00
Åke 75ad11b9d0
Merge pull request #2256 from forslund/refactor-split-mycroftskill
Refactor MycroftSkill
2019-08-30 18:21:13 +02:00
Åke Forslund 02b49edc99 Fix typo when unreferencing skill after failed load 2019-08-30 14:57:27 +02:00
Åke Forslund 077df67479 Disentangle event scheduler interface from skill 2019-08-30 13:32:00 +02:00
Åke Forslund cbf2fc63a9 Remove skill logic from create_wrapper
- Remove once-logic from the default handler wrapper, no need to do it there.
- Add docstring for handle_wrapper
- add the on_start, on_end handlers and move skill logic to respective
handlers.
2019-08-30 13:00:26 +02:00
Åke Forslund 87d9512093 Update get_scheduled_event_status()
Use the more modern bus.wait_for_response()
2019-08-30 13:00:26 +02:00
Åke Forslund c1d07bbe23 Add comments and clean up IntentServiceInterface 2019-08-30 13:00:26 +02:00
Åke Forslund d461ffe63c Update docstrings and variable names of EventSchedulerInterface 2019-08-30 13:00:26 +02:00
Åke Forslund f081404ce3 Further cleanup 2019-08-30 13:00:26 +02:00
Åke Forslund 5e558647e7 Refactor translation methods
Move file reading logic into skill_data.py
2019-08-30 13:00:26 +02:00
Åke Forslund e2ec2ef8d1 Reduce complexity of get_response() 2019-08-30 13:00:26 +02:00
Åke Forslund 2d95ed9e35 Move complexity to IntentServiceInterface
Move much of the complex methods for registering intents to the
IntentServiceInterface to reduce bloat of MycroftSkill
2019-08-30 13:00:26 +02:00
Åke Forslund 5402f8ae22 Use remove_all_listeners when cleaning 2019-08-30 13:00:26 +02:00
Åke Forslund 245a4cb698 Refactor adapt intent data loading routines
- The data loading no longer require the bus
- Add an intent service interface class for better testing
- Update test cases
2019-08-30 13:00:26 +02:00
Åke Forslund 7393d9a670 Create container class for tracking skill handlers
This container remembers registered skills and allows unregistering
all handlers connected to a skill at shutdown.
2019-08-30 13:00:26 +02:00
Åke Forslund a187a17d4d Set MycroftSkill.root_dir in __init__()
This also removes the _dir member which cointains the same information.
2019-08-30 13:00:26 +02:00
Åke Forslund f655152717 Minor cleanup of MycroftSkill
- Create separate method for regisetering mycroft system event handlers
- Fix some string concatenations
- Group acknowledge together with speak and speak_dialog
2019-08-30 13:00:26 +02:00
Åke Forslund b28d63cf71 Make register_intent decorator register all intent types
This makes the register_intent decorator work for all types of intents,
both Adapt and Padatious.
2019-08-30 13:00:26 +02:00
Åke Forslund f5cdeb76ce Move open_intent_envelope to intent_service 2019-08-30 13:00:26 +02:00
Åke Forslund 0759d6f8e1 Split of mycroft skill decorators into new file
Split of decorators from the mycroft_skill file and create a submodule
for mycroft_skill
2019-08-30 13:00:26 +02:00
Åke Forslund a3429dbd96 Create EventSchedulerInterface class
Group event scheduler interface logic into subclass
2019-08-30 13:00:26 +02:00
Åke Forslund 2e82f64519 Populate root_dir in __init__ from file location 2019-08-30 13:00:26 +02:00
Åke Forslund 0df90a2f80 Switch msm branch to 19.08 2019-08-30 09:45:37 +02:00
Chris Veilleux c5058a5117 Merge remote-tracking branch 'remotes/origin/dev' into feature/log-merger 2019-08-29 13:57:08 -05:00
Åke Forslund 4ae290d5b1 Send recording message after playing recording sound
This allows the sound to play before any ducking starts
2019-08-26 15:09:01 +02:00
Åke Forslund 70307c073a Fix stacktrace on use of deprecated config member 2019-08-24 12:06:49 +02:00
Åke Forslund 4d0e848965 Use from folder instead of dict lookup 2019-08-23 16:52:32 +02:00
Åke Forslund 6736513ae7 Fix SkillUpdater creator
- Since the bus emitter is currently not necessary it's set as an optional
parameter.
- Add proper class docstring
2019-08-23 16:52:31 +02:00
Chris Veilleux 48ca79f388 Improve scanning for decorated handlers
This will recurse down to MycroftSkill class but not include it. for
most skills this will mean only the methods / variables added by the
skill creator
2019-08-23 16:51:53 +02:00
Chris Veilleux be79b193b4 changed to use newer version of msm_wrapper. 2019-08-23 16:07:46 +02:00
Chris Veilleux ebfd367b98 Changed skill manager and updater to reflect changes to MSM.
Cached the MSM creation logic to improve performance.
2019-08-23 16:07:26 +02:00
Åke 125ed57ac6
Merge pull request #2263 from forslund/bugfix/reload-deactivated-skill
Fix reload_allowed check
2019-08-22 21:13:35 +02:00
David Wagner f96a69227d W503 2019-08-22 20:48:07 +02:00
David Wagner 60c43ff3a6 close() on already closed file 2019-08-22 20:48:07 +02:00
David Wagner 4bc1e6dcc6 Keep audio frames immediately after wake word and send them to STT 2019-08-22 20:48:07 +02:00
Åke Forslund 8996972e78 Fix reload_allowed check
Fix logic precedence error and add test for the previous failing
condition.
2019-08-21 16:33:55 +02:00
Åke 4a9c2a4ed4
Merge pull request #2260 from forslund/bugfix/initialize-failure
Fix issue where skills fail during initialize()
2019-08-21 10:31:45 +02:00
Åke Forslund bd0456f4e6 Fix issue where skills fail during initialize()
An exception in skill's initialize method would be reraised and cause
the main loading routine to halt. This does not reraise the exception,
instead the instance reference is removed.
2019-08-21 10:11:47 +02:00
David Wagner e5f71cf12a
Merge pull request #2245 from forslund/bugfix/download-precise
Bugfix/download precise
2019-08-20 11:27:35 -05:00
Chris Veilleux 3bd3dd1bed Refactor skill manager (#2237)
Split skill_manager into three separate classes, SkillManager, SkillUpdater and SkillLoader splitting the responsibility into logical units

* Split the SkillManager.__init__ code to determine the download times into a new method
* Make docstrings consistent and PEP257 compliant.  Also fixed a couple of spelling errors
* fixed two issues introduced in the previous refactoring
* removed unnecessary assignment of an instance attribute to a local variable
* updated the unit test to mock out code that reaches outside of core, like MSM and the configuration manager.
* add several unittests and refactored load_priority method.
* add a test for the _get_last_modified_date function.
* add "quick" argument to docstring
* removed unused import
* new class containing the logic to periodically update/install skills and send skill manifests to the backend.
* import MsmException from where it is defined, not from the skill manager.
* add some logging to the skill updater
* remove code now in SkillUpdater from SkillManager
* added imports to __init__.py to define the API into the message bus package
* new base class for unit tests and module for reusable mocks
* new skill loader class that will replace the _load_or_reload_skill() method in the SkillManager class.
* moved skill loading logic from core.py into skill_loader.py, resulting in some refactoring of skill loader and skill manager.  change unit tests to match.
* added back some spacing that was inadvertently removed.
* change skill tester to use new SkillLoader class.
* Separate reload required check from performing reload to make logic easier
to follow
* Track skills that failed to load to handle infinite loop at first load
if skill fails to load
* Allow reloading skills that has failed to load
* Simplify first load of skills
- create activate, deactivate and unload methods for skill_loader
objects
- add sanity checks before activating and deactivating skills
- Update activation/deactivation test cases
2019-08-20 12:02:39 +02:00
Kris Gesling 3cacdaaaab
Fix TypeError for number values in settings
In some instances, the backend returns number setting values as an integer rather than a string.

This has been seen in the wild but has been difficult to replicate. The circumstances under which it happens are still unclear. I was able to semi-consistently have a number returned as int from the [Severe Weather Skill](https://github.com/domcross/severe-weather-information-skill) when editing an unrelated setting. To test, remove the 3 character country code (`[A-Z]{3} - `) from the service options of this skill .

This seems to be the quickest fix for it, but worth investigating further from the backend.
2019-08-17 08:36:00 +09:30
David Wagner 5f6db0941b
Merge pull request #2248 from forslund/feature/pairing-check-in-stt
Move pairing check to the relevant stt backends
2019-08-13 14:56:49 -05:00
David Wagner db2ea07f18
Merge pull request #2236 from forslund/bugfix/system-update
Allow startup if update attempt occurs
2019-08-12 14:31:34 -05:00
Åke Forslund 0801eda839 Fix delete_skill_metadata incorrect parameter name
change from the old uuid to the newer skill_gid fixing the invalid
reference to skill_gid.
2019-08-10 08:10:44 +02:00
Kris Gesling 754da78065
Merge pull request #2242 from cclauss/patch-2
Use ==/!= to compare str, bytes, and int literals
2019-08-08 06:26:57 +09:30
Kris Gesling 75c9addaa6
Merge pull request #2241 from cclauss/patch-1
Undefined name: Except --> Exception
2019-08-08 06:25:57 +09:30
Chris Veilleux cc3ef9b4b0 changed to handle new log message format 2019-08-02 11:16:55 -05:00
Chris Veilleux b44381d265 changed format of of log messages to include a date, put the log level in the second position and add the pid 2019-08-02 11:16:37 -05:00
Åke Forslund f727c00430 Move pairing check to the relevant stt backends
The pairing trigger should only be triggered by the 401 status for the
Mycroft hosted STT backends. Doing it for other STT's is only confusing.

This creates the decorator 'requires_pairing' that can be applied to the STT modules where it's relevant.

This adds the decorator to the MycroftSTT and the MycroftDeepSpeechSTT
2019-08-02 18:16:29 +02:00
Åke Forslund 6a2451bcbc Retry failed download of precise or use existing
Will retry the download of precise once per minute
2019-08-02 08:06:28 +02:00
Åke a140efe8f7
Merge pull request #2234 from c0r73x/dev
Some Swedish additions
2019-08-02 07:31:59 +02:00
Kris Gesling b357874c25
Merge pull request #2235 from MycroftAI/bugfix/padatious-detach-unregistered
Handle removing unregistered intents
2019-08-01 08:35:39 +09:30
Christian Clauss 517a0edaa2
Use ==/!= to compare str, bytes, and int literals
Identity is not the same thing as equality in Python

$ python
```
>>> 1 == 1.0
True
>>> 1 is 1.0
False
```
2019-07-31 00:13:44 +02:00
Christian Clauss 0053e70bc0
Undeefined name: Except --> Exception
__Except__ is an undefined name in this context with the potential to raise __NameError__ at runtime instead of the desired Exception and message.
2019-07-31 00:02:07 +02:00
Chris Veilleux d1915d3f95
Merge pull request #2180 from forslund/feature/is_paired-fail-early
Make is_paired fail early if no uuid in identity
2019-07-29 13:57:31 -05:00
c0r73x 357ddf9085 Added date_time for swedish 2019-07-27 22:11:30 +02:00
c0r73x e88e7c007d More fixes to swedish numbers 2019-07-27 20:27:51 +02:00
Åke Forslund e9cc683dbe Allow startup if update attempt occurs
update_attempt will block waiting for the update to complete and the
update will shutdown the running skills process if an update is needed.
2019-07-26 17:40:59 +02:00
Åke 7ebf58919e
Merge pull request #2233 from forslund/refactor/event-emitter
Small cleanup of the event scheduler
2019-07-26 17:10:23 +02:00
Åke Forslund 13db3d32a3 Handle removing unregistered intents
This small change adds a check that the intent has been registered
before removing it.

If an unregistered intent was removed padatious would silently throw an
exception due to a list operation error. But when run synchronously from
the skill tester this silent exception was actually loud causing skills
to fail to load.
2019-07-26 16:04:16 +02:00
Åke Forslund ad49c51ffc Minor cleanup of hotword_factory.py
- Reorder includes
- Add basic docstrings for the available engines
- simplify super()
- remove unneccessary "/" chars
2019-07-26 15:54:37 +02:00
Åke Forslund 9fda4e0670 Check if mic returned data before putting on queue
Mic may return None when aborted due to a reload of wake-word engine
2019-07-26 15:34:16 +02:00
Åke 5eba242487
Merge pull request #2221 from forslund/refactor/split-skills-core
Split mycroft.skills.core
2019-07-26 08:54:26 +02:00
Chris Veilleux 0bde1bc9df Refactor skill service (#2220)
Major refactoring of the skills startup sequence
- Restructure to a less nested structure
- Remove usage of globals by wrapping a lot of state variables into a class this allows for things like caching a negative pairing status throughout the startup process
2019-07-26 08:53:27 +02:00
c0r73x 4f92361bcc Added test_format_sv.py 2019-07-25 22:45:30 +02:00
c0r73x 9e37064408 Fixed format_sv 2019-07-25 21:49:50 +02:00
Åke Forslund 1f6adda6fd Small cleanup of the event scheduler
- Update docstrings
- Fix camelcase member
2019-07-25 08:44:20 +02:00
devs-mycroft acbb0f0dc2 Version bump from 19.2.13 to 19.2.14 2019-07-24 12:59:37 +00:00
Åke Forslund 846723cca0 Limit creation attempts of msm-lock
the msm-lock was created in global scope making all mycroft processes
trying to create it. This moves init to actual usage of the lock
2019-07-24 12:16:05 +02:00
Åke dbf0da6baf
Merge pull request #2230 from forslund/bugfix/message-bus-build-url
Bugfix/message bus build url
2019-07-24 09:06:07 +02:00
Åke Forslund 4034745340 Restore build_url static member to messagebus client 2019-07-24 08:49:44 +02:00
David Wagner ed6324d83b
tts_hash to an actual hash
tts_hash was initially set to the text of the config rather than hash so always loaded twice on boot (~750ms for create() for Mimic2)
2019-07-23 15:31:21 -05:00
Åke Forslund e87cf16a0d Make is_paired fail early if no uuid in identity
Refactors code so no request is sent to backend if the local identity
file is empty / has no uuid. Since if this part is missing core already
knows that it's not paired correctly.
2019-07-23 11:36:55 +02:00
Åke Forslund 0689f60747 remove "is True" check 2019-07-22 09:25:49 +02:00
Åke Forslund db94123d96 Replace oldstyle super class access with new 2019-07-22 09:24:36 +02:00
Åke Forslund 5dc8802146 Look over docstrings.
Update docstrings of the files affected by this reoriganization.
- PEP 257
- Add missing
2019-07-22 09:16:53 +02:00
Åke Forslund b7b5e9bfcb Refactor mycroft.skills.core
- MycroftSkill and related core functions to mycroft_skill.py
- FallbackSkill to fallback_skill.py
- Add important classes decorators and functions to __init__.py
- move SkillGUI class to the enclosure along with the other enclosure
  interfaces

core.py retains the same members as previously by means of imports to
retain backwards compatibility. When most of the available skills starts
using this new structure properly
2019-07-22 06:46:31 +02:00
Åke bb779e6136
Merge pull request #2217 from forslund/bugfix/quick-download
Move quick skill update to after internet check
2019-07-19 13:13:03 +02:00
Chris Veilleux edcc1c261e simplified super() call to use Python 3 syntax 2019-07-19 08:16:55 +02:00
Chris Veilleux 2c67381aee added module level docstring 2019-07-19 08:16:55 +02:00
Chris Veilleux be3dff99a1 added licence info to files without it and a missing docstring 2019-07-19 08:16:55 +02:00
Chris Veilleux 4e9130114e remove validate_param since it's now unused 2019-07-19 08:16:54 +02:00
Chris Veilleux d8f3095d40 Rename the message bus client and abstract config loading
Message bus config loading is now shared by service and client.

messagebus.client.ws file is still available in case skills are using it. It is a backport that inherits from the new MessageBusClient class. Adds depreciation warning.
2019-07-19 08:16:54 +02:00
Chris Veilleux 3efce9639e Clean up of messagbus/send.py
- reorder imports
- refactor docstrings for consistency
- rename camel case variables to use snake case
2019-07-19 08:16:54 +02:00
Chris Veilleux 7a7ed8944d Clean up of message.py 2019-07-19 08:16:54 +02:00
Chris Veilleux 468fb800a7 refactor messagebus service:
- add some docstrings
- put config retrieval in a function
- add log messages
2019-07-19 08:16:09 +02:00
Åke 345e28f5fa
Merge pull request #2206 from MycroftAI/doc/readthedocs2
Quickfix: readthedocs build
2019-07-18 14:55:13 +02:00
Åke Forslund 8b03a93dc1 Move quick skill update to after internet check 2019-07-18 14:25:31 +02:00
Åke Forslund 3e0cac8c1e Trigger settings update on pairing complete 2019-07-14 21:01:44 +02:00
Åke Forslund ddb9d5b0a2 Hack: Fix readthedocs build
The Mycroft API documentation were blank due to the import of the yaml
module for some reason. This moves the import into the method where it's
used
2019-07-14 08:17:05 +02:00
Kris Gesling efa69e0526 'next {day}' to be 3-9 days in future (#2184)
* 'next {day}' to be 2-9 days in future

* restore module level docstring

* remove lang specific definition of 'next'

* restore module level docstring
2019-07-13 11:53:38 +02:00
David Wagner 4b480dcf32
Add mycroft_mark_2pi to platforms needing ntp sync 2019-07-12 06:56:35 -05:00
Åke cddb1ab981
Merge pull request #2190 from strugee/patch-1
Recognize "confirm[ed]" as a word for "yes"
2019-07-12 08:41:04 +02:00
Åke fc0a253c28 Fetch CLI log path from config if available (#2192)
* Fetch CLI log path from config if available

* Remove the old log locations
2019-07-11 17:40:40 -05:00
Åke da00b38f82 Explain the config system used here. (#2201)
- Add module docstring
- Add comment in the init class method about setting up the log level
- Add mycroft.util.log to the readthedocs documentation
- Add comment in the config about the log_level
2019-07-11 17:39:50 -05:00
Åke 5555fa398d
Merge pull request #2197 from forslund/feature/skills-startup-speedup
Skills process startup speedup
2019-07-10 16:30:48 +02:00
Åke Forslund b79bd0e317 Remove unused import of sys 2019-07-09 22:54:24 +02:00
Åke Forslund b0ddb9a74a Only report STT timing if transcription exists
To clean up the metrics log empty transcriptions from false activation
are no longer reported.
2019-07-09 22:54:06 +02:00
Åke 80b50598fb
Merge pull request #2196 from forslund/feature/skill-timing-report-skill_id
Add skill_id to skill handler timing report
2019-07-09 22:42:58 +02:00
Åke Forslund 94ab53f47e Handle sending skill manifest
Skill manifest is now sent on each startup if paired otherwise after successful pairing.
2019-07-09 16:52:27 +02:00
Åke Forslund d87ff3a535 Launch settings fetching in thread. 2019-07-09 16:52:27 +02:00
Åke Forslund cd16404455 Download skills if they're stale or in unknown state
Checks if the skills haven't been updated for more than 2 weeks or if
the last_download is undefined. last_download may be undefined if
the .msm file is missing or if the list of installed requirements is
missing so skill requirements may be missing.

This also makes sure the skills are normally loaded before the an update
attemt is tried.
2019-07-09 16:52:27 +02:00
Åke Forslund 58cab5cddb Add support for slowloading skills
Upgrade msm to 0.7.8

Using the new max_threads parameters to MycroftSkillsManager.apply() the
skill loading is reduced to 2 threads if it's during runtime while a
fast update (20 threads) are used if not all default skills are
installed to speed up getting core into a 100% operational state.
2019-07-09 16:52:10 +02:00
Åke Forslund c2c2377780 Add additional exceptions for may 2019-07-08 15:36:14 +02:00
Kris Gesling 946b7bf3de fix requests with non-month 'may' 2019-07-08 15:36:14 +02:00
Åke Forslund fe31564114 Remove unused imports 2019-07-08 14:41:09 +02:00
Åke Forslund 6466be63d8 Add skill_id to skill handler timing report 2019-07-08 09:12:20 +02:00
AJ Jordan 0bde03bc08
Recognize "confirm[ed]" as a word for "yes"
Fixes #2189
2019-07-04 15:40:03 -07:00
Åke Forslund fbcf731556 Remove broken auto-naming of resting_screen_handler
The automatic naming of the resting_screen_handler wasn't working (error
occured if no name was supplied)

Added test case for the function
2019-07-03 08:40:34 +02:00
Åke Forslund f0e397b32e Do not change process conf when preparing hotwords
A backwards compatibility piece of code creates a hotword from the
listener settings if the listener referes to a non-existing hotword.

This makes sure the generated config doesn't affect the loaded
configuration to avoid extra reloads of precise.
2019-07-01 20:58:22 +02:00
Åke Forslund 3a478c4a4d Update listener reload check
The reload check is now using a more reliable method and only a subset
of the configuration. Currently set to "listener", "hotwords", "opt_in"
and "stt".
2019-07-01 20:58:12 +02:00
devs-mycroft 0ec3dbee47 Version bump from 19.2.12 to 19.2.13 2019-07-01 11:21:44 +00:00
Åke Forslund 28e20617fd Remove 'update' field from skills data
Filter out update field from skills data when sending skills manifest
since backend will reject fields with unexpected data
2019-07-01 12:24:18 +02:00