Commit Graph

285 Commits (acbb0f0dc25c523f3ea287c8051398012a5876b3)

Author SHA1 Message Date
Chris Veilleux 4e9130114e remove validate_param since it's now unused 2019-07-19 08:16:54 +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
Å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 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 25026e9f4c Add docs for the mycroft.util.format module
- Adds a module docstring to both format and parse module
- Update toc with a short description for these members
- Fix slight formatting issues
2019-06-28 15:30:13 +02:00
Steve Penrod 5fb204fa1c Add mycroft.util.time.to_system()
Pulling method originally implemented in the default Mycroft skill-alarm, but useful by many for
converting a different timezone to whatever the native timezone is on the host machine.
2019-06-10 22:38:33 -05:00
Åke 32636fe55f Set default log level to INFO (#2070)
* Set default log level to INFO

* Restore echo functionality

- Make sure that the mycroft.debug.log message isn't removed by the
whitelist
- whitelist now only checks the beginning of a message so a whitelisted
"mycroft.audio.service" will allow messages such as
"mycroft.audio.service.play"

* Make MycroftSkill.log track root logger

modify root logger when changing log level will now change the log level
of the skill logger.

* Changes for debugging

* Switched bus logging to use INFO instead of DEBUG so it always displays when turned on
* Add exception output
* Replaced multiple calls into a msg_type variable
2019-04-22 14:06:01 -05:00
Chris Rogers 2a6f113151 Add function to acknowledge success non-verbally 2019-04-14 10:11:52 -04:00
jarbasal 64a58f3290 tonight remainder 2019-03-27 11:15:24 +00:00
Ruthvicp b28011681e handling tonight in date & time extraction (#2066)
* handling tonight in date & time extraction
2019-03-27 01:41:50 -05:00
jarbasal a788efd1d0 update to new lang scheme 2019-03-26 13:46:04 +01:00
jarbasal 42e258610e feature/format_pt 2019-03-26 13:45:59 +01:00
Åke 9f29649fc0 Feature/non hard coded paths (#2058)
* Allow ~ when running ensure_directory_exists

* Add custom paths for websettings cache and system conf
2019-03-21 13:19:11 -05:00
Åke 66f9f3f100
Merge pull request #2012 from MycroftAI/bugfix/audio-protection
Protect against failure to launch WAV/MP3
2019-03-15 10:28:17 +01:00
Steve Penrod 688d0e6704 Protect against failure to launch WAV/MP3/Ogg
The playback of WAV/MP3 could throw exceptions if something went
wrong, which seemed inappropriate.  Now it just generates an error
message in the log.
2019-03-15 09:57:04 +01:00
Steve Penrod a5dcc8d3d3 Fix unit test errors 2019-03-14 10:57:31 +01:00
Steve Penrod 44f60ec6f3 Change default lang to None, not English
Much of the code used "en-us" as the default value when not specified.
This limited the internationalization potential.  Changing the default
to None and adds the ability to define the default lang code from other
locations in code.  E.g.

```python

from mycroft.util.lang import set_default_lang

set_default_lang("en-us")
print("English date: "+nice_date(dt))

set_default_lang("de-de")
print("German date: "+nice_date(dt))
```

This allows easier localization of Skills by having the framework set the default without any changes necessary by the Skill writers.

Other minor changes:
* Changed the default return value of get_gender*() to None instead of False
2019-03-14 10:57:31 +01:00
Andreas Lorensen 6c0cd8d427 Add danish 2 - initial work to get danish to core (#2033)
* Danish formatting and parsing functions
2019-03-04 21:40:12 +01:00
Angel Docampo fdeb66c3e4 Fixed pep8 issues 2019-03-04 15:37:28 +01:00
Angel Docampo 9c22ced394 Initial castillian format translations
This commit add the initial translations of core functions for format
numbers: nice_number_es, pronounce_number_es and nice_time_es.

==== Localization Notes ====
NONE - Castillian (Spain's spanish)
2019-03-04 15:37:10 +01:00
Ruthvicp ec7ed25ed5 date and time - for tonight, weekdays (#2023)
* date and time - for tonight, weekdays

* Updating the previous commit test_extractdatetime_en

* Editing comments for extract_date_time_en

* Generalized as a marker

Expanded this from just handling "weekends" to any day or plural of the day, "weekend", "weekday" or "weekdays".
2019-02-28 01:15:55 -06:00
Ale df7dfaa006 Update parse_it.py to 18.8.12 (#1990)
* update functions in parse_it.py
* update tests
* translate docstrings to english
2019-02-27 08:00:50 +01:00
Åke e51e35f622
Merge pull request #2014 from MycroftAI/feature/fix-extract-duration
Correct extract_duration doc and failure value
2019-02-25 09:12:03 +01:00
Steve Penrod 684363ffaf Correct extract_duration doc and failure value
The documentation indicated an array instead of a tuple, plus
the default return value didn't match the documented return type.
2019-02-25 01:54:58 -06:00
Åke b4fc3ab389
Merge pull request #2011 from MycroftAI/feature/logging-control
Improve debug logging
2019-02-22 17:37:32 +01:00
Åke Forslund 5ce4754d94 Cleanup of broken and incorrect code
- Fix pep8 in util/__init__
- Remove half done if statement and fix codacy in text_client.py
- CAPITALIZE the log levels
2019-02-22 14:54:28 +01:00
Åke Forslund ae577a7ad7 Also update the log level of urllib3 2019-02-22 14:34:10 +01:00
Åke Forslund 53b0f34220 Fix setting log level 2019-02-22 14:33:21 +01:00
Steve Penrod deb3721f13
Fix PEP8 issues 2019-02-22 05:16:38 -06:00
Steve Penrod fbcfe6c816 Improve debug logging
Several changes to the logging using in all processes:
* Disable logging of bus messages by default (massively cleans up the logs)
* Add "mycroft.debug.log" bus message.  It supports the data={"bus": True/False} as well as
  data={"log": LEVEL}, where level is a Python logging level.

CLI now supports several commands:
* ```:log level XXX``` where XXX is the name of a standard Python level (e.g. 'debug')
* ```:log bus on``` or ```:log bus off```
* Removed the requirement for "log" in ```:clear log```.  ```:clear``` works now.
2019-02-22 05:11:16 -06:00
Åke d26650b143
Merge pull request #2004 from MycroftAI/feature/tweak-datetime-parse
Tweak English extract_datetime() parsing
2019-02-20 14:05:32 +01:00
Steve Penrod 631875d9c2 Tweak English extract_datetime() parsing
Ambiguous times previously used a generally unexpected rule about
when to jump 12 hours when parsing times.  Now it follows the rule:
If a time is spoken without am/pm indicator, assume the next time
that hasn't passed was intended.

For example:
  "at 7 o'clock"
Would mean 7:00am if spoken at 6:59am, but would mean 7:00pm
if spoken at 7:01am.
2019-02-20 01:56:20 -06:00
Matthew D. Scholefield 64571924e7 Add (|) syntax to dialog and voc files 2019-02-15 12:05:39 -06:00
Åke 65a7197519
Merge pull request #1977 from ChristopherRogers1991/feature/issue-1959
Add extract_duration() method
2019-02-13 16:08:49 +01:00
Steve Penrod 065273bf4f New formatters: nice_duration() and join_list() (#1988)
* New formatters:  nice_duration() and join_list()

Adding two new formatting functions:
* nice_duration(duration, lang="en-us", speech=True)
  Accept seconds or duration and produce a nice sounding duration.
  Example:  nice_duration(61) == "one minute one second"
            nice_duration(61, speech=False) == "1:01"
* join_list(items, connector, sep=None, lang="en-us")
  Example:  join_list(["a", "b", "c"], "and") == "a, b and c"

This includes a translation helper that uses text files in the
mycroft/res/text/LANG/ directory, such as "second.word".
2019-02-13 12:52:35 +01:00
Chris Rogers 113352339d Fix pep8 issues.
This is in support of issues-1959.
2019-02-12 17:29:21 -05:00
Chris Rogers 4bca969316 Log unsupported languages.
This extracts the logging logic that was being used in a few places to
indicate certain parcing functions are not supported in particular
languages, and adds the logging to extract_duration.
2019-02-12 17:01:16 -05:00
Chris Rogers acbe46aede Fix documentation
Fix typo and add an explanation for
_extract_number_with_text_en_helper.
2019-02-12 16:36:11 -05:00
Chris Rogers cc0d3da62c Change _Token to a namedtuple.
This is in support of issues-1959.
2019-02-12 16:23:53 -05:00
Ale 307910e53e update format_it.py test_format_it.py (#1984)
* Update format_it.py and tests
2019-02-11 18:07:14 +01:00
Chris Rogers 1bb74f5c79 Use isinstance instead of type.
This is in support of issues-1959.
2019-02-03 12:58:31 -05:00
Chris Rogers cdf7dc3756 Use datetime.timedelta for extract_duration_en.
This is in support of issues-1959.
2019-02-03 12:16:36 -05:00
Chris Rogers d50cb00de8 Fix pep8 issues.
This is in support of issues-1959.
2019-02-02 14:21:37 -05:00
Chris Rogers 9e193c74e0 Make constant and functions private.
Making things weak private, to limit surface area of support. As things
become increasingly stable/tested/useful, it may make sense to open them
up, but for now, keeping them private will limit risk.

This is in support of issue-1959.
2019-02-02 14:07:48 -05:00
Chris Rogers 351381bca2 Fix pep8 issues.
This is in support of issues-1959.
2019-02-02 14:03:19 -05:00
Chris Rogers 7049e65cbe Minor shuffling + update docs.
After many changes, things had gotten a little disorganized, and the
docs were a little out of date. This brings them up to date.

This is in support of issues-1959.
2019-02-02 13:45:22 -05:00
Chris Rogers 534ca2aff9 All regressions in number parsing fixed.
This is in support of issues-1959.
2019-02-02 13:12:25 -05:00
Chris Rogers 6da1ec5c6e Fix regression in number parsing.
Fix regression that caused "X and one half" to parse as just X.

This is in support of issues-1959.
2019-02-01 23:24:45 -05:00
Chris Rogers f4eee8726a Refactor many methods in parse_en.
This improves the utility of the _ReplaceableNumber class, and updates
most of the number parsing functions to take tokens rather than text.
This simplifies the interactions between many of the functions, as there
is no need to convert back and forth between text and tokens.

This also adds some tests. Note that there are a few regressions that
will be fixed in a subsequent commit.
2019-02-01 23:04:54 -05:00