Skip to main content

Pyzub: Manipulate subtitles

Pyzub is a small package and CLI for manipulating subtitles

Suported Formats:

  • SubRip [.srt].

** Plans to Support:**

  • SubStation Alpha [.ssa]
  • SubViewer [.sub]
  • Universal Subtitle Format [.usf]

Installation:

Run pip install pyzub

Command Line Interface:

At the moment only the slide command is available (arguably the most important feature). The slide command of pyzub lets you move your subtitles so you can synchronize your subtitles manually.

$ pyzub slide -h
Usage: pyzub slide [OPTIONS] FILEPATH

Options:
  --hours INTEGER
  --minutes INTEGER
  --seconds INTEGER
  --milliseconds INTEGER
  --overwrite             Modifies the subtitle file in place.
  --verbose               Displays a progress bar and a message when finished.
  --help, -h              Show this message and exit.

Example:

This will move your subtitles by 2.5 seconds (you can also give negative values).

$ pyzub slide Game_of_Thrones_s03ep09.srt --seconds 2 --milliseconds 500

By default it will generate an output file named Game_of_Thrones_s03ep09_MODIFIED.srt, unless --overwrite is used. The output file will always be in utf-8 encoding and use your system new line character.

Package:

You can read a subtitle file:

from pyzub.subfiles import SRTFile

filepath = '/home/user/mysubtitle.srt'
subfile = SRTFile(filepath)

Iterate over the file:

for subtitle in subfile:
	print(subtitle)   

Print a SRTFile:

print(subfile)
Path: /home/user/mysubtitle.srt
Codec: ISO-8859-1
Subtitles: 451

Get a subtitle:

# idx could be a number from 1 to 451 in this case
subtitle = subfile.get_subtitle(idx)

Print the subtitle:

print(subtitle)
Index: 1
Start Time: 00:00:04,605
End Time: 00:00:06,105
Text: En un día cualquiera,

An of course modify anything you want directly:

subtile.text = 'modified subtitle'
subtitle.start_time = timedelta(minutes=10)

# write the changes to disk
subfile.dump('/home/user/mysubtitle_modified.srt')

Planed features:

  • Automatic grammar and syntax correction
  • Automatic synchronization from audio
  • Automatic subtitle file downloads

License

MIT

Metadata

Release files for pyzub 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyzub 0.1.5
File Size Uploaded
pyzub-0.1.5.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyzub 0.1.5
File Interpreter ABI Platform
pyzub-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / pyzub-0.1.5.tar.gz

Download URL pyzub-0.1.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
51aff9f5ee7354c96b72b1533e6bf733e472a7cd056c190d0f16981ecdf1c343
BLAKE2b-256 checksum
How to use checksums
ca60265c6f807daacbe065c8b18be8712708986ce7f3cf42505730c3598e160b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyzub-0.1.5-py3-none-any.whl

Download URL pyzub-0.1.5-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5656f72d61ec810658f585df77ab401afda4d9775a331b6fbb8f9af8c58bba84
BLAKE2b-256 checksum
How to use checksums
ca7ed65a00153b623ee5e7a17e80a9c6a9a4002ed02c56123dd2502482f96014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.1.6

2 release files

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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