Commit Graph

47 Commits (493d057f7c3ad3181c82c2de0141c869e5935734)

Author SHA1 Message Date
Å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 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 Forslund 4034745340 Restore build_url static member to messagebus client 2019-07-24 08:49:44 +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 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
jarbasal e256e3d1a6 restore bus on_message 2019-04-16 23:28:51 +01:00
Åke 07c2a93324 Feature/threaded emitter for real (#2024)
* Run emitter using threadpool

This moves the thread pool from the websocket client into the eventemitter allowing each registered function to run in a separate thread and not just each event.

This speeds up cases where there is a one to many call such as the common play framework and the upcomming common query framework.

* Add unit tests for threaded event emitter

* Add standard header

* Add standard header
2019-02-28 03:04:51 -06:00
Åke 71088f8fcb Feature/update requirements (#1998)
* Update to pyee 5.0.0

- Update requirement
- Make the SkillSettings class hashable

* Update adapt to 0.3.2

* Upgrade websocket-client
2019-02-27 23:41:24 -06:00
Steve Penrod de818db9cb Clean up some exception handling in settings code
The settings code worked, but was noisy and generally messy about
a few exceptional but common situations:
* When the .mycroft/skills/<SkillName> folder didn't already exist
* When network timeouts and such occcurred

I also slipped in a couple trivial code cleanups for an unused variable
and a log message.
2019-02-14 15:41:27 -06:00
Åke Forslund f106f9603f Revert "Merge pull request #1889 from forslund/feature/threaded-emitter"
This reverts commit cb891ecf2f, reversing
changes made to 876b5393f7.
2019-01-17 11:11:43 +01:00
Åke Forslund 555031762a Run emitter using threadpool
This moves the thread pool from the websocket client into the eventemitter allowing each registered function to run in a separate thread and not just each event.

This speeds up cases where there is a one to many call such as the common play framework and the upcomming common query framework.
2019-01-14 07:29:43 +01:00
Åke Forslund 38701a9790 Remove inheritance from object
Inheriting from object isn't necessary in python3.
2019-01-11 09:24:21 +01:00
Steve Penrod b9fb463727 Fleshing out GUI mechanisms, CLI "GUI"
Further fleshing out of the GUI mechanisms
* Support for data and page from Mycroft -> GUIConnection
* Add a 'reconnecting' event for the messagebus
* Add MycroftSkill.show_url()
* Plumb MycroftSkill.gui into the messagebus
* Implement MycroftSkill.gui dictionary

CLI extensions for the GUI:
* Can now act as a simple GUIConnection
* Minor revamp of messagebus connection, provides kinder handling when
  messagebus isn't found or ready.
* BUGFIX: An empty filter would filter ALL messages
* BUGFIX: Input wider than the screen would cause a crash
* BUGFIX: "filter" or "find" with no param would filer "filter" or find "find"
2018-11-21 02:05:28 -06:00
Steve Penrod 496c0d1134 Fix Codacy warning... 2018-08-27 16:31:31 -05:00
Steve Penrod 741bd92a26 Fix PEP8 issue created by accidental code merge
Some debugging code got mixed in the merge for #1761, creating a PEP8 error
2018-08-27 16:16:22 -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 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
Åke Forslund d1d4256e05 Fix websocket reconnect
Making sure the reconnect code is reached after websocket closed error.
2018-04-19 16:00:01 -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 Forslund 27fcd63e96 Fix error on wait_for_response timeout.
Using pyee 1.0.1 handlers registered with once can't be removed. This handles the value error raised in this case.
2018-03-29 12:10:20 -05:00
Åke Forslund de6d3e2f11 Fix deadlock
The emitted event "open" will in many cases call ws.emit, and this will
lock if the connected_event isn't set. This makes sure that the
connected_event is set before emitting the open event.
2018-03-29 10:09:11 -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 e6a211a0aa Wait for websocket to connect before interacting with messagebus 2018-03-28 18:40:50 -05:00
Åke f8fec82905 wait_for_response method for synchronous messagebus communication (#1423)
* Add wait_for_response method to Websock client

The client handles the basic case when wanting to do a syncronous
request-response action.

The method sets up a handler waits for the response and handles timeout.

The expected format is that the reply message should have the same type as
the original message with ".response" appended.

An method in the Message class has been added to create a standard response for
a message.

* Let the :skills command use wait_for_response

* Minor docstring changes

Fixed typos and refined text
2018-02-15 01:39:11 -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 3e878bd59f Replace ConfigurationManger with Configuration 2017-10-26 19:02:32 -04:00
penrods 3d64509b25 SkillManager, msm messagebus notifications
Significantly reworked the loading/updating of Skills.  Unified
all management under a single SkillManager class.  This class
runs as a thread that initially loads, upgrades (via MSM)
and reloads skills.

Removed the independent threads that were being run.  The skill
updating still happens once an hour, but works in conjunction
with the scan to reload modified skills.  Also added messagebus
notifications from MSM so mycroft-core can pause reloading
skills until the installation is complete.

Added a new mycroft.messagebus.send module to allow command
line interaction with the messagebus, e.g.:
   python -m mycroft.messagebus.send mycroft.wifi.start
   python -m mycroft.messagebus.send speak '{"utterance":"hello"}'

==== Fixed Issues ====
MSM installs that have PIP dependencies were failing, as the
load would occur after code was retrieved but before PIP install
completed.  Restart was required to load new skills.

====  Tech Notes ====
TODO: Change the way we manage modules.  The auto-load of the
remote configuration for the module is silly, slow and wasteful.

I made the WebsocketClient.build_url() method static in
anticipation of being able to do this more efficiently when the
submodule load doesn't hit the remove API automatically.

==== Localization Notes ====
Modified 'sorry I couldn't install default skills' message.

==== Protocol Notes ====
MSM now generates:
  msm.updating
  msm.installing
  msm.install.succeeded     { "skill" : name }
  msm.install.failed        { "skill" : name, "error" : code }
  msm.installed
  msm.updated
  msm.removing
  msm.remove.succeeded      { "skill" : name }
  msm.remove.failed { "skill" : name, "error" : code }
  msm.removed

An update can now be forced by posting 'skillmanager.update' to the
messagebus.
2017-10-13 02:21:58 -05:00
penrods 8f2e5d9498 Change to Apache 2.0 license from GPLv3.0
This commit officially switches the mycroft-core repository from
GPLv3.0 licensing to Apache 2.0.  All dependencies on GPL'ed code
have been removed and we have contacted all previous contributors
with still-existing code in the repository to agree to this change.

Going forward, all contributors will sign a Contributor License
Agreement (CLA) by visiting https://mycroft.ai/cla, then they will
be included in the Mycroft Project's overall Contributor list,
found at: https://github.com/MycroftAI/contributors.  This cleanly
protects the project, the contributor and all who use the technology
to build upon.

Futher discussion can be found at this blog post:
https://mycroft.ai/blog/right-license/

This commit also removes all __author__="" from the code.  These
lines are painful to maintain and the etiquette surrounding their
maintainence is unclear.  Do you remove a name from the list if the
last line of code the wrote gets replaced?  Etc.  Now all
contributors are publicly acknowledged in the aforementioned repo,
and actual authorship is maintained by Github in a much more
effective and elegant way!

Finally, a few references to "Mycroft AI" were changed to the correct
legal entity name "Mycroft AI Inc."

==== Fixed Issues ====
#403 Update License.md and file headers to Apache 2.0
#400 Update LICENSE.md

====  Documentation Notes ====
Deprecated the ScheduledSkill and ScheduledCRUDSkill classes.
These capabilities have been superceded by the more flexible MycroftSkill
class methods schedule_event(), schedule_repeating_event(), update_event(),
and cancel_event().
2017-10-04 01:28:44 -05:00
Matthew D. Scholefield 5e392f34aa Optimize imports
Remove unused imports and group local vs external alphabetically
2017-09-18 16:07:50 -05:00
Matthew D. Scholefield cfdc405da5 Add new LOG class 2017-09-18 13:56:06 -05:00
Åke Forslund 1e74dd3ebe Restore reconnect timer on ws on connect
====  Tech Notes ====
The retry timer doubles on each failed connect attempt but was never
restored to the original time causing an unncessary long wait time. This
restores the timer on each sucessful connection.
2017-09-14 14:22:06 -05:00
Åke Forslund a33c07621b Reduce configuration loading in module scope
====  Tech Notes ====
Autoloading configuration in submodules is bad for testing purposes and
should be reduced. It takes time and adds the possibility of altering
the base conditions for the tests

- mycroft/skills/core: global configuration moved to main.py
- mycroft/messagebus/client/ws.py global config moved to __init__ of
Websocket
- client/speech/mic.py global config moved to ResponsiveRecognizer
__init__() method
- client/enclosure/display_manager.py
 - get_ipc_directory() called in methods where used
2017-09-13 12:51:48 -05:00
Åke Forslund 10e4660e3e Add some safety to remove_all_listers
The same websocket client object is often used between many different
parts of the software. (for example skills) This will reduce the risk
that all listeners are removed for all events by mistake. It it still
possible toi do this by calling
`WebsocketClient.ws.remove_all_listers()` if there would be need for
this mechanism.
2017-06-29 08:09:23 +02:00
Greg McCoy d7d0dbec5e Issues 788 - Adding remove_all_listeners 2017-06-29 07:54:05 +02:00
Jonathan D'Orleans 99ff4e3ce8 Issues 351 - Tartarus Integration
- Master rebase
- Renaming Websocket variable from client to ws
- Resetting enclosure when ws open
- Formatting pairing skill
2016-12-17 14:53:22 -05:00
Jonathan D'Orleans ccceb62b7a Issues 351 - Renaming metadata to data and simplifying data usage 2016-12-17 10:15:24 -05:00
Jonathan D'Orleans 348cc3fac0 Issues 351 - Renaming message_type to type 2016-12-17 10:15:24 -05:00
Jonathan D'Orleans db9c12c122 Issues 351 - Merging service and client web socket configuration 2016-12-17 10:14:42 -05:00
Ethan Ward decd04f626 Issues 198 - fix pairing skill 2016-06-20 16:52:05 -05:00
the7erm 11726d7d67 #131 added if for situations where the host is empty (#132)
* #131 added if for situations where the host is empty

* #132 modified mycroft.ini file and added exception.

* #132 modified mycroft.ini file and added exception.

* #132 removed comment

* #131 changed to ValueError, and added checks for ssl, port, host and path

* #131 changed to ValueError, and added checks for ssl, port, host and path

* #131 reverted utils - went another route

* #131 added empty string for ssl detection

* #131 created validate_param

* #131 pep8

* #131 oops missed route
2016-06-20 15:44:42 -04:00
Jonathan D'Orleans c46bc43e72 Issues 96 - Moving configuration to init 2016-06-09 18:26:10 -04:00
Jonathan D'Orleans efff3dbda6 Issues 96 - Renaming get_config to get only 2016-06-09 18:25:37 -04:00
Jonathan D'Orleans c22861114e Issues 54 - Displaying pairing code
- Ensuring pairing code is sent to the device after speaking
2016-06-02 19:30:11 -04:00
Ryan Sipes 8f2c451938 Fixed Missing License Headers on All Files.
GPL LIcense added to the top of each python file.
2016-05-26 11:16:13 -05:00
Leo Arias d618676089 Issues-4 - Fix pep8 errors. 2016-05-23 17:23:47 +00:00
Arron Atchison 6e42bb1736 In the 1970s computer users had to understand the arcane syntax of the machines they used. They programed their computers using the machine's native language and hardly gave it a thought.
The 1980s birthed a new form of interaction between computers and users.  For the first time computers became capable of understanding the most basic form of human communication - pointing and grunting.  The mouse and the GUI revolutionized computing and made computers accessible to the masses.

We have now entered a third era.  We are rapidly approaching a time when computer systems will understand human language and respond using the most natural form of human communication – speech.

This is an important development.  Some might even call it revolutionary.

Despite its importance, however, the technologies that will underpin this new method of interaction are the property of major tech firms who don't necessarily have the public's best interests at heart.

Not anymore.

Meet Mycroft – the worlds first open source natural language platform.  Mycroft understands human language and responds with speech.  It is being designed to run on anything from a phone to an automobile and will change the way we interact with open source technologies in profound ways.

Our goal here at Mycroft is to improve this technology to the point that when you interact with the software it is impossible to tell if you are talking to a human or a machine.

This initial release of the Mycroft software represents a significant effort by the Mycroft community to give the open source world access to this important technology.  We are all hoping that the software will be useful to the public and will help to usher in a new era of human machine interaction.

Our community welcomes everyone to use Mycroft, improve the software and contribute back to the project.  With your help and support we can truly make Mycroft an AI for everyone.

Joshua W Montgomery – May 17, 2016
2016-05-20 09:16:01 -05:00