Skip to main content

Python library for easier management and processing of subtitle files.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sublib-1.0.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

sublib-1.0.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file sublib-1.0.1.tar.gz.

File metadata

  • Download URL: sublib-1.0.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sublib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7f10a515b6dd557847c995a2db87f232fe85f25a174db4ea503b2524708ebaf1
MD5 f0f76f29291aeff52e330c8291906369
BLAKE2b-256 e3e711712196448a25891a664f9b24868178a5d60009a5bb77e0a35facd775b2

See more details on using hashes here.

File details

Details for the file sublib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sublib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sublib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4295a7b2796454ea0e7ea65683a253aac55faeec881daee8f07fc88ff424eb16
MD5 b7ca1eb6c08b2ac501bb76056a5b0fdb
BLAKE2b-256 6f8d6218de3fe25dd2d5b135432cecd54fdd9d4389cef2d7fd3d6478cff5bad4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page