Sublib
Python library for easier management and processing of subtitle files.
Installation
Currently, sublib supports releases of Python 3.6 onwards. To install the current release:
pip install --upgrade sublib
Getting Started
You have a few function at your disposal.
detect(file_name, file_encoding)
from sublib import detect
# This will detect subrip format
file_format = detect("subtitle.srt", "utf-8")
from_mpl(opened_file), to_mpl(general_lines)
from sublib import from_mpl, to_mpl
# This will read MPlayer2 file and convert to general list
with open("subtitle.txt", "rt", encoding="utf-8") as file:
general_list = from_mpl(file)
# This will read lines from general list and convert to MPlayer2 format
formated_lines = to_mpl(general_list)
from_srt(opened_file), to_srt(general_lines)
from sublib import from_srt, to_srt
# This will read SubRip file and convert to general list
with open("subtitle.srt", "rt", encoding="utf-8") as file:
general_list = from_srt(file)
# This will read lines from general list and convert to SubRip format
formated_lines = to_srt(general_list)
from_sub(opened_file), to_sub(general_lines)
from sublib import from_sub, to_sub
# This will read MicroDVD file and convert to general list
with open("subtitle.sub", "rt", encoding="utf-8") as file:
general_list = from_sub(file)
# This will read lines from general list and convert to MicroDVD format
formated_lines = to_sub(general_list)
from_tmp(opened_file), to_tmp(general_lines)
from sublib import from_tmp, to_tmp
# This will read TMPlayer file and convert to general list
with open("subtitle.txt", "rt", encoding="utf-8") as file:
general_list = from_tmp(file)
# This will read lines from general list and convert to TMPlayer format
formated_lines = to_tmp(general_list)
Supported formats
- as srt - SubRip (.srt)
- as sub - MicroDVD (.sub)
- as mpl - MPlayer2 (.txt)
- as tmp - TMPlayer (.txt)
Contributing
Pull requests are welcome.
License
Release files for sublib 1.0.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.0.1.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sublib-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.0 kB
Release files / sublib-1.0.1.tar.gz
| Download URL | sublib-1.0.1.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f10a515b6dd557847c995a2db87f232fe85f25a174db4ea503b2524708ebaf1
|
|
BLAKE2b-256 checksum How to use checksums |
e3e711712196448a25891a664f9b24868178a5d60009a5bb77e0a35facd775b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|
Release files / sublib-1.0.1-py3-none-any.whl
| Download URL | sublib-1.0.1-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4295a7b2796454ea0e7ea65683a253aac55faeec881daee8f07fc88ff424eb16
|
|
BLAKE2b-256 checksum How to use checksums |
6f8d6218de3fe25dd2d5b135432cecd54fdd9d4389cef2d7fd3d6478cff5bad4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
|