Skip to content

0.9.0

Latest

Choose a tag to compare

@glut23 glut23 released this 06 Dec 11:10
7187763

0.9.0 prepares for 1.0. It has the behaviour changes and the deprecation warnings, so that 1.0 only removes what warns here. Read the upgrade notes before upgrading, and run your tests with -W error::DeprecationWarning to find what changes in 1.0.

Changes that may need updates

  • Cue text is read with one tokenizer: cue tags are read across line breaks, voice names have their whitespace normalized, and voice spans can have classes with any character.
  • Caption.text, voice and voices resolve character references such as &, as do SRT and SBV output.
  • The text of SRT and SBV files is read as it is shown: & stays &, and tags other than the SRT formatting tags are text.
  • validate() reports repeated cue and region identifiers.
  • Reading WebVTT replaces NULL characters with U+FFFD, as the WebVTT parser does.
  • Saving writes to a temporary file and then replaces the file, so a failed save keeps the previous contents.
  • The internal modules webvtt.vtt, srt, sbv and utils are renamed webvtt._vtt and so on. Their old names work until 1.0 with a warning.

Deprecated, changing in 1.0

  • Setting Caption.text to a value with &, < or >: set cue text with the new raw_text setter, and escape plain text with webvtt.escape().
  • Changing the fields of a Timestamp, creating one with fields out of their range, and assigning to Caption.start_time or end_time anything other than a time.
  • The old names of the internal modules.

Added

  • Caption.raw_text setter, webvtt.escape() and Timestamp.from_milliseconds.
  • Timestamp and the error classes can be imported from webvtt, and webvtt.__all__ lists the public API.

Fixed

  • An encoding error in a later HLS segment no longer leaves earlier segment files written.
  • WebVTT output ends with a line break also after footer comments.

The changelog has every change.

Thanks

Thanks to @mirad-tech for resolving character references and preserving SRT and SBV text (#219, #249), @xmsnmo444 for atomic saving (#252), @X6M-Work for normalizing voice names (#223), @MurphyforCrystal for the HLS fix (#240), @anandprivate06 for the NULL characters (#255) and @DicksonWu654 for reporting them (#254), @kevincommits for the final line break (#256), and Andorra, an AI agent at iLands, for reporting repeated identifiers and the patch #258 started from.

Thanks also to @emirmrkaljevic for #250: it was not merged, but it made the trade-off of keeping SRT indexes as identifiers clear.