Skip to main content

library to load, edit and save different formats of subtitles

Project description

undertext

library to load, edit and save different formats of subtitles

PyPI - Version

[!NOTE] This Project is under development. Come back soon for updates

Installation

pip3 install undertext

File Formats

ext name read write Flags
.ass Advanced SubStation Alpha TT
.sbv SubViewer TT
.srt SubRip TT
.ssa Sub Station Alpha TT
.sub MicroDVD TF
.vtt WebVTT TT

Listed formats that are currently unsupported may be added at a later version

Flag Information:

T. = Text Based
B. = Bitmap Based
.T = Time-Based
.F = Frame-Based

Examples

import undertext

captions = undertext.loads("example.en.srt")
undertext.dumps(captions, "example.en.vtt")
import undertext

captions = [
    undertext.Caption(start=0, end=10, text="Hello"),
    undertext.Caption(start=10, end=20, text="World"),
]
undertext.dumps(captions, "out.srt")

CLI

[!NOTE] During the installation the undertext command should be installed and then available. If this didn't work you can invoke it with python3 -m undertext instead.

$ cat example.vtt
WEBVTT

00:00:00.000 --> 00:00:01.000
hello world 0

00:00:02.000 --> 00:00:03.000
hello world 2

00:00:04.000 --> 00:00:05.000
hello world 4

00:00:06.000 --> 00:00:07.000
hello world 6

00:00:08.000 --> 00:00:09.000
hello world 8
$ undertext read example.vtt
<00:00:00.000 -> 00:00:01.000> 'hello world 0'
<00:00:02.000 -> 00:00:03.000> 'hello world 2'
<00:00:04.000 -> 00:00:05.000> 'hello world 4'
<00:00:06.000 -> 00:00:07.000> 'hello world 6'
<00:00:08.000 -> 00:00:09.000> 'hello world 8'
$ undertext convert example.vtt output.srt 
$ cat output.srt
1
00:00:00,000 --> 00:00:01,000
hello world 0

2
00:00:02,000 --> 00:00:03,000
hello world 2

3
00:00:04,000 --> 00:00:05,000
hello world 4

4
00:00:06,000 --> 00:00:07,000
hello world 6

5
00:00:08,000 --> 00:00:09,000
hello world 8

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

undertext-0.4.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

undertext-0.4.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file undertext-0.4.0.tar.gz.

File metadata

  • Download URL: undertext-0.4.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for undertext-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a0a8c9039a04f2cdb5d5df4fd31895379ffc73295f993500dab09836c2f2f42f
MD5 746a2f802ee6c8ef39c395e76b669606
BLAKE2b-256 7ae12f7d87dc2ffa470deeae8310432495422b88aed1f9bd230803547c7f8fc0

See more details on using hashes here.

File details

Details for the file undertext-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: undertext-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for undertext-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 218256c84506f49e59cd737dc8b1190b60f929cd81e41d4c0a10b1a65eb64627
MD5 def628a9d578f762f8c919ca7b3f6749
BLAKE2b-256 548f5c9c9ee33258598f1510e050c13e70b886b45a841723ddbf65a7e7553cd7

See more details on using hashes here.

Supported by

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