{ "info": { "author": "Federico Calendino", "author_email": "federicocalendino@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "## pysub-parser\n\n[![Build Status](https://travis-ci.com/federicocalendino/pysub-parser.svg?branch=master)](https://travis-ci.com/federicocalendino/pysub-parser)\n[![codecov](https://codecov.io/gh/federicocalendino/pysub-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/federicocalendino/pysub-parser)\n[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)\n[![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/federicocalendino/pysub-parser/blob/master/LICENSE)\n\n\nUtility to extract the contents of a subtitle file.\n\nSupported types:\n\n* `ssa`: [SubStation Alpha](https://en.wikipedia.org/wiki/SubStation_Alpha)\n * `ass`: [Advanced SubStation Alpha](https://en.wikipedia.org/wiki/SubStation_Alpha#Advanced_SubStation_Alpha)\n* `srt`: [SubRip](https://en.wikipedia.org/wiki/SubRip)\n* `sub`: [MicroDVD](https://en.wikipedia.org/wiki/MicroDVD)\n* `txt`: [Sub Viewer](https://en.wikipedia.org/wiki/SubViewer)\n\n> For more information: http://write.flossmanuals.net/video-subtitling/file-formats\n\n### Usage\n\nThe method parse requires the following parameters:\n\n* `path`: location of the subtitle file.\n* `subtype`: one of the supported file types, by default file extension is used.\n* `encoding`: encoding of the file, `utf-8` by default.\n* `**kwargs`: optional parameters.\n * `fps`: framerate (only used by `sub` files), `23.976` by default.\n\n```python\nfrom parser import parse\n\nsubtitles = parse('./files/space-jam.srt')\n\nfor subtitle in subtitles:\n print('{} > {}'.format(subtitle.index, subtitle.text))\n```\n\nOutput:\n```\n1 > [BALL BOUNCING]\n2 > Michael?\n3 > What are you doing out here, son? It's after midnight.\n4 > MICHAEL: Couldn't sleep, Pops.\n5 > Well, neither can we, with all that noise you're making.\n6 > Come on, let's go inside.\n7 > Just one more shot?\n\n```\n\n___\n\n### Subtitle Class\n\nEach line of a dialogue is represented with a `Subtitle` object with the following properties:\n\n* `index`: position in the file.\n* `start`: timestamp of the start of the dialog.\n* `end`: timestamp of the end of the dialog.\n* `text`: dialog contents.\n\n**text clean up**:\n\nThe class `Subtitle` provides a method `clean_up` to normalize its text, \nthis will lower case it and remove anything that isn't letters or numbers.\n\n\n* `to_lowercase`: if `False`, the string wont be transformed to lowercase.\n* `to_ascii`: if `True`, every character will be transformed to their closest ascii representation.\n* `remove_brackes`: if `True`, everything inside `[brackets]` will be removed.\n* `remove_format`: if `True`, every formatting tag `abc` will be removed.\n\n```python\nfrom parser import parse\n\nsubtitles = parse('./files/space-jam.srt')\n\nfor subtitle in subtitles:\n print('{} > {}'.format(subtitle.index, subtitle.clean_up(to_ascii=True, remove_brackets=True)))\n```\n\nOutput:\n```\n1 > \n2 > michael\n3 > what are you doing out here son its after midnight\n4 > michael couldnt sleep pops\n5 > well neither can we with all that noise youre making\n6 > come on lets go inside\n7 > just one more shot\n\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/federicocalendino/pysub-parser", "keywords": "subtitle,subtitles,parser,srt,sub,ssa,txt", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pysub-parser", "package_url": "https://pypi.org/project/pysub-parser/", "platform": "", "project_url": "https://pypi.org/project/pysub-parser/", "project_urls": { "Homepage": "https://github.com/federicocalendino/pysub-parser" }, "release_url": "https://pypi.org/project/pysub-parser/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Utility to extract the contents of a subtitle file", "version": "1.0.1" }, "last_serial": 5253219, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "6ea36b3a69615a0138bf9612a45d797c", "sha256": "b65c57004c17303152047c7e3fc0d0f2969dc04e935102f37121b8004e927d23" }, "downloads": -1, "filename": "pysub-parser-1.0.tar.gz", "has_sig": false, "md5_digest": "6ea36b3a69615a0138bf9612a45d797c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4526, "upload_time": "2019-05-10T16:43:07", "url": "https://files.pythonhosted.org/packages/96/10/673b1b8bb43957ebc01b0d053028b8fb3e4e4cfe0087a56acd37d7245b44/pysub-parser-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "d45fb953cfd7656c84943164dc042f89", "sha256": "fe249449e54e92ab84ba69f35da37ac3cdcd279fcd50f1ba362e24d45ac66171" }, "downloads": -1, "filename": "pysub-parser-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d45fb953cfd7656c84943164dc042f89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4725, "upload_time": "2019-05-10T17:19:03", "url": "https://files.pythonhosted.org/packages/3e/99/5c318ca2b1488d2911267c0d18cb72646d72a1980fd757bcf598463812fa/pysub-parser-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d45fb953cfd7656c84943164dc042f89", "sha256": "fe249449e54e92ab84ba69f35da37ac3cdcd279fcd50f1ba362e24d45ac66171" }, "downloads": -1, "filename": "pysub-parser-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d45fb953cfd7656c84943164dc042f89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4725, "upload_time": "2019-05-10T17:19:03", "url": "https://files.pythonhosted.org/packages/3e/99/5c318ca2b1488d2911267c0d18cb72646d72a1980fd757bcf598463812fa/pysub-parser-1.0.1.tar.gz" } ] }