Sublib
Python library for easier management and processing of subtitle files. Easily manage their content and conveniently use it in your own projects.
Features
- Read files data
- Convert subtitles formats
- Process content separated into lines
- Search for strings in data
- Acquire specific lines
- Detect used format
Installation
Download the latest version from PyPi
python -m pip install sublib
Testing
Perform the tests with pytest and pytest-mock
python -m pytest tests
Basic usage
First of all, import the package
import sublib
Each of the supported formats of subtitles is represent by its class
# Create a subtitle instance
subtitle = sublib.SubRip("subtitle.srt", "utf-8")
All subtitles classes have a few methods and attributes
# Get object content in a universal format
general = subtitle.get_general_format()
# Set a new object from this format
another_subtitle = sublib.MicroDVD()
another_subtitle.set_from_general_format(general)
# Print subtitle lines
print(another_subtitle.content)
Advanced usage
Please, take a look if you need more details
Contributing
Pull requests are welcome!
Metadata
Release files for sublib 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sublib-1.2.1.tar.gz | 18.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sublib-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.3 kB
Release files / sublib-1.2.1.tar.gz
| Download URL | sublib-1.2.1.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a041287d77087685272b88b4cbc01435b67d08f0088a0f757688a6fad4b8864
|
|
BLAKE2b-256 checksum How to use checksums |
645967e0e54d8d606b4c58766aba6d49bcde2a809a5a155f62b930d80f765b33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.0
|
Release files / sublib-1.2.1-py3-none-any.whl
| Download URL | sublib-1.2.1-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6eb38bea3ab2aa47de3719d9fdcb5ce09df4f34145199dcf160fb44cbe555e7f
|
|
BLAKE2b-256 checksum How to use checksums |
37686f3befb492e46625eef9d7c8c0416b17a62fcc4c154cbf90a443fd11074d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.0
|