fifthleaf / sublib-cli

Script to detect and change the format of subtitle files using the command line.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sublib-CLI

Release Min. Python version License GPLv3 Code quality Tests

CLI implementation of the sublib package.

Features

  • Detect used format
  • Convert subtitles formats

Installation

Users on all platforms can use python script. For Windows users there is also executable version made with pyinstaller.

If you are developer please download whole project via git clone or archive.

Remember to install dependencies!
User: pip install -r requirements.txt
Developer: pip install -r requirements_dev.txt

Testing

Perform the tests with pytest and pytest-mock.

python -m pytest tests

Usage

To check your current format:

python sublib_cli.py detect <path>

To convert subtitles to a different format:

python sublib_cli.py convert <path> <format>

For more help:

python sublib_cli.py --help

Examples

This will display format of the specified subtitle file.

python sublib_cli.py detect "D:\Video\Se7en.txt"

This will display format for each subtitle file in Video directory.

python sublib_cli.py detect "D:\Video"

This will convert the specified file to SubRip format.

python sublib_cli.py convert "D:\Video\Se7en.sub" srt

This will convert all the subtitle files in the Video directory to MicroDVD format.

python sublib_cli.py convert "D:\Video" sub

This will convert all the subtitle files in the current folder to MPlayer2 format.

python sublib_cli.py convert "." mpl

Logging

By default, the program creates logs only when it encounters a fatal error. You can this behavior using log flag.

To log into the default file:

python sublib_cli.py convert "D:\Video\Se7en.sub" srt --log

To log to a specific file:

python sublib_cli.py detect "D:\Video\Se7en.sub" --log "mylog.log"

Formats

Supported:

Full name Short name Default ext.
MPlayer2 mpl .txt
SubRip srt .srt
MicroDVD sub .sub
TMPlayer tmp .txt

Contributing

Pull requests are welcome!

About

Script to detect and change the format of subtitle files using the command line.

License:GNU General Public License v3.0


Languages

Language:Python 100.0%