Skip to main content

Sublib

Python library for easier management and processing of subtitle files.

Releases Python Version License GPLv3 CodeFactor

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

GNU GPLv3

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)

Source distribution for sublib 1.0.1
File Size Uploaded
sublib-1.0.1.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sublib 1.0.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page