CLI implementation of the sublib package.
Features
- Detect used format
- Convert subtitles formats
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
Perform the tests with pytest
and pytest-mock
.
python -m pytest tests
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
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
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"
Supported:
Full name | Short name | Default ext. |
---|---|---|
MPlayer2 | mpl | .txt |
SubRip | srt | .srt |
MicroDVD | sub | .sub |
TMPlayer | tmp | .txt |
Pull requests are welcome!