Commit Graph

3192 Commits (0a748b2636656880120c7dc62dafe9b6eae8528d)

Author SHA1 Message Date
Steve Penrod 1e5ff1392f Feedback from code review
Several small changes based on the code review feedback:
* Drop '_' from classes like Enclosure_Mark1
* Adopt Python 3 style for class definitions and don't explicitly list '(object)'
* Slightly better documentation
* Moved MycroftSkill.show_html() to SkillGUI, resulting in code like self.gui.show_page('Weather.qml')
* Renamed SkillGUI.__dict to SkillGUI.__session_data.  This better reflects the
  how values are accessed in the QML.
2018-12-05 01:40:43 -06:00
Åke Forslund 70655bd9b6 Handle missing "enclosure" section in system config
Default to empty dict instead of None if the "enclosure" section is missing
2018-12-05 07:53:35 +01:00
Åke Forslund 7036c19bfc Add posibility to give bonus for visual skills
CQSVisualMatchLevel can be returned and if the device is a mark-2 a bonus will be given to the skill.
2018-12-04 23:47:52 +01:00
Åke Forslund 5b168c753b Add CommonQuerySkill class
Adds support for negotiating best answer for a questions

Currently three levels of confidence are defined

EXACT: If the query could be identified exactly and a response is returned.
    Example: The cockail skill could find a cocktail in the query that exists in
             it's database.

CATEGORY: A category of questions the skill handles could be identified.
    Example: The wiki-data skill can identify that the question is regarding
             A date of birth and finds an answer.

GENERAL: A general question and answer service could parse the question.
    Example: The wolfram alpha skill got a match for "How tall is Abraham
             Lincoln".
2018-12-04 22:58:25 +01:00
Åke 375becd6b4
Merge pull request #1893 from danielwine/feature/add-hungarian-language
Feature/add hungarian language
2018-12-04 15:25:22 +01:00
danielwine 7ec96b0d07 Add format_hu and update format.py along with tests 2018-12-04 15:09:20 +01:00
Steve Penrod 07bd6ef7af Code cleanup
Fixing PEP8 and such before merging into 'dev' branch.
2018-12-03 17:33:26 -06:00
danielwine 373e9f884f Add Hungarian dialog files 2018-12-01 20:38:43 +01:00
Steve Penrod 54daa84786 Support non-translated resources, QML under 'ui' folder
The QML files are typically not translated like other Mycroft resources,
they have internal translation tools.  And at times there are other
resources that don't need to be translated all the time, for example
color strings like "AliceBlue" which might be used by non-English
speakers.

So now the translation mechanism looks for resource file X as follows:
1) Look for <res_dir>/<lang>/X
2) Look for <res_dir>/X
3) Look for anywhere under locale/<lang>/.../X

And now the show_page() method starts looking for resources under the skill/ui folder.
2018-11-30 16:26:01 -06:00
Matthew D. Scholefield 69467dddd7
Merge pull request #1885 from forslund/feature/msm-0.6.1
Feature/msm 0.6.2
2018-11-30 11:20:40 -06:00
Steve Penrod 0ff744529b * Add tracking of the active namespaces for the GUI. Currently the namespace list
is kept in order, but old namespaces/skills are never culled.
* The active namespace list is synced on a GUIConnection level
* QML display requests now are sent as a list instead of a single entry, i.e.
  with "gui_urls" instead of "gui_url".  Currently a skill can only send a single
  QML, however.
