Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/python-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- master
- main
workflow_dispatch:

permissions:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/python-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Python Linter
on:
pull_request:
push:
branches:
- master

permissions:
contents: read
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Run Python Tests
on:
pull_request:
push:
branches:
- master

permissions:
contents: read
Expand All @@ -14,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

runs-on: ${{ matrix.os }}

Expand Down
118 changes: 109 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,131 @@ from pyasstosrt import Subtitle
sub = Subtitle('sub.ass', remove_duplicates=True)
sub.export()
```

You can get a list of all styles in the file and filter subtitles by style names.

```python
from pyasstosrt import Subtitle

# Get list of all styles in the file
sub = Subtitle('sub.ass')
styles = sub.get_styles()
print(styles) # ['Default', 'Alt', 'Signs', 'Credits']

# Export only styles with "Default" in name (e.g., Default, Default_dvd)
sub = Subtitle('sub.ass', only_default_style=True)
sub.export()

# Export only Default style
sub = Subtitle('sub.ass', include_styles=['Default'])
sub.export()

# Export only Default and Alt styles
sub = Subtitle('sub.ass', include_styles=['Default', 'Alt'])
sub.export()

# Exclude Signs and Credits styles
sub = Subtitle('sub.ass', exclude_styles=['Signs', 'Credits'])
sub.export()
```

CLI
------------

### 🎬 Export Command

Convert ASS/SSA subtitle files to SRT format with various options.

**Basic usage:**
```bash
pyasstosrt export subtitle.ass
```

**Specify output directory:**
```bash
pyasstosrt export subtitle.ass --output-dir /path/to/output
# or use short form
pyasstosrt export subtitle.ass -o /path/to/output
```

**Remove effects and duplicates:**
```bash
pyasstosrt export subtitle.ass --remove-effects --remove-duplicates
# or use short form
pyasstosrt export subtitle.ass -r -d
```

**Process multiple files at once:**
```bash
pyasstosrt export subtitle1.ass subtitle2.ass subtitle3.ass
```

**Style filtering options:**
```bash
# Export only styles with "Default" in name (e.g., Default, Default_dvd)
pyasstosrt export subtitle.ass --only-default

# Export only specific styles
pyasstosrt export subtitle.ass --include-styles "Default,Signs"

# Exclude specific styles
pyasstosrt export subtitle.ass --exclude-styles "Signs,Credits"
```

**Custom encoding:**
```bash
pyasstosrt export /Users/user/sub/sub.ass
pyasstosrt export subtitle.ass --encoding utf-16
```

**Optional** You can specify an export folder.
**Print dialogues to console:**
```bash
pyasstosrt export /Users/user/sub/sub.ass --output-dir /Users/user/sub/srt
pyasstosrt export subtitle.ass --output-dialogues
```

**Optional** If you want to remove effects from text, you can use the --remove-effects flag.
### 🎨 Styles Command

List all unique styles found in an ASS subtitle file.

**Basic usage:**
```bash
pyasstosrt styles subtitle.ass
```

**Display in table format:**
```bash
pyasstosrt styles subtitle.ass --table
# or use short form
pyasstosrt styles subtitle.ass -t
```

### 🔧 General Options

**Show version:**
```bash
pyasstosrt export /Users/user/sub/sub.ass --remove-effects --output-dir /Users/user/sub/srt
pyasstosrt --version
# or
pyasstosrt -v
```

**Optional** If you need to remove duplicates, you can use the --remove-duplicates flag.
**Show help:**
```bash
pyasstosrt export /Users/user/sub/sub.ass --remove-duplicates
pyasstosrt --help
pyasstosrt export --help
pyasstosrt styles --help
```

**Optional** You can use the flags together --remove-duplicates --remove-effects
**Enable shell completion:**
```bash
pyasstosrt export /Users/user/sub/sub.ass --remove-duplicates --remove-effects
# For bash
pyasstosrt --install-completion bash

# For zsh
pyasstosrt --install-completion zsh

# For fish
pyasstosrt --install-completion fish
```

Installation
------------
Most users will want to simply install the latest version, hosted on PyPI:
Expand Down
Loading