Changelog¶
2.2.0 (2020-11-14)¶
Features¶
Switch to the newer Google TTS API (thanks to @Boudewijn26!). See his great writeup for more on the methodology and why this was necessary. (#226, #232, #236, #241)
Deprecations and Removals¶
Removed automatic language download from the main code, which has become too unreliable & slow. Languages will still be fetched but a pre-generated list will be shipped with
gTTS. (#233, #241, #242, #243)Because languages are now pre-generated, removed custom TLD support for language URL (which allowed to get language names in other than English) (#245)
2.1.2 (2020-11-10)¶
2.1.0 (2020-01-01)¶
Features¶
The
gttsmoduleAdded the ability to customize the Google Translate URL hostname. This is useful when
google.commight be blocked within a network but a local or different Google host (e.g.google.cn) is not (#143, #203):New
gTTS()parametertldto specify the top-level domain to use for the Google hostname, i.ehttps://translate.google.<tld>(default:com).Languages are also now fetched using the same customized hostname.
Pre-generated TTS API request URLs can now be obtained instead of writing an
mp3file to disk (for example to be used in an external program):New
get_urls()method returns the list of URLs generated bygTTS, which can be used in lieu ofwrite_to_fp()orsave().
The
gtts-clicommand-line toolOther
Added Python 3.8 support (#204)
2.0.4 (2019-08-29)¶
2.0.3 (2018-12-15)¶
2.0.2 (2018-12-09)¶
2.0.1 (2018-06-20)¶
2.0.0 (2018-04-30)¶
(#108)
Features¶
The
gttsmoduleNew logger (“gtts”) replaces all occurrences of
print()Languages list is now obtained automatically (
gtts.lang) (#91, #94, #106)Added a curated list of language sub-tags that have been observed to provide different dialects or accents (e.g. “en-gb”, “fr-ca”)
New
gTTS()parameterlang_checkto disable language checking.gTTS()now delegates thetexttokenizing to the API request methods (i.e.write_to_fp(),save()), allowinggTTSinstances to be modified/reusedRewrote tokenizing and added pre-processing (see below)
New
gTTS()parameterspre_processor_funcsandtokenizer_functo configure pre-processing and tokenizing (or use a 3rd party tokenizer)Error handling:
Added new exception
gTTSErrorraised on API request errors. It attempts to guess what went wrong based on known information and observed behaviour (#60, #106)gTTS.write_to_fp()andgTTS.save()also raisegTTSErroron gtts_token errorgTTS.write_to_fp()raisesTypeErrorwhenfpis not a file-like object or one that doesn’t take bytesgTTS()raisesValueErroron unsupported languages (andlang_checkisTrue)More fine-grained error handling throughout (e.g. request failed vs. request successful with a bad response)
Tokenizer (and new pre-processors):
Rewrote and greatly expanded tokenizer (
gtts.tokenizer)Smarter token ‘cleaning’ that will remove tokens that only contain characters that can’t be spoken (i.e. punctuation and whitespace)
Decoupled token minimizing from tokenizing, making the latter usable in other contexts
New flexible speech-centric text pre-processing
New flexible full-featured regex-based tokenizer (
gtts.tokenizer.core.Tokenizer)New
RegexBuilder,PreProcessorRegexandPreProcessorSubclasses to make writing regex-powered text pre-processors and tokenizer cases easierPre-processors:
Re-form words cut by end-of-line hyphens
Remove periods after a (customizable) list of known abbreviations (e.g. “jr”, “sr”, “dr”) that can be spoken the same without a period
Perform speech corrections by doing word-for-word replacements from a (customizable) list of tuples
Tokenizing:
The
gtts-clicommand-line toolRewrote cli as first-class citizen module (
gtts.cli), powered by ClickWindows support using setuptool’s entry_points
Better support for Unicode I/O in Python 2
All arguments are now pre-validated
New
--nocheckflag to skip language pre-checkingNew
--allflag to list all available languagesEither the
--fileoption or the<text>argument can be set to “-” to read fromstdinThe
--debugflag uses logging and doesn’t pollutestdoutanymore
Bugfixes¶
_minimize(): Fixed an infinite recursion loop that would occur when a token started with the miminizing delimiter (i.e. a space) (#86)_minimize(): Handle the case where a token of more than 100 characters did not contain a space (e.g. in Chinese).Fixed an issue that fused multiline text together if the total number of characters was less than 100
Fixed
gtts-cliUnicode errors in Python 2.7 (famous last words) (#78, #93, #96)
Deprecations and Removals¶
Dropped Python 3.3 support
Removed
debugparameter ofgTTS(in favour of logger)gtts-cli: Changed long option name of-oto--outputinstead of--destinationgTTS()will raise aValueErrorrather than anAssertionErroron unsupported language
Improved Documentation¶
Rewrote all documentation files as reStructuredText
Comprehensive documentation writen for Sphinx, published to http://gtts.readthedocs.io
Changelog built with towncrier
1.2.1 (2017-08-02)¶
1.1.6 (2016-07-20)¶
1.1.5 (2016-05-13)¶
1.1.4 (2016-02-22)¶
Features¶
Spun-off token calculation to gTTS-Token (#23, #29)