subdeloc-tools


Namesubdeloc-tools JSON
Version 0.9.0 PyPI version JSON
download
home_pagehttps://github.com/EfronC/subdeloc_tools
SummarySubtitles delocalizer tools.
upload_time2024-10-21 02:04:34
maintainerNone
docs_urlNone
authorEfrain Cardenas
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements modify-subs pysubs2
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Subtitle Delocalizer Tools
----------------------------

## SubTools

Main class

Common usage
```
res = pairsubs.pair_files("main_subtitle.ass", "japanese_reference.ass") # Generates PairSubtitles JSON
s = self.search_honorifics(res) # Modify texts in the PairSubtitles JSON, adding the required honorifics
honorific_fixer.fix_original("main_subtitle.ass", s) # Generates a new ASS file with updated subtitles
```

## Modules

### Extract Subs

Extract subtitle file from an MKV based on the index or the lang(Requires FFMPEG). Extracts both ASS and SRT subtitles.

```
from subdeloc_tools.modules import extract_subs

generated_filename = extract_subs_by_lang("subtitle.ass", "eng")
generated_filename = extract_subs_by_index("subtitle.srt", 1)
```

### Merger

Mux/Demux subs from an MKV file.

```
from .merger import Merger

merger = Merger()
merger.set_file("subtitle.mkv")
streams = merger.get_streams()
index = merger.get_language_index("en")
generated_filename = merger.demux("subtitle.mkv", index, "output.ass")
```

### Shift Subs

Shift subtitles a determined amount of seconds. Allows to choose a threshold to choose from which point to shift.

```
from subdeloc_tools.modules import shift_subs

generated_filename = shift_sub("subtitle.ass", 10, 102900) # Shift 10 seconds from 00:01:42
generated_filename = shift_sub("subtitle.ass", 10, 0) # Shift 10 seconds all subs
```

### Pair subs

Pair 2 subtitle file subs based on the time. Generates a PairSubtitles JSON

```
from subdeloc_tools.modules import pairsubs

res = pairsubs.pair_files("main_subtitle.ass", "japanese_reference.ass")
```

### Honorific Fixer

Receives a PairSubtitles JSON, and an ASS file used to generate it, and creates a new ASS file with the modified subs

```
from subdeloc_tools.modules import honorific_fixer

honorific_fixer.fix_original("main_subtitle.ass", s)
```

## Glossary

PairSubtitles JSON
```
[
  {
    "start": 0,
    "end": 12250,
    "reference": [
      {
        "start": 0,
        "end": 12180,
        "text": "こんにちは世界",
        "nl": 1
      }
    ],
    "original": [
      {
        "start": 1000,
        "end": 12250,
        "text": "Hello World",
        "nl": 1
      }
    ]
  },
  ...
]
```

Sister projects:
- [C Tools](https://github.com/EfronC/subdeloc_helper)
- [Delocalizer](https://github.com/EfronC/Delocalizer)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EfronC/subdeloc_tools",
    "name": "subdeloc-tools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Efrain Cardenas",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# Subtitle Delocalizer Tools\n----------------------------\n\n## SubTools\n\nMain class\n\nCommon usage\n```\nres = pairsubs.pair_files(\"main_subtitle.ass\", \"japanese_reference.ass\") # Generates PairSubtitles JSON\ns = self.search_honorifics(res) # Modify texts in the PairSubtitles JSON, adding the required honorifics\nhonorific_fixer.fix_original(\"main_subtitle.ass\", s) # Generates a new ASS file with updated subtitles\n```\n\n## Modules\n\n### Extract Subs\n\nExtract subtitle file from an MKV based on the index or the lang(Requires FFMPEG). Extracts both ASS and SRT subtitles.\n\n```\nfrom subdeloc_tools.modules import extract_subs\n\ngenerated_filename = extract_subs_by_lang(\"subtitle.ass\", \"eng\")\ngenerated_filename = extract_subs_by_index(\"subtitle.srt\", 1)\n```\n\n### Merger\n\nMux/Demux subs from an MKV file.\n\n```\nfrom .merger import Merger\n\nmerger = Merger()\nmerger.set_file(\"subtitle.mkv\")\nstreams = merger.get_streams()\nindex = merger.get_language_index(\"en\")\ngenerated_filename = merger.demux(\"subtitle.mkv\", index, \"output.ass\")\n```\n\n### Shift Subs\n\nShift subtitles a determined amount of seconds. Allows to choose a threshold to choose from which point to shift.\n\n```\nfrom subdeloc_tools.modules import shift_subs\n\ngenerated_filename = shift_sub(\"subtitle.ass\", 10, 102900) # Shift 10 seconds from 00:01:42\ngenerated_filename = shift_sub(\"subtitle.ass\", 10, 0) # Shift 10 seconds all subs\n```\n\n### Pair subs\n\nPair 2 subtitle file subs based on the time. Generates a PairSubtitles JSON\n\n```\nfrom subdeloc_tools.modules import pairsubs\n\nres = pairsubs.pair_files(\"main_subtitle.ass\", \"japanese_reference.ass\")\n```\n\n### Honorific Fixer\n\nReceives a PairSubtitles JSON, and an ASS file used to generate it, and creates a new ASS file with the modified subs\n\n```\nfrom subdeloc_tools.modules import honorific_fixer\n\nhonorific_fixer.fix_original(\"main_subtitle.ass\", s)\n```\n\n## Glossary\n\nPairSubtitles JSON\n```\n[\n  {\n    \"start\": 0,\n    \"end\": 12250,\n    \"reference\": [\n      {\n        \"start\": 0,\n        \"end\": 12180,\n        \"text\": \"\u3053\u3093\u306b\u3061\u306f\u4e16\u754c\",\n        \"nl\": 1\n      }\n    ],\n    \"original\": [\n      {\n        \"start\": 1000,\n        \"end\": 12250,\n        \"text\": \"Hello World\",\n        \"nl\": 1\n      }\n    ]\n  },\n  ...\n]\n```\n\nSister projects:\n- [C Tools](https://github.com/EfronC/subdeloc_helper)\n- [Delocalizer](https://github.com/EfronC/Delocalizer)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Subtitles delocalizer tools.",
    "version": "0.9.0",
    "project_urls": {
        "Homepage": "https://github.com/EfronC/subdeloc_tools"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5670693ec3aaec44f2955215e858762b4b4caf378fd4402d2e123d5fdad904b6",
                "md5": "e102905f4f8770c8bf8d110e4e041507",
                "sha256": "34df5c729763f4182a176700416235b343bc2cc9d71636f614e5084593902b6f"
            },
            "downloads": -1,
            "filename": "subdeloc_tools-0.9.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e102905f4f8770c8bf8d110e4e041507",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 25085,
            "upload_time": "2024-10-21T02:04:34",
            "upload_time_iso_8601": "2024-10-21T02:04:34.924389Z",
            "url": "https://files.pythonhosted.org/packages/56/70/693ec3aaec44f2955215e858762b4b4caf378fd4402d2e123d5fdad904b6/subdeloc_tools-0.9.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 02:04:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EfronC",
    "github_project": "subdeloc_tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "modify-subs",
            "specs": [
                [
                    "==",
                    "0.4.0"
                ]
            ]
        },
        {
            "name": "pysubs2",
            "specs": [
                [
                    "==",
                    "1.7.3"
                ]
            ]
        }
    ],
    "lcname": "subdeloc-tools"
}
        
Elapsed time: 0.40852s