Commit Graph

524 Commits (169a55f57697c928ab1064c4aabf7825a589e5f7)

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 2efe3eb9ef Fix Ctrl+C and Ctrl+X in CLI (#1826)
* Fix Ctrl+C and Ctrl+X in CLI

There were several quirks in the shutdown of the CLI client:
* Consumed Ctrl+C wasn't being handled cleanly
* main() got called twice, requiring two Ctrl+Cs to exit
2018-09-30 11:14:40 +02:00
Matthew Scholefield a29d00707d Check for a Precise model automatically for custom wake words 2018-09-26 11:14:15 -05:00
Matthew Scholefield c6f9513e9d Allow local model file in precise 2018-09-04 22:59:52 -05:00
Dominik de0bf7d0fd Fix for broken communication with Arduino 2018-09-03 14:50:51 +02:00
Åke Forslund a86359da7f Fix Åkeisms in the code
Updated renamed variables reference everywhere where they were used
2018-08-30 17:10:17 +02:00
Åke 80a37ec46a Move Mark-1 specific image code from api to mark-1 enclosure (#1767)
* Fix removing of the active user

* Move image drawing routines to enclosure client
2018-08-28 14:50:03 -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 0d14e01907 Fix skills listing in CLI (#1759)
Skills list shared the help screen id it was immediately overwritten by
the help.

- Give the skills page a separate page number
- Replace screen id numbers with simple identifiers
- Add simple handling of multiple pages
2018-08-24 00:03:32 -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
Åke Forslund b41d9edc13 Split text client from __main__
- __main__.py keeps the main setup of hiding stderr/out and argument parsing
- text_client.py contains the actual text client
2018-08-16 20:54:05 +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
Åke 13f669d514 Set default encoding in a cleaner way (#1745)
- simplify code setting LC_ALL
- Handle other encodings than utf-8
2018-08-15 17:16:34 -05:00
Steve Penrod 2e873e43bf Change to the supported wait_while_speaking() (#1743)
Code was using the deprecated version from mycroft.util instead of
the mycroft.audio version.
2018-08-15 10:35:50 +02:00
Steve Penrod 46c92e0c36 Fix CLI lockup; simple 'speak' support; help display
Several minor and simple CLI fixes:
* The CLI was locking up with at Lock() deadlock when rebuilding the
  filtered log.
* The simple_cli() wasn't registering handle_speak() on the websocket,
  even though the handler was setup for it.  The utterances are already
  clear from the Input: line or from the logs being printed, so no need
  to have a handle_utterance() registered in the simple_cli() case.
* Help wasn't refreshing the screen, so was invisible.
* An error could be thrown if Ctrl+Z was hit to suspend the 'fg' to
  return to foreground before any key was pressed.
2018-08-14 22:40:08 -05:00
Steve Penrod 1c82945576 Move logs to /var/log/mycroft/ directory
Simplifies permissions and future log-rotations to have all logs
under a single folder instead of having to give permissions to each.
2018-08-02 23:57:13 -05:00
Steve Penrod f329051743 Move logs to /var/log in all cases
Previously, the location of the log files changed depending
on whether you were running on a Mark1/Picroft or under a
"Github" install.  Now they are always under the same directory
at /var/log/mycroft-*.log

This also updates the CLI to pull from that location always.

Additionally:
* Removed the nonfunctional 'wifi' option from start-mycroft.sh
* Made the validation for dev_setup.sh exit instead of just show
  a warning message in start-mycroft.sh
* Added code to allow dev_setup.sh to be run from different
  directories successfully
2018-08-02 21:21:30 -05:00
Steve Penrod 040b64d09d
Fix CLI screen corruption (#1704)
The CLI would often have temporary screen corruption.  This reworks
several things to correct that issue, although it looks like the
ultimate cause was drawing to the screen while in the middle of
waiting on a VT100 ESC keycode sequence.

* Rearchitected all screen drawing to run in a single thread.  Now
  call set_screen_dirty() instead of draw_screen()
* Added a lock on accessing the various Log buffers, preventing
  changes to the buffer in the middle of a redraw
* Modified key reading logic when ESC character is received.  Now
  uses a 1 second timeout if no subsequent keycodes are sent
* Catch several special exceptions.  Curses throws exceptions in some cases during get_wch(), such as
when you Ctrl+Z suspend the CLI the resume the process.  Also moved Ctrl+C processing into this exception handler.
2018-07-30 17:17:48 -05:00
Steve Penrod 223c88b4dd CLI Updates: Restore VT100 support, help, etc. (#1667)
* Restored VT100 function key support
* ESC now clears the entry line
* Spoken commands now become part of the history
* Enhanced help screen with auto word-wrap
* Bugfix: "Show meter" setting didn't persist, now it does
2018-07-12 09:38:29 +02:00
Matthew Scholefield 189e0f10ab Refactor Precise engine and support engine timeouts 2018-07-06 00:05:28 -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
Aditya Mehra 3ae4746099 Feature add query mic status (#1656)
* Feature: Add query mic status

Adds the message bus message `mycroft.mic.get_status` which responds with data on if mic is muted or not.
2018-06-27 15:51:33 +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
Åke 5d6fd4d871
Merge pull request #1629 from MycroftAI/feature/https-ww-upload
Change wake word upload to https request
2018-06-07 08:58:28 +02:00
Åke b57a0ddb65 Use get_wch() to support unicode input in the CLI (#1609)
The CLI interface should now allow non-ASCII characters, including those used in non-English languages.
2018-06-06 17:02:48 -05:00
Matthew D. Scholefield 727e1c787c Change wake word upload to https request
Also strips out old alternative ways to enable wake word upload
The logic for uploading wake words is now:
 - Only if opt-in is enabled
 - With an additional "disable" setting to selectively prevent it
2018-06-06 14:53:11 -05:00
Matthew D. Scholefield 8c0b471d24 Fail wake word upload on first try
Previously failed wake words would collect and each one would attempt an upload and fail. Now, this does the same process but failing on the first wake word that fails to upload
2018-05-15 12:31:06 -05:00
Matthew D. Scholefield 3fa958cbac Make scp upload quiet and reduce saved seconds
The scp upload shows the account id which isn't the best to put in logs
The saved audio seconds used to contain audio before so that it could be used to identify multiple recordings that didn't activate the device. However, we've since moved to tagging only the last 3 seconds
2018-05-15 12:28:28 -05:00
Åke d63a747b9f
Enforce integer for positions in mouth display (#1588)
In python 3 these would default to floats, which trips up the arduino
2018-05-14 11:48:27 +02:00
Åke Forslund 79d183d59f Bump enclosure version to 1.4.0 2018-05-11 14:26:06 +02:00
Åke Forslund bf404b0bbc Fix python3 issues in serial transmission
Added basic conversion between string and bytes for sending data on the serial line.
2018-05-04 11:42:05 +02:00
Matthew D. Scholefield 78a6ec1ceb Fix cli crash with Python 3
This worked in Python 2 because type(4 / 2) == int but in Python 3 type(4 / 2) == float
2018-04-27 08:56:47 -05:00
Åke Forslund a2993e4ba6 Remove backwards compatibility with python 2.7 2018-04-27 08:51:47 -05:00
Åke Forslund d4ba484ad9 Make text client python2/3 compatible
- Make str unicode string
- Use BytesIO for python2 and StringIO for python3
2018-04-27 08:50:46 -05:00
Åke Forslund c6584d603d Make speech client python3 compatible 2018-04-27 08:50:46 -05:00
Matthew D. Scholefield cbf73d4b30 SSML Changes
- Engines now specify if they support ssml rather than the configuration
 - The text client strips out ssml tags
 - Engines can modify tags via the `self.modify_tag` method
2018-04-18 14:45:09 -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
Å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
Åke 46f6f734e3
Merge pull request #1509 from MycroftAI/feature/wait-for-messagebus
Wait for messagebus before emitting a message
2018-03-28 19:28:35 -05:00
Matthew D. Scholefield 5c8cf053a0 Remove code that waits for websocket to open
This is unnecessary now that WebsocketClient does this automatically
2018-03-28 19:19:56 -05:00
Matthew D. Scholefield eb100706df Add proper messages when the backend replies incorrectly 2018-03-28 11:48:05 -05:00
Matthew D. Scholefield 9eb458360b Fix accessing non-existent attribute in except blocks
.request.status_code is only available to HTTPError objects
2018-03-14 00:41:47 -05:00
Matthew D. Scholefield 7e64b49fa3 Replace HTTPError with RequestException
This prevents things like a ReadTimeout exception crashing the speech service
2018-03-07 10:57:13 -06:00
Matthew D. Scholefield b67c3314d7 Add proper not loaded message (#1456)
Once skills load, skill-unknown will handle all failed fallbacks. The only time this is spoken is when skills still aren't loaded yet
2018-02-28 21:49:11 -06:00
Åke 50b05ae6b4
Merge pull request #1446 from MycroftAI/refactor/exceptions
Remove redundant except (SystemExit, KeyboardInterrupt) clauses
2018-02-27 23:08:27 +01:00
Zachary T Welch 6df3cc0765 improve output when no words are transcribed 2018-02-27 15:48:05 -06:00
Matthew D. Scholefield fbb9231adc Remove redundant except (SystemExit, KeyboardInterrupt) clauses
This can be replaced by ensuring the final except clause is 'except Exceptions'. This works because SystemExit and KeyboardInterrupt do not inherit from the base 'Exception' class
2018-02-27 14:28:29 -06:00
Matthew D. Scholefield 80cbf6799c Fix invalid command 2018-02-26 12:03:25 -06:00
Matthew D. Scholefield 93e34985f1 Change precise executable to a folder
This prevents self-extraction each bootup
2018-02-23 18:05:30 -06:00
penrods 0dd337d44c Tweaks to CLI: Refresh, scroll fix
Several tweaks to CLI behavior
* The "show/hide meter" setting is now persisted
* Fix behavior when scrolled back and logs are rolling off
* Fix potential crash when no logs exist
* Add Ctrl+R to force a refresh (undocumented for now-- help page is getting long and we need an automated system to resize help for smaller screens)
2018-02-23 03:20:23 -06:00