From 6b03f821a141b995a91d3d21b4660ec5aad1be8f Mon Sep 17 00:00:00 2001 From: Tomas Karabela Date: Sun, 19 May 2024 02:28:05 +0200 Subject: [PATCH] Version 1.7.0 --- LICENSE.txt | 2 +- docs/conf.py | 2 +- docs/index.rst | 2 +- docs/release-notes.rst | 23 +++++++++++++++++++++++ pysubs2/common.py | 2 +- pysubs2/formats/microdvd.py | 7 ++++++- 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index bad9209..b29a6c1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2014-2023 Tomas Karabela +Copyright (c) 2014-2024 Tomas Karabela Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/conf.py b/docs/conf.py index b959952..08204fe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,7 +51,7 @@ # General information about the project. project = u'pysubs2' -copyright = u'2014-2023, Tomas Karabela' +copyright = u'2014-2024, Tomas Karabela' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/docs/index.rst b/docs/index.rst index 7eb8d0c..aae608e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -46,7 +46,7 @@ License .. code-block:: text - Copyright (c) 2014-2023 Tomas Karabela + Copyright (c) 2014-2024 Tomas Karabela Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 06c9557..dc8cfb5 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -1,6 +1,29 @@ Release Notes ============= +**1.7.0** --- released on 2024-05-19 + +- Added ``errors`` option for :meth:`pysubs2.load()`, :meth:`pysubs2.SSAFile.save()` and related methods, exposing + the encoding handling option of builtin function ``open()``. By default, this option uses value ``None`` which + is consistent with behaviour of previous versions of the library. However, it's possible to use ``"surrogateescape"`` + to bypass the need to specify correct character encoding in some cases (see the tutorial). In the CLI, surrogateescape + is now the default behaviour. +- SubStation writer now correctly handles timestamps which are not rounded to centiseconds, for example + ``00:36:48,998`` from a SRT file no longer produces the invalid ASS timestamp ``0:36:48.100`` (Issue #83), + patch by moi15moi (https://github.com/moi15moi) +- MicroDVD parser now only uses FPS declaration from the first subtitle if the line starts with ``{1}{1}``, + matching VLC Player behaviour; the old behaviour is available under the ``strict_fps_inference`` reader option + (Issue #71) +- SubStation writer now omits fractional part for numeric values if it is zero, patch by Andrey Efremov (https://github.com/PalmtopTiger) +- CLI now shows help message when called without arguments (Issue #81), patches by Northurland (https://github.com/Northurland) and Andrey Efremov (https://github.com/PalmtopTiger) +- pysubs2 now raises correct exception (:class:`pysubs2.exceptions.FormatAutodetectionError`) when attempting to read + a JSON file that was not saved by pysubs2 (Issue #85) +- More robust SubStation parser (Issues #87, #89) +- Added test data to source distribution (Issue #75) +- Code now passes MyPy check in strict mode, as well as Ruff check +- Added support for Python 3.12, removed support for Python 3.7 + + **1.6.1** --- released on 2023-04-02 - WebVTT now correctly writes events in cue start order, patch by Anton Melser (https://github.com/AntonOfTheWoods) diff --git a/pysubs2/common.py b/pysubs2/common.py index e41b816..8296612 100644 --- a/pysubs2/common.py +++ b/pysubs2/common.py @@ -58,7 +58,7 @@ def to_ssa_alignment(self) -> int: #: Version of the pysubs2 library. -VERSION = "1.6.1" +VERSION = "1.7.0" IntOrFloat = Union[int, float] diff --git a/pysubs2/formats/microdvd.py b/pysubs2/formats/microdvd.py index c907ada..228dd35 100644 --- a/pysubs2/formats/microdvd.py +++ b/pysubs2/formats/microdvd.py @@ -34,11 +34,16 @@ def from_file(cls, subs: "SSAFile", fp: TextIO, format_: str, fps: Optional[floa Keyword args: strict_fps_inference: If True (default), in the case when ``fps`` is not given, it will be read from the first subtitle text only if the start and end frame of this subtitle is ``{1}{1}`` - (matches VLC Player behaviour), otherwise `UnknownFPSError` is raised. When ``strict_fps_inference`` + (matches VLC Player behaviour), otherwise :class:`pysubs2.exceptions.UnknownFPSError` is raised. + + When ``strict_fps_inference`` is False, framerate will be read from the first subtitle text in this case regardless of start and end frame (which may result in bogus result, if the first subtitle is not supposed to contain framerate). Before introduction of this option, the library behaved as if this option was False. + + .. versionchanged:: 1.7.0 + Added the ``strict_fps_inference`` option. """ for line in fp: match = MICRODVD_LINE.match(line)