vtt2ass 0.2.13 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -7
- data/README.md +19 -18
- data/bin/{run → vtt2ass} +1 -1
- data/doc/ASSFile.html +3 -3
- data/doc/ASSLine.html +2 -2
- data/doc/ASSStyle.html +13 -7
- data/doc/ASSStyleParams.html +10 -18
- data/doc/Application.html +90 -26
- data/doc/Command.html +227 -0
- data/doc/MainCommand.html +336 -0
- data/doc/VTTFile.html +117 -26
- data/doc/VTTLine.html +34 -30
- data/doc/Vtt2ass.html +4 -146
- data/doc/_index.html +15 -2
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +26 -19
- data/doc/index.html +26 -19
- data/doc/method_list.html +58 -26
- data/doc/top-level-namespace.html +3 -3
- data/exe/vtt2ass +1 -1
- data/lib/vtt2ass/Application.rb +6 -4
- data/lib/vtt2ass/VTTFile.rb +10 -0
- data/lib/vtt2ass/VTTLine.rb +3 -2
- data/lib/vtt2ass/version.rb +1 -1
- data/lib/vtt2ass.rb +16 -98
- data/vtt2ass.gemspec +1 -1
- metadata +8 -6
data/doc/_index.html
CHANGED
@@ -109,6 +109,19 @@
|
|
109
109
|
</ul>
|
110
110
|
|
111
111
|
|
112
|
+
<ul id="alpha_M" class="alpha">
|
113
|
+
<li class="letter">M</li>
|
114
|
+
<ul>
|
115
|
+
|
116
|
+
<li>
|
117
|
+
<span class='object_link'><a href="MainCommand.html" title="MainCommand (class)">MainCommand</a></span>
|
118
|
+
|
119
|
+
</li>
|
120
|
+
|
121
|
+
</ul>
|
122
|
+
</ul>
|
123
|
+
|
124
|
+
|
112
125
|
<ul id="alpha_V" class="alpha">
|
113
126
|
<li class="letter">V</li>
|
114
127
|
<ul>
|
@@ -140,9 +153,9 @@
|
|
140
153
|
</div>
|
141
154
|
|
142
155
|
<div id="footer">
|
143
|
-
Generated on
|
156
|
+
Generated on Mon Nov 22 21:50:10 2021 by
|
144
157
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
145
|
-
0.9.26 (ruby-3.0.
|
158
|
+
0.9.26 (ruby-3.0.2).
|
146
159
|
</div>
|
147
160
|
|
148
161
|
</div>
|
data/doc/class_list.html
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
<ul id="full_list" class="class">
|
45
45
|
<li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
|
46
|
-
<li id='object_ASSFile' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSFile.html" title="ASSFile (class)">ASSFile</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_ASSLine' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSLine.html" title="ASSLine (class)">ASSLine</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_ASSStyle' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSStyle.html" title="ASSStyle (class)">ASSStyle</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_ASSStyleParams' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSStyleParams.html" title="ASSStyleParams (class)">ASSStyleParams</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_Application' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Application.html" title="Application (class)">Application</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='
|
46
|
+
<li id='object_ASSFile' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSFile.html" title="ASSFile (class)">ASSFile</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_ASSLine' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSLine.html" title="ASSLine (class)">ASSLine</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_ASSStyle' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSStyle.html" title="ASSStyle (class)">ASSStyle</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_ASSStyleParams' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="ASSStyleParams.html" title="ASSStyleParams (class)">ASSStyleParams</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_Application' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Application.html" title="Application (class)">Application</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_MainCommand' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="MainCommand.html" title="MainCommand (class)">MainCommand</a></span> < Thor<small class='search_info'>Top Level Namespace</small></div></li><li id='object_VTTFile' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="VTTFile.html" title="VTTFile (class)">VTTFile</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_VTTLine' class='odd'><div class='item' style='padding-left:30px'><span class='object_link'><a href="VTTLine.html" title="VTTLine (class)">VTTLine</a></span> < Object<small class='search_info'>Top Level Namespace</small></div></li><li id='object_Vtt2ass' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Vtt2ass.html" title="Vtt2ass (module)">Vtt2ass</a></span><small class='search_info'>Top Level Namespace</small></div></li>
|
47
47
|
|
48
48
|
</ul>
|
49
49
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -73,7 +73,10 @@
|
|
73
73
|
|
74
74
|
<h2 id="label-Installation">Installation</h2>
|
75
75
|
|
76
|
-
<p>To install
|
76
|
+
<p>To install:</p>
|
77
|
+
|
78
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_vtt2ass'>vtt2ass</span>
|
79
|
+
</code></pre>
|
77
80
|
|
78
81
|
<h1 id="label-Build">Build</h1>
|
79
82
|
|
@@ -82,22 +85,26 @@
|
|
82
85
|
|
83
86
|
<h2 id="label-Usage">Usage</h2>
|
84
87
|
|
85
|
-
<
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
Usage:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
<pre class="code ruby"><code class="ruby">$ vtt2ass
|
89
|
+
Commands:
|
90
|
+
vtt2ass convert INPUT # Run the VTT to ASS conversion for the specified file(s)
|
91
|
+
vtt2ass help [COMMAND] # Describe available commands or one specific command
|
92
|
+
vtt2ass version # Show version
|
93
|
+
|
94
|
+
$ vtt2ass help convert
|
95
|
+
Usage:
|
96
|
+
vtt2ass convert INPUT
|
97
|
+
|
98
|
+
Options:
|
99
|
+
-o, [--output=OUTPUT] # Output directory of the converted file
|
100
|
+
-t, [--title=TITLE] # Specify a title for you file. If the input is a directory, all files will share the same title.
|
101
|
+
-s, [--font-size=N] # Specify a font size for the subtitles
|
102
|
+
# Default: 52
|
103
|
+
-f, [--font-family=FONT_FAMILY] # Specify a font family for the subtitles
|
104
|
+
# Default: Open Sans Semibold
|
105
|
+
-q, [--quiet], [--no-quiet] # Don't output to the console
|
106
|
+
|
107
|
+
Run the VTT to ASS conversion for the specified file(s)
|
101
108
|
</code></pre>
|
102
109
|
|
103
110
|
<h1 id="label-Donate">Donate</h1>
|
@@ -108,9 +115,9 @@ Specific options:
|
|
108
115
|
</div></div>
|
109
116
|
|
110
117
|
<div id="footer">
|
111
|
-
Generated on
|
118
|
+
Generated on Mon Nov 22 21:50:10 2021 by
|
112
119
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
113
|
-
0.9.26 (ruby-3.0.
|
120
|
+
0.9.26 (ruby-3.0.2).
|
114
121
|
</div>
|
115
122
|
|
116
123
|
</div>
|
data/doc/index.html
CHANGED
@@ -73,7 +73,10 @@
|
|
73
73
|
|
74
74
|
<h2 id="label-Installation">Installation</h2>
|
75
75
|
|
76
|
-
<p>To install
|
76
|
+
<p>To install:</p>
|
77
|
+
|
78
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_vtt2ass'>vtt2ass</span>
|
79
|
+
</code></pre>
|
77
80
|
|
78
81
|
<h1 id="label-Build">Build</h1>
|
79
82
|
|
@@ -82,22 +85,26 @@
|
|
82
85
|
|
83
86
|
<h2 id="label-Usage">Usage</h2>
|
84
87
|
|
85
|
-
<
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
Usage:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
<pre class="code ruby"><code class="ruby">$ vtt2ass
|
89
|
+
Commands:
|
90
|
+
vtt2ass convert INPUT # Run the VTT to ASS conversion for the specified file(s)
|
91
|
+
vtt2ass help [COMMAND] # Describe available commands or one specific command
|
92
|
+
vtt2ass version # Show version
|
93
|
+
|
94
|
+
$ vtt2ass help convert
|
95
|
+
Usage:
|
96
|
+
vtt2ass convert INPUT
|
97
|
+
|
98
|
+
Options:
|
99
|
+
-o, [--output=OUTPUT] # Output directory of the converted file
|
100
|
+
-t, [--title=TITLE] # Specify a title for you file. If the input is a directory, all files will share the same title.
|
101
|
+
-s, [--font-size=N] # Specify a font size for the subtitles
|
102
|
+
# Default: 52
|
103
|
+
-f, [--font-family=FONT_FAMILY] # Specify a font family for the subtitles
|
104
|
+
# Default: Open Sans Semibold
|
105
|
+
-q, [--quiet], [--no-quiet] # Don't output to the console
|
106
|
+
|
107
|
+
Run the VTT to ASS conversion for the specified file(s)
|
101
108
|
</code></pre>
|
102
109
|
|
103
110
|
<h1 id="label-Donate">Donate</h1>
|
@@ -108,9 +115,9 @@ Specific options:
|
|
108
115
|
</div></div>
|
109
116
|
|
110
117
|
<div id="footer">
|
111
|
-
Generated on
|
118
|
+
Generated on Mon Nov 22 21:50:10 2021 by
|
112
119
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
113
|
-
0.9.26 (ruby-3.0.
|
120
|
+
0.9.26 (ruby-3.0.2).
|
114
121
|
</div>
|
115
122
|
|
116
123
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -76,6 +76,22 @@
|
|
76
76
|
</li>
|
77
77
|
|
78
78
|
|
79
|
+
<li class="odd ">
|
80
|
+
<div class="item">
|
81
|
+
<span class='object_link'><a href="MainCommand.html#convert-instance_method" title="MainCommand#convert (method)">#convert</a></span>
|
82
|
+
<small>MainCommand</small>
|
83
|
+
</div>
|
84
|
+
</li>
|
85
|
+
|
86
|
+
|
87
|
+
<li class="even ">
|
88
|
+
<div class="item">
|
89
|
+
<span class='object_link'><a href="Application.html#convert-instance_method" title="Application#convert (method)">#convert</a></span>
|
90
|
+
<small>Application</small>
|
91
|
+
</div>
|
92
|
+
</li>
|
93
|
+
|
94
|
+
|
79
95
|
<li class="odd ">
|
80
96
|
<div class="item">
|
81
97
|
<span class='object_link'><a href="ASSLine.html#convertTime-instance_method" title="ASSLine#convertTime (method)">#convertTime</a></span>
|
@@ -124,6 +140,22 @@
|
|
124
140
|
</li>
|
125
141
|
|
126
142
|
|
143
|
+
<li class="odd ">
|
144
|
+
<div class="item">
|
145
|
+
<span class='object_link'><a href="VTTFile.html#determine_line_ending-instance_method" title="VTTFile#determine_line_ending (method)">#determine_line_ending</a></span>
|
146
|
+
<small>VTTFile</small>
|
147
|
+
</div>
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="even ">
|
152
|
+
<div class="item">
|
153
|
+
<span class='object_link'><a href="MainCommand.html#exit_on_failure%3F-class_method" title="MainCommand.exit_on_failure? (method)">exit_on_failure?</a></span>
|
154
|
+
<small>MainCommand</small>
|
155
|
+
</div>
|
156
|
+
</li>
|
157
|
+
|
158
|
+
|
127
159
|
<li class="odd ">
|
128
160
|
<div class="item">
|
129
161
|
<span class='object_link'><a href="ASSFile.html#height-instance_method" title="ASSFile#height (method)">#height</a></span>
|
@@ -205,14 +237,6 @@
|
|
205
237
|
|
206
238
|
|
207
239
|
<li class="odd ">
|
208
|
-
<div class="item">
|
209
|
-
<span class='object_link'><a href="Vtt2ass.html#main-class_method" title="Vtt2ass.main (method)">main</a></span>
|
210
|
-
<small>Vtt2ass</small>
|
211
|
-
</div>
|
212
|
-
</li>
|
213
|
-
|
214
|
-
|
215
|
-
<li class="even ">
|
216
240
|
<div class="item">
|
217
241
|
<span class='object_link'><a href="ASSLine.html#padTimeNum-instance_method" title="ASSLine#padTimeNum (method)">#padTimeNum</a></span>
|
218
242
|
<small>ASSLine</small>
|
@@ -220,7 +244,7 @@
|
|
220
244
|
</li>
|
221
245
|
|
222
246
|
|
223
|
-
<li class="
|
247
|
+
<li class="even ">
|
224
248
|
<div class="item">
|
225
249
|
<span class='object_link'><a href="VTTLine.html#params-instance_method" title="VTTLine#params (method)">#params</a></span>
|
226
250
|
<small>VTTLine</small>
|
@@ -228,7 +252,7 @@
|
|
228
252
|
</li>
|
229
253
|
|
230
254
|
|
231
|
-
<li class="
|
255
|
+
<li class="odd ">
|
232
256
|
<div class="item">
|
233
257
|
<span class='object_link'><a href="Application.html#start-instance_method" title="Application#start (method)">#start</a></span>
|
234
258
|
<small>Application</small>
|
@@ -236,7 +260,7 @@
|
|
236
260
|
</li>
|
237
261
|
|
238
262
|
|
239
|
-
<li class="
|
263
|
+
<li class="even ">
|
240
264
|
<div class="item">
|
241
265
|
<span class='object_link'><a href="ASSLine.html#style-instance_method" title="ASSLine#style (method)">#style</a></span>
|
242
266
|
<small>ASSLine</small>
|
@@ -244,7 +268,7 @@
|
|
244
268
|
</li>
|
245
269
|
|
246
270
|
|
247
|
-
<li class="
|
271
|
+
<li class="odd ">
|
248
272
|
<div class="item">
|
249
273
|
<span class='object_link'><a href="VTTLine.html#style-instance_method" title="VTTLine#style (method)">#style</a></span>
|
250
274
|
<small>VTTLine</small>
|
@@ -252,7 +276,7 @@
|
|
252
276
|
</li>
|
253
277
|
|
254
278
|
|
255
|
-
<li class="
|
279
|
+
<li class="even ">
|
256
280
|
<div class="item">
|
257
281
|
<span class='object_link'><a href="ASSStyle.html#style_name-instance_method" title="ASSStyle#style_name (method)">#style_name</a></span>
|
258
282
|
<small>ASSStyle</small>
|
@@ -260,7 +284,7 @@
|
|
260
284
|
</li>
|
261
285
|
|
262
286
|
|
263
|
-
<li class="
|
287
|
+
<li class="odd ">
|
264
288
|
<div class="item">
|
265
289
|
<span class='object_link'><a href="ASSLine.html#text-instance_method" title="ASSLine#text (method)">#text</a></span>
|
266
290
|
<small>ASSLine</small>
|
@@ -268,7 +292,7 @@
|
|
268
292
|
</li>
|
269
293
|
|
270
294
|
|
271
|
-
<li class="
|
295
|
+
<li class="even ">
|
272
296
|
<div class="item">
|
273
297
|
<span class='object_link'><a href="VTTLine.html#text-instance_method" title="VTTLine#text (method)">#text</a></span>
|
274
298
|
<small>VTTLine</small>
|
@@ -276,7 +300,7 @@
|
|
276
300
|
</li>
|
277
301
|
|
278
302
|
|
279
|
-
<li class="
|
303
|
+
<li class="odd ">
|
280
304
|
<div class="item">
|
281
305
|
<span class='object_link'><a href="ASSLine.html#time_end-instance_method" title="ASSLine#time_end (method)">#time_end</a></span>
|
282
306
|
<small>ASSLine</small>
|
@@ -284,7 +308,7 @@
|
|
284
308
|
</li>
|
285
309
|
|
286
310
|
|
287
|
-
<li class="
|
311
|
+
<li class="even ">
|
288
312
|
<div class="item">
|
289
313
|
<span class='object_link'><a href="VTTLine.html#time_end-instance_method" title="VTTLine#time_end (method)">#time_end</a></span>
|
290
314
|
<small>VTTLine</small>
|
@@ -292,7 +316,7 @@
|
|
292
316
|
</li>
|
293
317
|
|
294
318
|
|
295
|
-
<li class="
|
319
|
+
<li class="odd ">
|
296
320
|
<div class="item">
|
297
321
|
<span class='object_link'><a href="ASSLine.html#time_start-instance_method" title="ASSLine#time_start (method)">#time_start</a></span>
|
298
322
|
<small>ASSLine</small>
|
@@ -300,7 +324,7 @@
|
|
300
324
|
</li>
|
301
325
|
|
302
326
|
|
303
|
-
<li class="
|
327
|
+
<li class="even ">
|
304
328
|
<div class="item">
|
305
329
|
<span class='object_link'><a href="VTTLine.html#time_start-instance_method" title="VTTLine#time_start (method)">#time_start</a></span>
|
306
330
|
<small>VTTLine</small>
|
@@ -308,7 +332,7 @@
|
|
308
332
|
</li>
|
309
333
|
|
310
334
|
|
311
|
-
<li class="
|
335
|
+
<li class="odd ">
|
312
336
|
<div class="item">
|
313
337
|
<span class='object_link'><a href="ASSFile.html#title-instance_method" title="ASSFile#title (method)">#title</a></span>
|
314
338
|
<small>ASSFile</small>
|
@@ -316,7 +340,7 @@
|
|
316
340
|
</li>
|
317
341
|
|
318
342
|
|
319
|
-
<li class="
|
343
|
+
<li class="even ">
|
320
344
|
<div class="item">
|
321
345
|
<span class='object_link'><a href="ASSLine.html#toSubsTime-instance_method" title="ASSLine#toSubsTime (method)">#toSubsTime</a></span>
|
322
346
|
<small>ASSLine</small>
|
@@ -324,7 +348,7 @@
|
|
324
348
|
</li>
|
325
349
|
|
326
350
|
|
327
|
-
<li class="
|
351
|
+
<li class="odd ">
|
328
352
|
<div class="item">
|
329
353
|
<span class='object_link'><a href="ASSFile.html#to_s-instance_method" title="ASSFile#to_s (method)">#to_s</a></span>
|
330
354
|
<small>ASSFile</small>
|
@@ -332,7 +356,7 @@
|
|
332
356
|
</li>
|
333
357
|
|
334
358
|
|
335
|
-
<li class="
|
359
|
+
<li class="even ">
|
336
360
|
<div class="item">
|
337
361
|
<span class='object_link'><a href="ASSLine.html#to_s-instance_method" title="ASSLine#to_s (method)">#to_s</a></span>
|
338
362
|
<small>ASSLine</small>
|
@@ -340,7 +364,7 @@
|
|
340
364
|
</li>
|
341
365
|
|
342
366
|
|
343
|
-
<li class="
|
367
|
+
<li class="odd ">
|
344
368
|
<div class="item">
|
345
369
|
<span class='object_link'><a href="VTTFile.html#to_s-instance_method" title="VTTFile#to_s (method)">#to_s</a></span>
|
346
370
|
<small>VTTFile</small>
|
@@ -348,7 +372,7 @@
|
|
348
372
|
</li>
|
349
373
|
|
350
374
|
|
351
|
-
<li class="
|
375
|
+
<li class="even ">
|
352
376
|
<div class="item">
|
353
377
|
<span class='object_link'><a href="VTTLine.html#to_s-instance_method" title="VTTLine#to_s (method)">#to_s</a></span>
|
354
378
|
<small>VTTLine</small>
|
@@ -356,7 +380,7 @@
|
|
356
380
|
</li>
|
357
381
|
|
358
382
|
|
359
|
-
<li class="
|
383
|
+
<li class="odd ">
|
360
384
|
<div class="item">
|
361
385
|
<span class='object_link'><a href="ASSStyle.html#to_s-instance_method" title="ASSStyle#to_s (method)">#to_s</a></span>
|
362
386
|
<small>ASSStyle</small>
|
@@ -364,6 +388,14 @@
|
|
364
388
|
</li>
|
365
389
|
|
366
390
|
|
391
|
+
<li class="even ">
|
392
|
+
<div class="item">
|
393
|
+
<span class='object_link'><a href="MainCommand.html#version-instance_method" title="MainCommand#version (method)">#version</a></span>
|
394
|
+
<small>MainCommand</small>
|
395
|
+
</div>
|
396
|
+
</li>
|
397
|
+
|
398
|
+
|
367
399
|
<li class="odd ">
|
368
400
|
<div class="item">
|
369
401
|
<span class='object_link'><a href="ASSStyleParams.html#vertical_margin-instance_method" title="ASSStyleParams#vertical_margin (method)">#vertical_margin</a></span>
|
@@ -86,7 +86,7 @@
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="ASSFile.html" title="ASSFile (class)">ASSFile</a></span>, <span class='object_link'><a href="ASSLine.html" title="ASSLine (class)">ASSLine</a></span>, <span class='object_link'><a href="ASSStyle.html" title="ASSStyle (class)">ASSStyle</a></span>, <span class='object_link'><a href="ASSStyleParams.html" title="ASSStyleParams (class)">ASSStyleParams</a></span>, <span class='object_link'><a href="Application.html" title="Application (class)">Application</a></span>, <span class='object_link'><a href="VTTFile.html" title="VTTFile (class)">VTTFile</a></span>, <span class='object_link'><a href="VTTLine.html" title="VTTLine (class)">VTTLine</a></span>
|
89
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="ASSFile.html" title="ASSFile (class)">ASSFile</a></span>, <span class='object_link'><a href="ASSLine.html" title="ASSLine (class)">ASSLine</a></span>, <span class='object_link'><a href="ASSStyle.html" title="ASSStyle (class)">ASSStyle</a></span>, <span class='object_link'><a href="ASSStyleParams.html" title="ASSStyleParams (class)">ASSStyleParams</a></span>, <span class='object_link'><a href="Application.html" title="Application (class)">Application</a></span>, <span class='object_link'><a href="MainCommand.html" title="MainCommand (class)">MainCommand</a></span>, <span class='object_link'><a href="VTTFile.html" title="VTTFile (class)">VTTFile</a></span>, <span class='object_link'><a href="VTTLine.html" title="VTTLine (class)">VTTLine</a></span>
|
90
90
|
|
91
91
|
|
92
92
|
</p>
|
@@ -102,9 +102,9 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Mon Nov 22 21:50:10 2021 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
|
-
0.9.26 (ruby-3.0.
|
107
|
+
0.9.26 (ruby-3.0.2).
|
108
108
|
</div>
|
109
109
|
|
110
110
|
</div>
|
data/exe/vtt2ass
CHANGED
data/lib/vtt2ass/Application.rb
CHANGED
@@ -9,9 +9,9 @@ class Application
|
|
9
9
|
##
|
10
10
|
# Creates a new Application instance.
|
11
11
|
# It receives +options+ that can define the input and output directories.
|
12
|
-
def initialize(options)
|
13
|
-
@input =
|
14
|
-
@output = options[:output] ? options[:output].gsub('\\', '/').delete_suffix('/') :
|
12
|
+
def initialize(input, options)
|
13
|
+
@input = input ? input.gsub('\\', '/').delete_suffix('/') : "."
|
14
|
+
@output = options[:output] ? options[:output].gsub('\\', '/').delete_suffix('/') : nil
|
15
15
|
@width = 1920
|
16
16
|
@height = 1080
|
17
17
|
@font_family = options[:font_family] ? options[:font_family] : 'Open Sans Semibold'
|
@@ -41,7 +41,9 @@ class Application
|
|
41
41
|
|
42
42
|
def convert(input_path)
|
43
43
|
ass_file = vtt_to_ass(input_path)
|
44
|
-
|
44
|
+
if (not @output.nil?) then
|
45
|
+
ass_file.writeToFile(@output + '/' + File.basename(input_path).gsub('.vtt', '.ass'))
|
46
|
+
end
|
45
47
|
puts ass_file.to_s unless @quiet
|
46
48
|
end
|
47
49
|
|
data/lib/vtt2ass/VTTFile.rb
CHANGED
@@ -13,10 +13,18 @@ class VTTFile
|
|
13
13
|
@lines = []
|
14
14
|
separator = determine_line_ending(file_path) ? "\n\n" : "\r\n\r\n"
|
15
15
|
count = 0
|
16
|
+
style_count = 1
|
16
17
|
File.foreach(file_path, separator) do |paragraph|
|
17
18
|
paragraph = paragraph.rstrip.gsub(/[\r\n]/, "\n")
|
18
19
|
if not paragraph.eql? "" then
|
19
20
|
vtt_line = VTTLine.new(paragraph, width, height)
|
21
|
+
if vtt_line.style.eql? 'Main' and
|
22
|
+
not vtt_line.params.to_s.empty? and
|
23
|
+
(not vtt_line.params.to_s.eql? 'align:middle' and
|
24
|
+
not vtt_line.params.to_s.eql? 'align:center') then
|
25
|
+
vtt_line.style = "Style#{style_count}"
|
26
|
+
style_count += 1
|
27
|
+
end
|
20
28
|
@lines.push(vtt_line)
|
21
29
|
count += 1
|
22
30
|
end
|
@@ -24,6 +32,8 @@ class VTTFile
|
|
24
32
|
@lines.shift
|
25
33
|
end
|
26
34
|
|
35
|
+
##
|
36
|
+
# This method determines the line ending character to use as a separator.
|
27
37
|
def determine_line_ending(file_path)
|
28
38
|
File.open(file_path, 'r') do |file|
|
29
39
|
return file.readline[/\r?\n$/] == "\n"
|
data/lib/vtt2ass/VTTLine.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
##
|
2
2
|
# This class defines a VTT subtile line.
|
3
3
|
class VTTLine
|
4
|
-
|
4
|
+
attr_accessor :style
|
5
|
+
attr_reader :time_start, :time_end, :params, :text
|
5
6
|
|
6
7
|
##
|
7
8
|
# This method creates an instance of an VTTLine.
|
@@ -24,7 +25,7 @@ class VTTLine
|
|
24
25
|
@params = m[3]
|
25
26
|
ass_style = ASSStyleParams.new(@params, width, height)
|
26
27
|
if @style.eql? 'Main' and ass_style.alignment == 8 then
|
27
|
-
@style =
|
28
|
+
@style = 'MainTop'
|
28
29
|
end
|
29
30
|
else
|
30
31
|
@text += line + "\n"
|
data/lib/vtt2ass/version.rb
CHANGED
data/lib/vtt2ass.rb
CHANGED
@@ -1,110 +1,28 @@
|
|
1
1
|
# Imports
|
2
|
-
require '
|
2
|
+
require 'thor'
|
3
3
|
|
4
4
|
# Relative imports
|
5
5
|
require_relative 'vtt2ass/version'
|
6
6
|
require_relative 'vtt2ass/Application'
|
7
7
|
|
8
|
-
class
|
9
|
-
|
10
|
-
|
11
|
-
usage do
|
12
|
-
header 'VTT2ASS'
|
13
|
-
program 'vtt2ass'
|
14
|
-
command ''
|
15
|
-
desc 'Convert VTT subtitles to ASS subtitles'
|
16
|
-
example "Convert files in a specific directory",
|
17
|
-
" $ vtt2ass ./path/to/file_input ./path/to/file_output"
|
18
|
-
end
|
19
|
-
|
20
|
-
# ------------------------------
|
21
|
-
# Arguments
|
22
|
-
# ------------------------------
|
23
|
-
|
24
|
-
argument :input do
|
25
|
-
optional
|
26
|
-
desc "Input directory or file (default: current directory)"
|
27
|
-
end
|
28
|
-
|
29
|
-
argument :output do
|
30
|
-
optional
|
31
|
-
desc "Output directory (default: console output)"
|
32
|
-
end
|
33
|
-
|
34
|
-
# ------------------------------
|
35
|
-
# Flags
|
36
|
-
# ------------------------------
|
37
|
-
|
38
|
-
flag :help do
|
39
|
-
short "-h"
|
40
|
-
long "--help"
|
41
|
-
desc "Print usage"
|
42
|
-
end
|
43
|
-
|
44
|
-
flag :version do
|
45
|
-
short "-v"
|
46
|
-
long "--version"
|
47
|
-
desc "Show version"
|
48
|
-
end
|
49
|
-
|
50
|
-
flag :quiet do
|
51
|
-
short "-q"
|
52
|
-
long "--quiet"
|
53
|
-
desc "Prevent the command from outputing to the console"
|
54
|
-
end
|
55
|
-
|
56
|
-
flag :noout do
|
57
|
-
short "-x"
|
58
|
-
long "--noout"
|
59
|
-
desc "Prevents the command from writing the resulting file(s) to the output folder"
|
60
|
-
end
|
61
|
-
|
62
|
-
# ------------------------------
|
63
|
-
# Options
|
64
|
-
# ------------------------------
|
65
|
-
|
66
|
-
option :title do
|
67
|
-
optional
|
68
|
-
short "-t STRING"
|
69
|
-
long "--title STRING"
|
70
|
-
desc "Specify a title for you file. If the input is a directory, all files will share the same title."
|
8
|
+
class MainCommand < Thor
|
9
|
+
def self.exit_on_failure?
|
10
|
+
true
|
71
11
|
end
|
72
12
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
13
|
+
desc 'convert INPUT', 'Run the VTT to ASS conversion for the specified file(s)'
|
14
|
+
method_option :output, :aliases => '-o', :desc => 'Output directory of the converted file' , :lazy_default => './', :type => :string
|
15
|
+
method_option :title, :aliases => '-t', :desc => 'Specify a title for you file. If the input is a directory, all files will share the same title.', :type => :string
|
16
|
+
method_option :font_size, :aliases => '-s', :desc => 'Specify a font size for the subtitles', :default => 52, :type => :numeric
|
17
|
+
method_option :font_family, :aliases => '-f', :desc => 'Specify a font family for the subtitles', :default => 'Open Sans Semibold', :type => :string
|
18
|
+
method_option :quiet, :aliases => '-q', :desc => 'Don\'t output to the console', :type => :boolean
|
19
|
+
def convert(input)
|
20
|
+
app = Application.new(input, options)
|
21
|
+
app.start
|
78
22
|
end
|
79
23
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
long "--font-family STRING"
|
84
|
-
desc "Specify a font family for the subtitles (default: 'Open Sans Semibold')"
|
24
|
+
desc 'version', 'Show version'
|
25
|
+
def version
|
26
|
+
puts Vtt2ass::VERSION
|
85
27
|
end
|
86
|
-
|
87
|
-
def run
|
88
|
-
if params[:help] then
|
89
|
-
print help
|
90
|
-
exit
|
91
|
-
elsif params[:version] then
|
92
|
-
puts Vtt2ass::VERSION
|
93
|
-
exit
|
94
|
-
else
|
95
|
-
runner = Application.new(params)
|
96
|
-
# pp params.to_h
|
97
|
-
runner.start
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
module Vtt2ass
|
103
|
-
def main
|
104
|
-
app = Command.new
|
105
|
-
app.parse
|
106
|
-
app.run
|
107
|
-
end
|
108
|
-
|
109
|
-
module_function :main
|
110
28
|
end
|