From 62d864e7afd963cb6336fd173561011905c33e69 Mon Sep 17 00:00:00 2001 From: Alejandro Mendez Date: Fri, 27 Mar 2020 19:54:53 +0100 Subject: [PATCH] Update version, history and fixes --- docs/history.rst | 10 ++++++++++ webvtt/__init__.py | 2 +- webvtt/parsers.py | 10 +++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/history.rst b/docs/history.rst index a405e00..3817c98 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -1,6 +1,16 @@ History ======= +0.4.4 (27-03-2020) +------------------ + +* Allow parsing empty SBV captions, thanks to `@ishunyu `_ (#26) +* Fix invalid time cues, thanks to `@sontek `_ (#19) +* Enable pytest as test runner, thanks to `@sontek `_ (#20) +* Packaging improvements +* Added Python 3.8 support +* Improve parsing empty lines + 0.4.3 (22-11-2019) Few improvements ----------------------------------- diff --git a/webvtt/__init__.py b/webvtt/__init__.py index 22b1fdf..ca1f767 100644 --- a/webvtt/__init__.py +++ b/webvtt/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.4.3' +__version__ = '0.4.4' from .webvtt import * from .segmenter import * diff --git a/webvtt/parsers.py b/webvtt/parsers.py index 6c0632e..55ab4f7 100644 --- a/webvtt/parsers.py +++ b/webvtt/parsers.py @@ -133,7 +133,7 @@ class SRTParser(TextBasedParser): SRT parser. """ - TIMEFRAME_LINE_PATTERN = re.compile('\s*(\d+:\d{2}:\d{2},\d{3})\s*-->\s*(\d+:\d{2}:\d{2},\d{3})') + TIMEFRAME_LINE_PATTERN = re.compile(r'\s*(\d+:\d{2}:\d{2},\d{3})\s*-->\s*(\d+:\d{2}:\d{2},\d{3})') PARSER_OPTIONS = { 'ignore_empty_captions': True @@ -155,9 +155,9 @@ class WebVTTParser(TextBasedParser): WebVTT parser. """ - TIMEFRAME_LINE_PATTERN = re.compile('\s*((?:\d+:)?\d{2}:\d{2}.\d{3})\s*-->\s*((?:\d+:)?\d{2}:\d{2}.\d{3})') - COMMENT_PATTERN = re.compile('NOTE(?:\s.+|$)') - STYLE_PATTERN = re.compile('STYLE[ \t]*$') + TIMEFRAME_LINE_PATTERN = re.compile(r'\s*((?:\d+:)?\d{2}:\d{2}.\d{3})\s*-->\s*((?:\d+:)?\d{2}:\d{2}.\d{3})') + COMMENT_PATTERN = re.compile(r'NOTE(?:\s.+|$)') + STYLE_PATTERN = re.compile(r'STYLE[ \t]*$') def __init__(self): super().__init__() @@ -279,7 +279,7 @@ class SBVParser(TextBasedParser): YouTube SBV parser. """ - TIMEFRAME_LINE_PATTERN = re.compile('\s*(\d+:\d{2}:\d{2}.\d{3}),(\d+:\d{2}:\d{2}.\d{3})') + TIMEFRAME_LINE_PATTERN = re.compile(r'\s*(\d+:\d{2}:\d{2}.\d{3}),(\d+:\d{2}:\d{2}.\d{3})') PARSER_OPTIONS = { 'ignore_empty_captions': True