diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 96559f1..3ff408d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,8 +23,9 @@ pip install -r requirements-dev.txt pytest ``` -Your branch should also pass MyPy typecheck with no errors: +Your branch should also pass Ruff and strict MyPy checks with no errors: ```sh -mypy +mypy --strict +ruff check ``` diff --git a/README.md b/README.md new file mode 100644 index 0000000..4dc5a68 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +pysubs2 +======= + +[![pysubs2 build master branch](https://img.shields.io/github/actions/workflow/status/tkarabela/pysubs2/main.yml?branch=master)](https://github.com/tkarabela/pysubs2/actions) +[![pysubs2 test code coverage](https://img.shields.io/codecov/c/github/tkarabela/pysubs2)](https://app.codecov.io/github/tkarabela/pysubs2) +[![Static Badge](https://img.shields.io/badge/MyPy%20%26%20Ruffle-checked-blue?style=flat)](https://github.com/tkarabela/pysubs2/actions) +[![PyPI - Version](https://img.shields.io/pypi/v/pysubs2.svg?style=flat)](https://pypi.org/project/pysubs2/) +[![PyPI - Status](https://img.shields.io/pypi/status/pysubs2.svg?style=flat)](https://pypi.org/project/pysubs2/) +[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pysubs2.svg?style=flat)](https://pypi.org/project/pysubs2/) +[![PyPI - License](https://img.shields.io/pypi/l/pysubs2.svg?style=flat)](LICENSE.txt) +[![GitHub Repo stars](https://img.shields.io/github/stars/tkarabela/pysubs2?style=flat&label=GitHub%20stars)](https://github.com/tkarabela/pysubs2) + + +pysubs2 is a Python library for editing subtitle files. +It’s based on *SubStation Alpha*, the native format of +[Aegisub](http://www.aegisub.org/); it also supports *SubRip (SRT)*, +*MicroDVD*, *MPL2*, *TMP* and *WebVTT* formats and *OpenAI Whisper* captions. + +There is a small CLI tool for batch conversion and retiming. + +```bash +pip install pysubs2 +pysubs2 --shift 0.3s *.srt +pysubs2 --to srt *.ass +``` + +```python +import pysubs2 +subs = pysubs2.load("my_subtitles.ass", encoding="utf-8") +subs.shift(s=2.5) +for line in subs: + line.text = "{\\be1}" + line.text +subs.save("my_subtitles_edited.ass") +``` + +To learn more, please [see the documentation](http://pysubs2.readthedocs.io). +If you'd like to contribute, see [CONTRIBUTING.md](CONTRIBUTING.md). + +pysubs2 is licensed under the MIT license (see [LICENSE.txt](LICENSE.txt)). diff --git a/README.rst b/README.rst deleted file mode 100644 index cefc476..0000000 --- a/README.rst +++ /dev/null @@ -1,53 +0,0 @@ -pysubs2 -======= - - -.. image:: https://img.shields.io/github/actions/workflow/status/tkarabela/pysubs2/main.yml?branch=master - :alt: pysubs2 build master branch - :target: https://github.com/tkarabela/pysubs2/actions -.. image:: https://img.shields.io/codecov/c/github/tkarabela/pysubs2 - :alt: pysubs2 test code coverage - :target: https://app.codecov.io/github/tkarabela/pysubs2 -.. image:: http://www.mypy-lang.org/static/mypy_badge.svg - :alt: MyPy checked - :target: https://github.com/tkarabela/pysubs2/actions -.. image:: https://img.shields.io/pypi/v/pysubs2.svg?style=flat-square - :alt: PyPI - Version - :target: https://pypi.org/project/pysubs2/ -.. image:: https://img.shields.io/pypi/status/pysubs2.svg?style=flat-square - :alt: PyPI - Status - :target: https://pypi.org/project/pysubs2/ -.. image:: https://img.shields.io/pypi/pyversions/pysubs2.svg?style=flat-square - :alt: PyPI - Python Version - :target: https://pypi.org/project/pysubs2/ -.. image:: https://img.shields.io/pypi/l/pysubs2.svg?style=flat-square - :alt: PyPI - License - :target: LICENSE.txt - - -pysubs2 is a Python library for editing subtitle files. -It’s based on *SubStation Alpha*, the native format of -`Aegisub `_; it also supports *SubRip (SRT)*, -*MicroDVD*, *MPL2*, *TMP* and *WebVTT* formats and *OpenAI Whisper* captions. - -There is a small CLI tool for batch conversion and retiming. - -.. code:: bash - - $ pip install pysubs2 - $ pysubs2 --shift 0.3s *.srt - $ pysubs2 --to srt *.ass - -.. code:: python - - import pysubs2 - subs = pysubs2.load("my_subtitles.ass", encoding="utf-8") - subs.shift(s=2.5) - for line in subs: - line.text = "{\\be1}" + line.text - subs.save("my_subtitles_edited.ass") - -To learn more, please `see the documentation `_. -If you'd like to contribute, see `CONTRIBUTING.md `_. - -pysubs2 is licensed under the MIT license (see `LICENSE.txt `_). diff --git a/docs/index.rst b/docs/index.rst index f9f9436..7eb8d0c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,11 +5,11 @@ pysubs2 is a Python library for editing subtitle files. It’s based on *SubStat the native format of `Aegisub `_; it also supports *SubRip (SRT)*, *MicroDVD*, *MPL2*, *TMP* and *WebVTT* formats. There is a small CLI tool for batch conversion and retiming. -.. code-block:: text +.. code-block:: bash - $ pip install pysubs2 - $ pysubs2 --shift 0.3s *.srt - $ pysubs2 --to srt *.ass + pip install pysubs2 + pysubs2 --shift 0.3s *.srt + pysubs2 --to srt *.ass .. code-block:: python @@ -20,10 +20,10 @@ the native format of `Aegisub `_; it also supports *Su line.text = "{\\be1}" + line.text subs.save("my_subtitles_edited.ass") -The library works in Python 3.7 or newer, with no extra dependencies. +The library works in Python 3.8 or newer, with no extra dependencies. It’s available under the MIT license (see bottom of the page). To get started, simply install it using `pip `_: ``pip install pysubs2``. -You can also clone `the GitHub repository `_ and install via ``python setup.py install``. +You can also clone `the GitHub repository `_. If you find a bug or have something to say, please let me know `via GitHub `_ or email (tkarabela at seznam dot cz). Your feedback is much appreciated. Thanks! diff --git a/setup.cfg b/setup.cfg index 4c77464..1a221ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,8 +4,8 @@ version = attr: pysubs2.common.VERSION author = Tomas Karabela author_email = tkarabela@seznam.cz description = A library for editing subtitle files -long_description = file: README.rst -long_description_content_type = text/x-rst +long_description = file: README.md +long_description_content_type = text/markdown url = https://github.com/tkarabela/pysubs2 keywords = SubStation, SubRip, MicroDVD, MPL2, WebVTT, ass, srt, sub, vtt, subtitles, captions license = MIT