Debian Codegraph @

pysrt.egg-info/PKG-INFO

raw
1 Metadata-Version: 1.1
2 Name: pysrt
3 Version: 1.1.2
4 Summary: SubRip (.srt) subtitle parser and writer
5 Home-page: https://github.com/byroot/pysrt
6 Author: Jean Boussier
7 Author-email: [email protected]
8 License: GPLv3
9 Description: pysrt
10 =============
11
12 pysrt is a Python library used to edit or create SubRip files.
13
14 .. image:: https://secure.travis-ci.org/byroot/pysrt.png?branch=master
15 :target: http://travis-ci.org/byroot/pysrt
16 .. image:: https://coveralls.io/repos/byroot/pysrt/badge.png?branch=master
17 :target: https://coveralls.io/r/byroot/pysrt?branch=master
18 .. image:: https://img.shields.io/pypi/v/pysrt.svg
19 :target: https://crate.io/packages/pysrt/
20
21 Foreword
22 ====================
23
24 pysrt is mainly designed as a library, but if you are experiencing troubles
25 with bad subtitles you can first try to use `ruby-osdb <https://github.com/byroot/ruby-osdb>`_
26 which will try to find the best subtitle for your movie. If you are still unlucky
27 pysrt also provide an ``srt`` command useful for either shift, split, or rescale a
28 *.srt* file.
29
30 Command Usage
31 =====================
32
33 Shifting: ::
34
35 $ srt -i shift 2s500ms movie.srt
36
37 Spliting: ::
38
39 $ srt split 58m26s movie.srt
40
41 Rescaling: ::
42
43 $ srt -i rate 23.9 25 movie.srt
44
45 Installation
46 =================
47
48 pysrt is available on pypi. To intall it you can use either
49
50 pip: ::
51
52 $ sudo pip install pysrt
53
54 or distutils: ::
55
56 $ sudo easy_install pysrt
57
58
59 It is compatible with python >= 2.6 and 3.
60
61
62 Library Usage
63 =============
64
65 Import: ::
66
67 >>> import pysrt
68
69 Parsing: ::
70
71 >>> subs = pysrt.open('some/file.srt')
72 # If you get a UnicodeDecodeError try to specify the encoding
73 >>> subs = pysrt.open('some/file.srt', encoding='iso-8859-1')
74
75 SubRipFile are list-like objects of SubRipItem instances: ::
76
77 >>> len(subs)
78 >>> first_sub = subs[0]
79
80 SubRipItem instances are editable just like pure Python objects: ::
81
82 >>> first_sub.text = "Hello World !"
83 >>> first_sub.start.seconds = 20
84 >>> first_sub.end.minutes = 5
85
86 Shifting: ::
87
88 >>> subs.shift(seconds=-2) # Move all subs 2 seconds earlier
89 >>> subs.shift(minutes=1) # Move all subs 1 minutes later
90 >>> subs.shift(ratio=25/23.9) # convert a 23.9 fps subtitle in 25 fps
91 >>> first_sub.shift(seconds=1) # Move the first sub 1 second later
92 >>> first_sub.start += {'seconds': -1} # Make the first sub start 1 second earlier
93
94 Removing: ::
95
96 >>> del subs[12]
97
98 Slicing: ::
99
100 >>> part = subs.slice(starts_after={'minutes': 2, 'seconds': 30}, ends_before={'minutes': 3, 'seconds': 40})
101 >>> part.shift(seconds=-2)
102
103 Saving changes: ::
104
105 >>> subs.save('other/path.srt', encoding='utf-8')
106
107 Keywords: SubRip srt subtitle
108 Platform: Independent
109 Classifier: Development Status :: 5 - Production/Stable
110 Classifier: Intended Audience :: Developers
111 Classifier: License :: OSI Approved :: GNU General Public License (GPL)
112 Classifier: Operating System :: OS Independent
113 Classifier: Programming Language :: Python
114 Classifier: Programming Language :: Python :: 2.7
115 Classifier: Programming Language :: Python :: 3
116 Classifier: Programming Language :: Python :: 3.4
117 Classifier: Programming Language :: Python :: 3.5
118 Classifier: Topic :: Multimedia :: Video
119 Classifier: Topic :: Software Development :: Libraries
120 Classifier: Topic :: Text Processing :: Markup