{"id":13825954,"url":"https://github.com/byroot/pysrt","last_synced_at":"2025-05-15T04:07:49.088Z","repository":{"id":697580,"uuid":"342640","full_name":"byroot/pysrt","owner":"byroot","description":"Python parser for SubRip (srt) files","archived":false,"fork":false,"pushed_at":"2023-05-09T12:51:04.000Z","size":269,"stargazers_count":467,"open_issues_count":29,"forks_count":69,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-14T05:56:45.868Z","etag":null,"topics":["python","subtitles-parsing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byroot.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2009-10-19T19:50:49.000Z","updated_at":"2025-04-06T10:10:57.000Z","dependencies_parsed_at":"2022-07-07T15:01:00.168Z","dependency_job_id":"f1881f21-da03-40c4-a930-823d2a03d043","html_url":"https://github.com/byroot/pysrt","commit_stats":{"total_commits":180,"total_committers":16,"mean_commits":11.25,"dds":"0.46111111111111114","last_synced_commit":"93f52f6d4f70f4e18dc71deeaae0ec1e9100a50f"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byroot%2Fpysrt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byroot%2Fpysrt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byroot%2Fpysrt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byroot%2Fpysrt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byroot","download_url":"https://codeload.github.com/byroot/pysrt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270656,"owners_count":22042860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","subtitles-parsing"],"created_at":"2024-08-04T09:01:29.790Z","updated_at":"2025-05-15T04:07:44.072Z","avatar_url":"https://github.com/byroot.png","language":"Python","readme":"pysrt\n=============\n\npysrt is a Python library used to edit or create SubRip files.\n\n.. image:: https://secure.travis-ci.org/byroot/pysrt.png?branch=master\n  :target: http://travis-ci.org/byroot/pysrt\n.. image:: https://coveralls.io/repos/byroot/pysrt/badge.png?branch=master\n  :target: https://coveralls.io/r/byroot/pysrt?branch=master\n.. image:: https://img.shields.io/pypi/v/pysrt.svg\n  :target: https://crate.io/packages/pysrt/\n\nForeword\n====================\n\npysrt is mainly designed as a library, but if you are experiencing troubles\nwith bad subtitles you can first try to use `ruby-osdb \u003chttps://github.com/byroot/ruby-osdb\u003e`_\nwhich will try to find the best subtitle for your movie. If you are still unlucky\npysrt also provide an ``srt`` command useful for either shift, split, or rescale a\n*.srt* file.\n\nCommand Usage\n=====================\n\nShifting: ::\n  \n    $ srt -i shift 2s500ms movie.srt\n\nSpliting: ::\n\n    $ srt split 58m26s movie.srt\n\nRescaling: ::\n\n    $ srt -i rate 23.9 25 movie.srt\n\nInstallation\n=================\n\npysrt is available on pypi. To install it you can use either\n\npip: ::\n    \n    $ sudo pip install pysrt\n    \nor distutils: ::\n\n    $ sudo easy_install pysrt\n\n\nIt is compatible with python \u003e= 2.6 and 3.\n\n\nLibrary Usage\n=============\n\nImport: ::\n\n    \u003e\u003e\u003e import pysrt\n    \nParsing: ::\n\n    \u003e\u003e\u003e subs = pysrt.open('some/file.srt')\n    # If you get a UnicodeDecodeError try to specify the encoding\n    \u003e\u003e\u003e subs = pysrt.open('some/file.srt', encoding='iso-8859-1')\n    \nSubRipFile are list-like objects of SubRipItem instances: ::\n    \n    \u003e\u003e\u003e len(subs)\n    \u003e\u003e\u003e first_sub = subs[0]\n    \nSubRipItem instances are editable just like pure Python objects: ::\n    \n    \u003e\u003e\u003e first_sub.text = \"Hello World !\"\n    \u003e\u003e\u003e first_sub.start.seconds = 20\n    \u003e\u003e\u003e first_sub.end.minutes = 5\n    \nShifting: ::\n\n    \u003e\u003e\u003e subs.shift(seconds=-2) # Move all subs 2 seconds earlier\n    \u003e\u003e\u003e subs.shift(minutes=1)  # Move all subs 1 minutes later\n    \u003e\u003e\u003e subs.shift(ratio=25/23.9) # convert a 23.9 fps subtitle in 25 fps\n    \u003e\u003e\u003e first_sub.shift(seconds=1) # Move the first sub 1 second later\n    \u003e\u003e\u003e first_sub.start += {'seconds': -1} # Make the first sub start 1 second earlier\n    \nRemoving: ::\n    \n    \u003e\u003e\u003e del subs[12]\n    \nSlicing: ::\n    \n    \u003e\u003e\u003e part = subs.slice(starts_after={'minutes': 2, 'seconds': 30}, ends_before={'minutes': 3, 'seconds': 40})\n    \u003e\u003e\u003e part.shift(seconds=-2)\n    \nSaving changes: ::\n    \n    \u003e\u003e\u003e subs.save('other/path.srt', encoding='utf-8')\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyroot%2Fpysrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyroot%2Fpysrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyroot%2Fpysrt/lists"}