translator-deepl


Nametranslator-deepl JSON
Version 0.2.10 PyPI version JSON
download
home_page
SummaryTraslate a .SRT file using any custom translator
upload_time2024-02-21 07:45:06
maintainer
docs_urlNone
author
requires_python>=3.6
licenseFREE
keywords python srt languages translator subtitles
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SRTranslator

## Install

[PyPI](https://pypi.org/project/srtranslator/)

```bash
pip install srtranslator
```

## Usage in Blender

[tin2tin](https://github.com/tin2tin) has made this [blender addon](https://github.com/tin2tin/import_subtitles). Check it out.

## Usage from script

Import stuff

```python
import os
from srtranslator import SrtFile
from srtranslator.translators.deepl_api import DeeplApi
from srtranslator.translators.deepl_handler import DeeplTranslator
from srtranslator.translators.translatepy import TranslatePy
```

Initialize translator. It can be any translator, even your own, check the docs, there are instructions per translator and how to create your own.

```python
translator = DeeplTranslator() # or TranslatePy() or DeeplApi(api_key)
```

Load, translate and save. For multiple recursive files in folder, check `examples folder`

```python
filepath = "./filepath/to/srt"
srt = SrtFile(filepath)
srt.translate(translator, "en", "es")

# Making the result subtitles prettier
srt.wrap_lines()

srt.save(f"{os.path.splitext(filepath)[0]}_translated.srt")
```

Quit translator

```python
translator.quit()
```

## Usage from GUI

[KryptoST](https://github.com/KryptoST) has made a graphical user interface. You can check it out [here](https://github.com/KryptoST/SRTranslatorGUI)

## Usage command line

```bash
python -m srtranslator ./filepath/to/srt -i SRC_LANG -o DEST_LANG
```

## Advanced usage

```
usage: __main__.py [-h] [-i SRC_LANG] [-o DEST_LANG] [-v] [-vv] [-s] [-w WRAP_LIMIT] [-t {deepl-scrap,translatepy,deepl-api}] [--auth AUTH] path

Translate an .STR file

positional arguments:
  path                  File to translate

options:
  -h, --help            show this help message and exit
  -i SRC_LANG, --src-lang SRC_LANG
                        Source language. Default: auto
  -o DEST_LANG, --dest-lang DEST_LANG
                        Destination language. Default: es (spanish)
  -v, --verbose         Increase output verbosity
  -vv, --debug          Increase output verbosity for debugging
  -s, --show-browser    Show browser window
  -w WRAP_LIMIT, --wrap-limit WRAP_LIMIT
                        Number of characters -including spaces- to wrap a line of text. Default: 50
  -t {deepl-scrap,translatepy,deepl-api}, --translator {deepl-scrap,translatepy,deepl-api}
                        Built-in translator to use
  --auth AUTH           Api key if needed on translator
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "translator-deepl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "python,srt,languages,translator,subtitles",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/95/30/2bf7ebd0bbf99df7a8003a9e0f59528456bf48ceb5138a6c1612b073d15a/translator_deepl-0.2.10.tar.gz",
    "platform": null,
    "description": "# SRTranslator\n\n## Install\n\n[PyPI](https://pypi.org/project/srtranslator/)\n\n```bash\npip install srtranslator\n```\n\n## Usage in Blender\n\n[tin2tin](https://github.com/tin2tin) has made this [blender addon](https://github.com/tin2tin/import_subtitles). Check it out.\n\n## Usage from script\n\nImport stuff\n\n```python\nimport os\nfrom srtranslator import SrtFile\nfrom srtranslator.translators.deepl_api import DeeplApi\nfrom srtranslator.translators.deepl_handler import DeeplTranslator\nfrom srtranslator.translators.translatepy import TranslatePy\n```\n\nInitialize translator. It can be any translator, even your own, check the docs, there are instructions per translator and how to create your own.\n\n```python\ntranslator = DeeplTranslator() # or TranslatePy() or DeeplApi(api_key)\n```\n\nLoad, translate and save. For multiple recursive files in folder, check `examples folder`\n\n```python\nfilepath = \"./filepath/to/srt\"\nsrt = SrtFile(filepath)\nsrt.translate(translator, \"en\", \"es\")\n\n# Making the result subtitles prettier\nsrt.wrap_lines()\n\nsrt.save(f\"{os.path.splitext(filepath)[0]}_translated.srt\")\n```\n\nQuit translator\n\n```python\ntranslator.quit()\n```\n\n## Usage from GUI\n\n[KryptoST](https://github.com/KryptoST) has made a graphical user interface. You can check it out [here](https://github.com/KryptoST/SRTranslatorGUI)\n\n## Usage command line\n\n```bash\npython -m srtranslator ./filepath/to/srt -i SRC_LANG -o DEST_LANG\n```\n\n## Advanced usage\n\n```\nusage: __main__.py [-h] [-i SRC_LANG] [-o DEST_LANG] [-v] [-vv] [-s] [-w WRAP_LIMIT] [-t {deepl-scrap,translatepy,deepl-api}] [--auth AUTH] path\n\nTranslate an .STR file\n\npositional arguments:\n  path                  File to translate\n\noptions:\n  -h, --help            show this help message and exit\n  -i SRC_LANG, --src-lang SRC_LANG\n                        Source language. Default: auto\n  -o DEST_LANG, --dest-lang DEST_LANG\n                        Destination language. Default: es (spanish)\n  -v, --verbose         Increase output verbosity\n  -vv, --debug          Increase output verbosity for debugging\n  -s, --show-browser    Show browser window\n  -w WRAP_LIMIT, --wrap-limit WRAP_LIMIT\n                        Number of characters -including spaces- to wrap a line of text. Default: 50\n  -t {deepl-scrap,translatepy,deepl-api}, --translator {deepl-scrap,translatepy,deepl-api}\n                        Built-in translator to use\n  --auth AUTH           Api key if needed on translator\n```\n",
    "bugtrack_url": null,
    "license": "FREE",
    "summary": "Traslate a .SRT file using any custom translator",
    "version": "0.2.10",
    "project_urls": null,
    "split_keywords": [
        "python",
        "srt",
        "languages",
        "translator",
        "subtitles"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f77469f5e3eb70d540da3473df8e6290e580b295beac3ea019e0c67e526e08bf",
                "md5": "20aa265134f6d07deb581f9ba6317975",
                "sha256": "28e9f14cccd573f01727b866683eea2ce3bb24cc89cbbdfe698a71378b5455d8"
            },
            "downloads": -1,
            "filename": "translator_deepl-0.2.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20aa265134f6d07deb581f9ba6317975",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 17779,
            "upload_time": "2024-02-21T07:45:03",
            "upload_time_iso_8601": "2024-02-21T07:45:03.319997Z",
            "url": "https://files.pythonhosted.org/packages/f7/74/69f5e3eb70d540da3473df8e6290e580b295beac3ea019e0c67e526e08bf/translator_deepl-0.2.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95302bf7ebd0bbf99df7a8003a9e0f59528456bf48ceb5138a6c1612b073d15a",
                "md5": "73fd89d772a697990d55d323b3801745",
                "sha256": "67fdca10196d9e03de68dd046a953bfeb749cadc49772f49745683798955c732"
            },
            "downloads": -1,
            "filename": "translator_deepl-0.2.10.tar.gz",
            "has_sig": false,
            "md5_digest": "73fd89d772a697990d55d323b3801745",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15751,
            "upload_time": "2024-02-21T07:45:06",
            "upload_time_iso_8601": "2024-02-21T07:45:06.258818Z",
            "url": "https://files.pythonhosted.org/packages/95/30/2bf7ebd0bbf99df7a8003a9e0f59528456bf48ceb5138a6c1612b073d15a/translator_deepl-0.2.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-21 07:45:06",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "translator-deepl"
}
        
Elapsed time: 1.12434s