vtt2ass 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.gitlab-ci.yml +31 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +10 -0
- data/bin/run +4 -0
- data/bin/setup +8 -0
- data/doc/ASSFile.html +338 -0
- data/doc/ASSStyle.html +510 -0
- data/doc/ASSSubtitle.html +1012 -0
- data/doc/Application.html +487 -0
- data/doc/VTTSubtitle.html +700 -0
- data/doc/Vtt2ass.html +253 -0
- data/doc/Vtt2ass/Error.html +124 -0
- data/doc/_index.html +155 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +91 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +91 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +283 -0
- data/doc/top-level-namespace.html +112 -0
- data/exe/vtt2ass +4 -0
- data/lib/vtt2ass.rb +40 -0
- data/lib/vtt2ass/ASSFile.rb +43 -0
- data/lib/vtt2ass/ASSStyle.rb +63 -0
- data/lib/vtt2ass/ASSSubtitle.rb +92 -0
- data/lib/vtt2ass/Application.rb +82 -0
- data/lib/vtt2ass/VTTSubtitle.rb +40 -0
- data/lib/vtt2ass/version.rb +3 -0
- data/vtt2ass.gemspec +27 -0
- metadata +85 -0
@@ -0,0 +1,487 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Application
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "Application";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (A)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Application</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Application
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Application</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/vtt2ass/Application.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Main application class that manages all the operations.</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<h2>
|
122
|
+
Instance Method Summary
|
123
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
124
|
+
</h2>
|
125
|
+
|
126
|
+
<ul class="summary">
|
127
|
+
|
128
|
+
<li class="public ">
|
129
|
+
<span class="summary_signature">
|
130
|
+
|
131
|
+
<a href="#convertFileToASS-instance_method" title="#convertFileToASS (instance method)">#<strong>convertFileToASS</strong>(file_path) ⇒ Object </a>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
</span>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'>
|
146
|
+
<p>This method gets the list of paragraphs from the VTT file and creates lists of ASSSubtitle and ASSStyles objects from them.</p>
|
147
|
+
</div></span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
<li class="public ">
|
153
|
+
<span class="summary_signature">
|
154
|
+
|
155
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options) ⇒ Application </a>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
</span>
|
160
|
+
|
161
|
+
|
162
|
+
<span class="note title constructor">constructor</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Creates a new Application instance.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#readVTTFile-instance_method" title="#readVTTFile (instance method)">#<strong>readVTTFile</strong>(file_path) ⇒ Object </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'>
|
196
|
+
<p>This method reads the VTT file and sends back a list of paragraphs.</p>
|
197
|
+
</div></span>
|
198
|
+
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
202
|
+
<li class="public ">
|
203
|
+
<span class="summary_signature">
|
204
|
+
|
205
|
+
<a href="#start-instance_method" title="#start (instance method)">#<strong>start</strong> ⇒ Object </a>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</span>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="summary_desc"><div class='inline'>
|
220
|
+
<p>This method starts the application process.</p>
|
221
|
+
</div></span>
|
222
|
+
|
223
|
+
</li>
|
224
|
+
|
225
|
+
|
226
|
+
</ul>
|
227
|
+
|
228
|
+
|
229
|
+
<div id="constructor_details" class="method_details_list">
|
230
|
+
<h2>Constructor Details</h2>
|
231
|
+
|
232
|
+
<div class="method_details first">
|
233
|
+
<h3 class="signature first" id="initialize-instance_method">
|
234
|
+
|
235
|
+
#<strong>initialize</strong>(options) ⇒ <tt><span class='object_link'><a href="" title="Application (class)">Application</a></span></tt>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
</h3><div class="docstring">
|
242
|
+
<div class="discussion">
|
243
|
+
|
244
|
+
<p>Creates a new Application instance. It receives <code>options</code> that can define the input and output directories.</p>
|
245
|
+
|
246
|
+
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
<div class="tags">
|
250
|
+
|
251
|
+
|
252
|
+
</div><table class="source_code">
|
253
|
+
<tr>
|
254
|
+
<td>
|
255
|
+
<pre class="lines">
|
256
|
+
|
257
|
+
|
258
|
+
18
|
259
|
+
19
|
260
|
+
20
|
261
|
+
21
|
262
|
+
22
|
263
|
+
23
|
264
|
+
24</pre>
|
265
|
+
</td>
|
266
|
+
<td>
|
267
|
+
<pre class="code"><span class="info file"># File 'lib/vtt2ass/Application.rb', line 18</span>
|
268
|
+
|
269
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
270
|
+
<span class='ivar'>@input_dir</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:input</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:input</span><span class='rbracket'>]</span><span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>./input</span><span class='tstring_end'>"</span></span>
|
271
|
+
<span class='ivar'>@output_dir</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:output</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:output</span><span class='rbracket'>]</span><span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>./output</span><span class='tstring_end'>"</span></span>
|
272
|
+
<span class='ivar'>@width</span> <span class='op'>=</span> <span class='int'>1920</span>
|
273
|
+
<span class='ivar'>@height</span> <span class='op'>=</span> <span class='int'>1080</span>
|
274
|
+
<span class='ivar'>@font_size</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:font_size</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:font_size</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='int'>72</span>
|
275
|
+
<span class='kw'>end</span></pre>
|
276
|
+
</td>
|
277
|
+
</tr>
|
278
|
+
</table>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
|
284
|
+
<div id="instance_method_details" class="method_details_list">
|
285
|
+
<h2>Instance Method Details</h2>
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method_details first">
|
289
|
+
<h3 class="signature first" id="convertFileToASS-instance_method">
|
290
|
+
|
291
|
+
#<strong>convertFileToASS</strong>(file_path) ⇒ <tt>Object</tt>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</h3><div class="docstring">
|
298
|
+
<div class="discussion">
|
299
|
+
|
300
|
+
<p>This method gets the list of paragraphs from the VTT file and creates lists of ASSSubtitle and ASSStyles objects from them. Those lists are given a new ASSFile object to generate the file content. It requires a <code>file_path</code> as input. It outputs an ASSFile object.</p>
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
</div>
|
305
|
+
<div class="tags">
|
306
|
+
|
307
|
+
|
308
|
+
</div><table class="source_code">
|
309
|
+
<tr>
|
310
|
+
<td>
|
311
|
+
<pre class="lines">
|
312
|
+
|
313
|
+
|
314
|
+
63
|
315
|
+
64
|
316
|
+
65
|
317
|
+
66
|
318
|
+
67
|
319
|
+
68
|
320
|
+
69
|
321
|
+
70
|
322
|
+
71
|
323
|
+
72
|
324
|
+
73
|
325
|
+
74
|
326
|
+
75
|
327
|
+
76
|
328
|
+
77
|
329
|
+
78
|
330
|
+
79
|
331
|
+
80
|
332
|
+
81</pre>
|
333
|
+
</td>
|
334
|
+
<td>
|
335
|
+
<pre class="code"><span class="info file"># File 'lib/vtt2ass/Application.rb', line 63</span>
|
336
|
+
|
337
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_convertFileToASS'>convertFileToASS</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
|
338
|
+
<span class='id identifier rubyid_vtt_subs'>vtt_subs</span> <span class='op'>=</span> <span class='id identifier rubyid_readVTTFile'>readVTTFile</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
|
339
|
+
<span class='id identifier rubyid_ass_subs'>ass_subs</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
340
|
+
<span class='id identifier rubyid_ass_styles'>ass_styles</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
341
|
+
<span class='id identifier rubyid_vtt_subs'>vtt_subs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sub'>sub</span><span class='op'>|</span>
|
342
|
+
<span class='id identifier rubyid_ass_subs'>ass_subs</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="ASSSubtitle.html" title="ASSSubtitle (class)">ASSSubtitle</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ASSSubtitle.html#initialize-instance_method" title="ASSSubtitle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_style'>style</span><span class='comma'>,</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_time_start'>time_start</span><span class='comma'>,</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_time_end'>time_end</span><span class='comma'>,</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
343
|
+
<span class='id identifier rubyid_style_exists'>style_exists</span> <span class='op'>=</span> <span class='kw'>false</span>
|
344
|
+
<span class='id identifier rubyid_ass_styles'>ass_styles</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_style'>style</span><span class='op'>|</span>
|
345
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_style'>style</span><span class='period'>.</span><span class='id identifier rubyid_style_name'>style_name</span> <span class='op'>==</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_style'>style</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
346
|
+
<span class='id identifier rubyid_style_exists'>style_exists</span> <span class='op'>=</span> <span class='kw'>true</span>
|
347
|
+
<span class='kw'>break</span>
|
348
|
+
<span class='kw'>end</span>
|
349
|
+
<span class='kw'>end</span>
|
350
|
+
<span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_style_exists'>style_exists</span> <span class='kw'>then</span>
|
351
|
+
<span class='id identifier rubyid_ass_styles'>ass_styles</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="ASSStyle.html" title="ASSStyle (class)">ASSStyle</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ASSStyle.html#initialize-instance_method" title="ASSStyle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_style'>style</span><span class='comma'>,</span> <span class='id identifier rubyid_sub'>sub</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='ivar'>@font_size</span><span class='comma'>,</span> <span class='ivar'>@width</span><span class='comma'>,</span> <span class='ivar'>@height</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
352
|
+
<span class='kw'>end</span>
|
353
|
+
<span class='kw'>end</span>
|
354
|
+
<span class='kw'>return</span> <span class='const'><span class='object_link'><a href="ASSFile.html" title="ASSFile (class)">ASSFile</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ASSFile.html#initialize-instance_method" title="ASSFile#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_ass_styles'>ass_styles</span><span class='comma'>,</span> <span class='id identifier rubyid_ass_subs'>ass_subs</span><span class='comma'>,</span> <span class='ivar'>@width</span><span class='comma'>,</span> <span class='ivar'>@height</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'><span class='object_link'><a href="ASSFile.html#to_s-instance_method" title="ASSFile#to_s (method)">to_s</a></span></span>
|
355
|
+
<span class='kw'>end</span></pre>
|
356
|
+
</td>
|
357
|
+
</tr>
|
358
|
+
</table>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div class="method_details ">
|
362
|
+
<h3 class="signature " id="readVTTFile-instance_method">
|
363
|
+
|
364
|
+
#<strong>readVTTFile</strong>(file_path) ⇒ <tt>Object</tt>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
</h3><div class="docstring">
|
371
|
+
<div class="discussion">
|
372
|
+
|
373
|
+
<p>This method reads the VTT file and sends back a list of paragraphs. It requires a <code>file_path</code> as input. It outputs a list named list_paragraph.</p>
|
374
|
+
|
375
|
+
|
376
|
+
</div>
|
377
|
+
</div>
|
378
|
+
<div class="tags">
|
379
|
+
|
380
|
+
|
381
|
+
</div><table class="source_code">
|
382
|
+
<tr>
|
383
|
+
<td>
|
384
|
+
<pre class="lines">
|
385
|
+
|
386
|
+
|
387
|
+
45
|
388
|
+
46
|
389
|
+
47
|
390
|
+
48
|
391
|
+
49
|
392
|
+
50
|
393
|
+
51
|
394
|
+
52
|
395
|
+
53
|
396
|
+
54
|
397
|
+
55
|
398
|
+
56</pre>
|
399
|
+
</td>
|
400
|
+
<td>
|
401
|
+
<pre class="code"><span class="info file"># File 'lib/vtt2ass/Application.rb', line 45</span>
|
402
|
+
|
403
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_readVTTFile'>readVTTFile</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
|
404
|
+
<span class='id identifier rubyid_list_parapraph'>list_parapraph</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
405
|
+
<span class='id identifier rubyid_separator'>separator</span> <span class='op'>=</span> <span class='const'>OS</span><span class='period'>.</span><span class='id identifier rubyid_linux?'>linux?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\r\n\r\n</span><span class='tstring_end'>"</span></span><span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n\n</span><span class='tstring_end'>"</span></span>
|
406
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_separator'>separator</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_paragraph'>paragraph</span><span class='op'>|</span>
|
407
|
+
<span class='id identifier rubyid_paragraph'>paragraph</span> <span class='op'>=</span> <span class='id identifier rubyid_paragraph'>paragraph</span><span class='period'>.</span><span class='id identifier rubyid_rstrip'>rstrip</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\r\n</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
408
|
+
<span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_paragraph'>paragraph</span><span class='period'>.</span><span class='id identifier rubyid_eql?'>eql?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span>
|
409
|
+
<span class='id identifier rubyid_list_parapraph'>list_parapraph</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="VTTSubtitle.html" title="VTTSubtitle (class)">VTTSubtitle</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="VTTSubtitle.html#initialize-instance_method" title="VTTSubtitle#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_paragraph'>paragraph</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
410
|
+
<span class='kw'>end</span>
|
411
|
+
<span class='kw'>end</span>
|
412
|
+
<span class='id identifier rubyid_list_parapraph'>list_parapraph</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
413
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_list_parapraph'>list_parapraph</span>
|
414
|
+
<span class='kw'>end</span></pre>
|
415
|
+
</td>
|
416
|
+
</tr>
|
417
|
+
</table>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
<div class="method_details ">
|
421
|
+
<h3 class="signature " id="start-instance_method">
|
422
|
+
|
423
|
+
#<strong>start</strong> ⇒ <tt>Object</tt>
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
</h3><div class="docstring">
|
430
|
+
<div class="discussion">
|
431
|
+
|
432
|
+
<p>This method starts the application process. It sends the file_paths of VTT files in the input directory to convertFileToASS method and outputs the resulting ASS format to a new file.</p>
|
433
|
+
|
434
|
+
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
<div class="tags">
|
438
|
+
|
439
|
+
|
440
|
+
</div><table class="source_code">
|
441
|
+
<tr>
|
442
|
+
<td>
|
443
|
+
<pre class="lines">
|
444
|
+
|
445
|
+
|
446
|
+
30
|
447
|
+
31
|
448
|
+
32
|
449
|
+
33
|
450
|
+
34
|
451
|
+
35
|
452
|
+
36
|
453
|
+
37
|
454
|
+
38
|
455
|
+
39</pre>
|
456
|
+
</td>
|
457
|
+
<td>
|
458
|
+
<pre class="code"><span class="info file"># File 'lib/vtt2ass/Application.rb', line 30</span>
|
459
|
+
|
460
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span>
|
461
|
+
<span class='const'>Dir</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@input_dir</span><span class='embexpr_end'>}</span><span class='tstring_content'>/*.vtt</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_file_path'>file_path</span><span class='op'>|</span>
|
462
|
+
<span class='id identifier rubyid_file_name'>file_name</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.vtt</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.ass</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
463
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_mkdir_p'>mkdir_p</span> <span class='ivar'>@output_dir</span>
|
464
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@output_dir</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_file_name'>file_name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
465
|
+
<span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\ufeff</span><span class='tstring_end'>"</span></span>
|
466
|
+
<span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_convertFileToASS'>convertFileToASS</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
|
467
|
+
<span class='kw'>end</span>
|
468
|
+
<span class='kw'>end</span>
|
469
|
+
<span class='kw'>end</span></pre>
|
470
|
+
</td>
|
471
|
+
</tr>
|
472
|
+
</table>
|
473
|
+
</div>
|
474
|
+
|
475
|
+
</div>
|
476
|
+
|
477
|
+
</div>
|
478
|
+
|
479
|
+
<div id="footer">
|
480
|
+
Generated on Thu Jan 14 00:31:16 2021 by
|
481
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
482
|
+
0.9.26 (ruby-2.7.2).
|
483
|
+
</div>
|
484
|
+
|
485
|
+
</div>
|
486
|
+
</body>
|
487
|
+
</html>
|