subtitle-filter


Namesubtitle-filter JSON
Version 1.4.9 PyPI version JSON
download
home_pagehttps://github.com/mattlyon93/filter-subs
SummaryFilter SDH entries and more from .srt files
upload_time2024-03-09 12:37:00
maintainer
docs_urlNone
authorMatt Lyon
requires_python>=3.5
licenseMIT License
keywords subtitle sdh hard-of-hearing filter movie tv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # subtitle-filter
[![PyPI version](https://badge.fury.io/py/subtitle-filter.svg)](https://badge.fury.io/py/subtitle-filter)

Filter `.srt` subtitle files to remove SDH (Deaf or Hard-of-Hearing) entries and other tags.

## Installation
```
pip install subtitle-filter
```

## Usage
`subtitle-filter` can be used either as a script or a module.

By default, this module filters the following (in order):

1. Removes font tags and text contained within, e.g. `<font color="#DF01D7">Hey\</font>` is removed.
2. Removes subtitle entries containing asterisks: `*`.
3. Removes subtitle lines containing `♪` or `#`.
4. Removes sound effects: text contained with and including parenthesis `(BANG)`, brackets `[boom]`, and text contained within forward slashes `/POW/`.
5. Replaces names with dashes, e.g. `GARY: Hey` or `Gary: Hey` to `- Hey`.
6. Removes author tags e.g. `XoXo Subtitles by PwnedDude967 XoXo`.
7. Fixes erroneous comma spacing, e.g. `Hey , what's up? Nothing,my man` to `Hey, what's up? Nothing, my man`.
8. Removes lone symbols such as `?`, `-`, `#`, `_`.

### Script Usage
Bring up the help display:
```bash
filter-subtitles.py -h
```

Filter a subtitle in place (overwrites original subtitle) with default options.
```bash
filter-subtitles.py -s /path/to/sub.srt
```

Instead of saving to disk, print the output.
```bash
filter-subtitles.py -s /path/to/sub.srt -p
```

Save the output to a different filepath.
```bash
filter-subtitles.py -s /path/to/sub.srt -o /path/to/outsub.srt
```

Custom filter flags.
```
--keep-fonts          Do not remove font tags and text contained within.
--keep-ast            Do not remove subtitles containing asterisks: (*).
--keep-music          Do not lines containing 1 or more "♪" symbols.
--keep-effects        Do not remove text between and including parenthesis
                        () or brackets []
--keep-names          Do not replace names in CAPITALS with "-" tags
--keep-author         Do not remove author tags, eg. Subtitles by some guy.
```

### Module Usage
Filter a subtitle in place (overwrites original subtitle) with default options
```python
from subtitle_filter import Subtitles

subs = Subtitles('/path/to/sub.srt')
subs.filter()
subs.save()
```
Instead of saving to disk, print the output.
```python
subs.print()
```
Save the output to a different filepath.
```python
subs.save('/path/to/newsub.srt')
```

Use custom filter flags.
```python
subs.filter(
    rm_fonts=True,
    rm_ast=False,
    rm_music=True,
    rm_effects=True,
    rm_names=False,
    rm_author=False,
)
```

### Issues & Requests

If you spot any issues with the filtered subtitles, or would like to request new features, please create an issue on GitHub and provide examples.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mattlyon93/filter-subs",
    "name": "subtitle-filter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "subtitle,SDH,hard-of-hearing,filter,movie,tv",
    "author": "Matt Lyon",
    "author_email": "matthewlyon18@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/98/df/6b1457f5046de5fa2eea0c7273ac8cdbb3aa764a20eb47aae76f03fa004a/subtitle-filter-1.4.9.tar.gz",
    "platform": null,
    "description": "# subtitle-filter\n[![PyPI version](https://badge.fury.io/py/subtitle-filter.svg)](https://badge.fury.io/py/subtitle-filter)\n\nFilter `.srt` subtitle files to remove SDH (Deaf or Hard-of-Hearing) entries and other tags.\n\n## Installation\n```\npip install subtitle-filter\n```\n\n## Usage\n`subtitle-filter` can be used either as a script or a module.\n\nBy default, this module filters the following (in order):\n\n1. Removes font tags and text contained within, e.g. `<font color=\"#DF01D7\">Hey\\</font>` is removed.\n2. Removes subtitle entries containing asterisks: `*`.\n3. Removes subtitle lines containing `\u266a` or `#`.\n4. Removes sound effects: text contained with and including parenthesis `(BANG)`, brackets `[boom]`, and text contained within forward slashes `/POW/`.\n5. Replaces names with dashes, e.g. `GARY: Hey` or `Gary: Hey` to `- Hey`.\n6. Removes author tags e.g. `XoXo Subtitles by PwnedDude967 XoXo`.\n7. Fixes erroneous comma spacing, e.g. `Hey , what's up? Nothing,my man` to `Hey, what's up? Nothing, my man`.\n8. Removes lone symbols such as `?`, `-`, `#`, `_`.\n\n### Script Usage\nBring up the help display:\n```bash\nfilter-subtitles.py -h\n```\n\nFilter a subtitle in place (overwrites original subtitle) with default options.\n```bash\nfilter-subtitles.py -s /path/to/sub.srt\n```\n\nInstead of saving to disk, print the output.\n```bash\nfilter-subtitles.py -s /path/to/sub.srt -p\n```\n\nSave the output to a different filepath.\n```bash\nfilter-subtitles.py -s /path/to/sub.srt -o /path/to/outsub.srt\n```\n\nCustom filter flags.\n```\n--keep-fonts          Do not remove font tags and text contained within.\n--keep-ast            Do not remove subtitles containing asterisks: (*).\n--keep-music          Do not lines containing 1 or more \"\u266a\" symbols.\n--keep-effects        Do not remove text between and including parenthesis\n                        () or brackets []\n--keep-names          Do not replace names in CAPITALS with \"-\" tags\n--keep-author         Do not remove author tags, eg. Subtitles by some guy.\n```\n\n### Module Usage\nFilter a subtitle in place (overwrites original subtitle) with default options\n```python\nfrom subtitle_filter import Subtitles\n\nsubs = Subtitles('/path/to/sub.srt')\nsubs.filter()\nsubs.save()\n```\nInstead of saving to disk, print the output.\n```python\nsubs.print()\n```\nSave the output to a different filepath.\n```python\nsubs.save('/path/to/newsub.srt')\n```\n\nUse custom filter flags.\n```python\nsubs.filter(\n    rm_fonts=True,\n    rm_ast=False,\n    rm_music=True,\n    rm_effects=True,\n    rm_names=False,\n    rm_author=False,\n)\n```\n\n### Issues & Requests\n\nIf you spot any issues with the filtered subtitles, or would like to request new features, please create an issue on GitHub and provide examples.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Filter SDH entries and more from .srt files",
    "version": "1.4.9",
    "project_urls": {
        "Download": "https://github.com/mattlyon93/filter-subs/archive/v1.4.9.tar.gz",
        "Homepage": "https://github.com/mattlyon93/filter-subs"
    },
    "split_keywords": [
        "subtitle",
        "sdh",
        "hard-of-hearing",
        "filter",
        "movie",
        "tv"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "100d1befc0943bcd9b50f4fb41d4d1a53d1a1b51bb6bb289934028722dd72e62",
                "md5": "dcf6ece079996b955524625b1cc4b494",
                "sha256": "c8e593ee0751adbbfc3b06ad1e6800b755b7bc84d43d3b70c2230bdebb7701c1"
            },
            "downloads": -1,
            "filename": "subtitle_filter-1.4.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dcf6ece079996b955524625b1cc4b494",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 8138,
            "upload_time": "2024-03-09T12:36:58",
            "upload_time_iso_8601": "2024-03-09T12:36:58.516402Z",
            "url": "https://files.pythonhosted.org/packages/10/0d/1befc0943bcd9b50f4fb41d4d1a53d1a1b51bb6bb289934028722dd72e62/subtitle_filter-1.4.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98df6b1457f5046de5fa2eea0c7273ac8cdbb3aa764a20eb47aae76f03fa004a",
                "md5": "c2f1bd6b3a1e462762f3513fa9bca55a",
                "sha256": "51589f47512c79fe1538f0c0b11066bc03a830325e2ff118f157d6ae966601ab"
            },
            "downloads": -1,
            "filename": "subtitle-filter-1.4.9.tar.gz",
            "has_sig": false,
            "md5_digest": "c2f1bd6b3a1e462762f3513fa9bca55a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 8193,
            "upload_time": "2024-03-09T12:37:00",
            "upload_time_iso_8601": "2024-03-09T12:37:00.208218Z",
            "url": "https://files.pythonhosted.org/packages/98/df/6b1457f5046de5fa2eea0c7273ac8cdbb3aa764a20eb47aae76f03fa004a/subtitle-filter-1.4.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-09 12:37:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mattlyon93",
    "github_project": "filter-subs",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "subtitle-filter"
}
        
Elapsed time: 0.20436s