### Install Subby using Git and Pip Source: https://github.com/vevv/subby/blob/main/README.md Clones the Subby repository from GitHub and installs it using pip. This is the standard method for setting up the project locally. ```shell git clone https://github.com/vevv/subby cd subby pip install . ``` -------------------------------- ### Subby Command Line Interface Usage Source: https://github.com/vevv/subby/blob/main/README.md Demonstrates how to use the Subby command-line interface for converting and processing subtitle files. It outlines the main commands like 'convert', 'process', and 'version'. ```shell Usage: subby [OPTIONS] COMMAND [ARGS]... Subby—Advanced Subtitle Converter and Processor. Options: -d, --debug Enable DEBUG level logs. --help Show this message and exit. Commands: convert Convert a Subtitle to SubRip (SRT). process SubRip (SRT) post-processing. version Print version information. ``` ```shell subby process /path/to/subs/subs.srt strip-sdh ``` -------------------------------- ### Chain Subtitle Conversion and Processing Source: https://github.com/vevv/subby/blob/main/README.md Demonstrates chaining multiple Subby processing steps, such as converting a VTT file, stripping SDH content, and applying fixes. This allows for a multi-stage subtitle processing pipeline. ```python from subby import WebVTTConverter, CommonIssuesFixer, SDHStripper from pathlib import Path converter = WebVTTConverter() fixer = CommonIssuesFixer() stripper = SDHStripper() file = Path('file.vtt') file_sdh = Path('file_sdh.srt') file_stripped = Path('file_stripped.srt') srt, _ = fixer.from_srt(converter.from_file(file)) srt.save(file_sdh) # saved to file_sdh.srt stripped, status = stripper.from_srt(srt) if status is True: print('stripping successful') stripped.save(file_stripped) # saved to file_stripped.srt ``` -------------------------------- ### Convert Subtitles using WebVTTConverter Source: https://github.com/vevv/subby/blob/main/README.md Shows how to use the `WebVTTConverter` class to convert subtitle files from various formats (like VTT) to SRT. It accepts input via file, string, or bytes and saves the output to an SRT file. ```python from subby import WebVTTConverter from pathlib import Path converter = WebVTTConverter() file = Path('test.vtt') # All statements below are equivalent srt = converter.from_file(file) srt = converter.from_string(file.read_text()) srt = converter.from_bytes(file.read_bytes()) # srt is subby.SubRipFile output = Path('file.srt') srt.save(output) # saved to file.srt ``` -------------------------------- ### Process Subtitles with CommonIssuesFixer Source: https://github.com/vevv/subby/blob/main/README.md Illustrates using the `CommonIssuesFixer` class for post-processing SRT subtitles. It can fix common issues and strip SDH content, returning the processed subtitles and a status indicating if changes were made. ```python from subby import CommonIssuesFixer from pathlib import Path processor = CommonIssuesFixer() file = Path('test.vtt') # All statements below are equivalent srt, status = processor.from_file(file) srt, status = processor.from_string(file.read_text()) srt, status = processor.from_bytes(file.read_bytes()) # srt is subby.SubRipFile, status is bool output = Path('test_fixed.srt') srt.save(output) # saved to test_fixed.srt ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.