* Change CLI GUI client to handle "gui_urls" instead of "gui_url"
2018-11-30 03:04:53 -06:00
Åke Forslund 41c6e86aec Changes on google's side requires update of gtts
updates the gtts and gtts-token module to the latest version.
2018-11-30 09:20:26 +01:00
Åke Forslund 9364b69834 Always use a fresh msm instance
- Use a fresh msm instance to  automatically load the skills_data
- write skills_data.json is now automagic so explicit write isn't needed.
2018-11-29 16:45:31 +01:00
Åke Forslund 8757f45bc9 Update msm to 0.6.2 2018-11-29 16:45:31 +01:00
Åke Forslund ec63492628 Add backwards compatibility
Make sure the older version of the install skill will still work. The SettingsManager.load/write_skills_data() will return the version 0 format of the skills_data and the write_skills_data() will convert to the version 1 format before doing the write.
2018-11-29 16:44:58 +01:00
Åke Forslund 8167396eb9 Add skills.json handling through msm
- Lock msm when doing an update
- Add device enpoint for uploading skills.json
- Add configuration value for skill store updates
- Upload skills manifest after update
2018-11-29 16:44:58 +01:00
Åke 169a55f576
Merge pull request #1879 from krisgesling/bugfix/issue-1877
Issue-1877 - fix ordinal followed by one
2018-11-26 09:36:56 +01:00
Åke Forslund 77c76416d3 Update "third one" test to match behaviour 2018-11-26 09:26:43 +01:00
Kris Gesling 32a3860bce Issue-1877 - fix ordinal followed by one
"Third one" will now return the expected 3 instead of 1.
2018-11-26 09:25:44 +01:00
Steve Penrod 685a729994 Enhance CLI GUI client
The GUI client built-in to the CLI now has these features:
* Activate/deactivate via Ctrl+G
* GUI 'window' shows active page title and all namespace variables
* Add fool-proof primitive draw(x,y, msg) that takes care of clipping, and padding
2018-11-23 09:29:16 -06:00
devs-mycroft 3e6dedbbcc Version bump from 18.8.5 to 18.8.6 2018-11-22 14:34:06 +00:00
Matthew D. Scholefield 9aadd59d44
Merge pull request #1887 from forslund/feature/upgrade-msk
Upgrade msk to 0.3.12
2018-11-21 09:38:59 -06:00
Matthew D. Scholefield ed07229304
Merge pull request #1886 from MycroftAI/bugfix/skill-tester-skill-id
include skill_id in response
2018-11-21 09:35:08 -06:00
Åke Forslund af8da5e39a Upgrade msk to 0.3.12
This includes the new msk submit action
2018-11-21 12:26:41 +01:00
Åke Forslund 7dcffab3f9 include skill_id in response
The intent_service now require the skill_id field to exist in the response, the converse request response now respons with the requested skill_id
2018-11-21 10:56:13 +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
JarbasAI 29310363d7 fix converse (#1884)
- Fix Exception on non-existing instances crashes the handle_converse_request()
- Report error to intent service
- Cleanup of converse related code.
2018-11-20 14:31:49 +01:00
Michael Nguyen e19062cccd
Merge pull request #1871 from forslund/bugfix/audioservice-stop
Bugfix CPS Starting audio
2018-11-19 14:54:54 -06:00
Jaime Muñoz Martín 70cb8251d7 Catalan translation added (#1881)
Add catalan
2018-11-19 20:43:26 +01:00
JarbasAI 60d2905678 feature/extract multiple numbers from text (#1867)
Add extract_numbers() function

The function extracts all numbers from the input string and returns them as a list.
2018-11-19 12:39:59 +01:00
Åke 4e35604d70
Merge pull request #1870 from JarbasAl/feature/improve_datetime
improve datetime parsing
2018-11-17 09:14:41 +01:00
jarbasal fa2b3007a9 improve datetime parsing with long times and a couple
add support for decades, centuries, millemniums
add support for "within the hour", "in a second/minute",
add support for "a couple time_unit" and "a couple of time_unit"
2018-11-17 09:03:41 +01:00
Åke 77c0b1c626
Merge pull request #1873 from JarbasAl/bugfix/utt_remainder
bugfix/utterance remainder, only replace complete words
2018-11-17 09:00:33 +01:00
jarbasal 4e3667e21c Only replace complete words in message remainder
Replace str.replace() with simple regex
2018-11-17 08:35:40 +01:00
Åke 3fc39e8ed2 Skilltester extension for Common Playback Skill functions (#1864)
* Add lt and gt to skill tester evaluation vocabulary

lt returns True if message item is LESS THAN the value in the config
gt returns True if message item is GREATER THAN the value in the config

* Add separate Exception for Skilltest errors

* Add support for common playback skill messages

CPS_query:

new test json possibilities
play_query: Emits a message that can be catched by CPS_match_query_phrase()
play_query_match: Structure with info of the expected match
  "phrase": matched phrase
  "confidence_threshold": The minimum confidence the phrase should result in

Example:
{
  "play_query": "the news",
  "play_query_match": {
    "phrase": "the news",
    "confidence_threshold":  0.8
  }
}

"play_start": Emits message that can be catched by CPS_start using sub-fields.
  "phrase": matched phrase
  "callback_data": dict with info for the function

Example:
{
  "play_start": {
    "phrase": "the news",
    "callback_data": {
    }
  },
  "expected_data": {"__type__": "mycroft.audio.service.play"}
}
2018-11-16 17:58:17 -06:00
Kathy Reid af386b974f
Merge pull request #1872 from MycroftAI/documentation/new-modules
Update api documentation
2018-11-16 22:41:41 +11:00
Åke Forslund a67a60a8eb Remove bare except 2018-11-16 12:14:09 +01:00
Åke Forslund 986e70ec9b Add docstrings for play_* methods 2018-11-16 12:03:42 +01:00
Åke Forslund bf390bcac9 Fix typos in CommonPlaySkill docstrings 2018-11-16 11:50:48 +01:00
Åke Forslund a2a059302d Fix outdatede references in the documentation
Correct the docs reference to the old name of the extract_number and remove the nonexisting convert_number reference.
2018-11-16 11:49:17 +01:00
Åke Forslund c659faaf92 remove the old generate_sdk_docs.py
replace it with sphinxdoc

./start-mycroft.sh sdkdoc html will generate the same documentation as
on readthedocs.org
2018-11-15 17:49:53 +01:00
Åke Forslund 9aab8ded74 Add CommonPlaySkill and utils to docs
Added
- CommonPlaySkill
- mycroft.util.parse
- mycroft.util.time
2018-11-15 17:33:52 +01:00
Åke Forslund 8859ff1d3b Don't stop audio right after play start
The common play skill sends a stop message in the CPS_start(), if the play message is sent too close to the stop message it may be executed before the stop message causing playback to immediately stop.

To circumvent this a 1 second stop ignore time is added.
2018-11-15 13:57:17 +01:00
Francis Tyers fad4c71398 Update mycroft.conf (#1869)
Make it clearer how to blacklist skills, e.g. it's the `basename()` of the directory where the skill lives.
2018-11-12 20:23:04 -05:00
devs-mycroft b596b4296d Version bump from 18.8.4 to 18.8.5 2018-11-08 15:46:48 +00:00
Steve Penrod dbd3675156 Fixing a few bugs and adding test code to fire up a weather skill visualization upon GUI connection.
Still very much a work in progress.

For understand and testing, here is the sequence:

STEP 1:  GUI announces itself
* Connect to the main Mycroft messagebus
* Send:  "mycroft.gui.connected" with data { "gui_id": XXX } where XXX is a uniq ID (uuid)

STEP 2:  Mycroft creates GUI socket
* Mycroft extracts the gui_id
* Mycroft prepares a socket and announces its availability on the Mycroft messagebus with:
        self.bus.emit(Message("mycroft.gui.port",
                              {"port": self.GUIs[gui_id].port,
                               "gui_id": gui_id}))

STEP 3:  GUI connects
In python, a very minimal test socket handler on the GUI side would look like this

  from websocket import create_connection

  port = 18181 (from the message above)
     ws = create_connection("ws://0.0.0.0:"+port+"/gui")

  ws.send("Hello, World")
  print("Sent")
  print("Receiving...")
  result =  ws.recv()
  print("Received '%s'" % result)
  ws.close()
2018-11-07 11:06:57 -06:00
Åke 279256f515
Merge pull request #1866 from JarbasAl/datetime_improvements
extract date time improvement/bugfix
2018-11-07 09:11:38 +01:00
jarbasal d9a905c8b1 extract date time improvements 2018-11-07 04:14:21 +00:00
Steve Penrod aede71db86 First pass at support for the Qt/QML display:
Enclosures
* Create a mechanism to instantiate unique Enclosure classes, depending on the platform found in the SYSTEM mycroft.conf
* Implement a generic Enclosure, which support the new GUI protocol
* Implement a Mark 1 Enclosure (expects the serial connection to an Arduino)
* Implement the start of a Mark II enclosure
* Implement a generic enclosure (no screen)
* Implement the GUI announcement and protocol basics

MycroftSkill
* Implement the basis of the GUI-controlling interfaces.  Namely:
  - MycroftSkill.show_text()
  - MycroftSkill.show_image()
  - MycroftSkill.show_html()
  - MycroftSkill.show_page()
  - MycroftSkill.gui to set values for page displays.

Configuration
* Add "gui_websocket" to the mycroft.config.py
2018-11-06 01:48:16 -06:00
Kathy Reid 1de272cf6e
Merge pull request #1861 from MycroftAI/feature/mycroft-skill-member-docs
Update MycroftSkill api documentation
2018-11-06 02:55:59 +11:00