vtt2ass 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b13c0f4e714b058d076bddda1685ba4007429a2c9c0dc065073926bee9dd2dad
4
+ data.tar.gz: acbfd744b30cd214f174ec4fe991a6983cb206b89a65956115be803cf005b22c
5
+ SHA512:
6
+ metadata.gz: 99c2d00e1d03c7e8ae463266ea500ad0ebf10f0b7eeae972b4d2776887a1a0936f5707633832c26fc6bc66fdd13e0bd53ff73200c2f5ae128517266a29d46a31
7
+ data.tar.gz: 17d541540f391fe95e5aeea3d0795ee36b5856f1cc6d69de4bcf6ac59b7a647e1cc3509e57b291a80c0a753b058a01d291944e435a9dd917358a99c5f69ed574
@@ -0,0 +1,9 @@
1
+ # Lock file
2
+ Gemfile.lock
3
+
4
+ # Temporary files for yard documentation
5
+ .yardoc/
6
+
7
+ # Input and output folders
8
+ input/
9
+ output/
@@ -0,0 +1,31 @@
1
+ image: ruby:2.7.2
2
+
3
+ stages:
4
+ - test
5
+ - build
6
+ - deploy
7
+
8
+ test:
9
+ stage: test
10
+ script:
11
+ - ./bin/setup
12
+ - rake test
13
+
14
+ build:
15
+ stage: build
16
+ only:
17
+ - master
18
+ artifacts:
19
+ untracked: true
20
+ script:
21
+ - mkdir build
22
+ - gem build vtt2ass.gemspec -o "build/release.gem"
23
+
24
+ deploy:
25
+ stage: deploy
26
+ only:
27
+ - master
28
+ dependencies:
29
+ - build
30
+ script:
31
+ - gem push build/release.gem -k rubygems_b54a36e70dba06b9a9c7268807eb2bbb896cdba924c67289
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vtt2ass.gemspec
4
+ gemspec
5
+
6
+ gem 'os'
7
+ gem 'yard'
8
+ gem "rake", "~> 12.0"
9
+ gem "minitest", "~> 5.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Louis-Philippe Fortin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # VTT to ASS
2
+
3
+ This is a simple application to convert VTT files to ASS subtitles.
4
+
5
+ ## Requirements
6
+ - ruby 2.7.2 or newer
7
+
8
+ It might work with older versions of ruby, but it hasn't been tested
9
+
10
+ ## Installation
11
+
12
+ To install:
13
+ ```bash
14
+ gem install vtt2ass
15
+ ```
16
+
17
+ # Build
18
+
19
+ ```bash
20
+ gem build vtt2ass.gemspec
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ Add your VTT files in your `input` directory.
26
+
27
+ Run this command:
28
+ ```bash
29
+ $ vtt2ass
30
+ ```
31
+
32
+ ## Help
33
+
34
+ ```bash
35
+ $ vtt2ass -h
36
+ Usage: vtt2ass [options]
37
+
38
+ Specific options:
39
+ -i, --input DIRECTORY Specify a custom input directory (default: './input')
40
+ -o, --output DIRECTORY Specify a custom output directory (default: './output')
41
+ -s, --font-size SIZE Specify a font size for the subtitles (default: 72)
42
+ ```
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/run ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/vtt2ass'
4
+ Vtt2ass::main
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,338 @@
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: ASSFile
8
+
9
+ &mdash; 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 = "ASSFile";
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> &raquo;
40
+
41
+
42
+ <span class="title">ASSFile</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: ASSFile
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">ASSFile</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/ASSFile.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>This class defines the ASS File that will be created from the conversion.</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="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(ass_styles, ass_subs, width, height) &#x21d2; ASSFile </a>
132
+
133
+
134
+
135
+ </span>
136
+
137
+
138
+ <span class="note title constructor">constructor</span>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <span class="summary_desc"><div class='inline'>
148
+ <p>This method creates an instance of the ASSFile.</p>
149
+ </div></span>
150
+
151
+ </li>
152
+
153
+
154
+ <li class="public ">
155
+ <span class="summary_signature">
156
+
157
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
158
+
159
+
160
+
161
+ </span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'>
172
+ <p>This method concatenates the object data in the right order for a string output.</p>
173
+ </div></span>
174
+
175
+ </li>
176
+
177
+
178
+ </ul>
179
+
180
+
181
+ <div id="constructor_details" class="method_details_list">
182
+ <h2>Constructor Details</h2>
183
+
184
+ <div class="method_details first">
185
+ <h3 class="signature first" id="initialize-instance_method">
186
+
187
+ #<strong>initialize</strong>(ass_styles, ass_subs, width, height) &#x21d2; <tt><span class='object_link'><a href="" title="ASSFile (class)">ASSFile</a></span></tt>
188
+
189
+
190
+
191
+
192
+
193
+ </h3><div class="docstring">
194
+ <div class="discussion">
195
+
196
+ <p>This method creates an instance of the ASSFile.</p>
197
+ <ul><li>
198
+ <p>Requires <code>ass_styles</code>, a list of ASSStyle as input.</p>
199
+ </li><li>
200
+ <p>Requires <code>ass_subs</code>, a list of ASSSubtitles as input.</p>
201
+ </li><li>
202
+ <p>Requires a video <code>width</code> as input.</p>
203
+ </li><li>
204
+ <p>Requires a video <code>height</code> as input.</p>
205
+ </li></ul>
206
+
207
+
208
+ </div>
209
+ </div>
210
+ <div class="tags">
211
+
212
+
213
+ </div><table class="source_code">
214
+ <tr>
215
+ <td>
216
+ <pre class="lines">
217
+
218
+
219
+ 12
220
+ 13
221
+ 14
222
+ 15
223
+ 16
224
+ 17
225
+ 18
226
+ 19
227
+ 20
228
+ 21
229
+ 22
230
+ 23
231
+ 24
232
+ 25
233
+ 26
234
+ 27
235
+ 28
236
+ 29
237
+ 30
238
+ 31
239
+ 32
240
+ 33
241
+ 34
242
+ 35
243
+ 36</pre>
244
+ </td>
245
+ <td>
246
+ <pre class="code"><span class="info file"># File 'lib/vtt2ass/ASSFile.rb', line 12</span>
247
+
248
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</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='id identifier rubyid_width'>width</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='rparen'>)</span>
249
+ <span class='ivar'>@width</span> <span class='op'>=</span> <span class='id identifier rubyid_width'>width</span>
250
+ <span class='ivar'>@height</span> <span class='op'>=</span> <span class='id identifier rubyid_height'>height</span>
251
+ <span class='ivar'>@header</span> <span class='op'>=</span> <span class='lbracket'>[</span>
252
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[Script Info]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
253
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Title: DKB Team</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
254
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ScriptType: v4.00+</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
255
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Collisions: Normal</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
256
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>PlayDepth: 0</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
257
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>PlayResX: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@width</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
258
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>PlayResY: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@height</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
259
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>WrapStyle: 0</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
260
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ScaledBorderAndShadow: yes</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
261
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
262
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[V4+ Styles]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
263
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding</span><span class='tstring_end'>&#39;</span></span>
264
+ <span class='rbracket'>]</span>
265
+ <span class='ivar'>@ass_styles</span> <span class='op'>=</span> <span class='id identifier rubyid_ass_styles'>ass_styles</span>
266
+ <span class='ivar'>@events</span> <span class='op'>=</span> <span class='lbracket'>[</span>
267
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
268
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[Events]</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
269
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text</span><span class='tstring_end'>&#39;</span></span>
270
+ <span class='rbracket'>]</span>
271
+ <span class='ivar'>@ass_subs</span> <span class='op'>=</span> <span class='id identifier rubyid_ass_subs'>ass_subs</span>
272
+ <span class='kw'>end</span></pre>
273
+ </td>
274
+ </tr>
275
+ </table>
276
+ </div>
277
+
278
+ </div>
279
+
280
+
281
+ <div id="instance_method_details" class="method_details_list">
282
+ <h2>Instance Method Details</h2>
283
+
284
+
285
+ <div class="method_details first">
286
+ <h3 class="signature first" id="to_s-instance_method">
287
+
288
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
289
+
290
+
291
+
292
+
293
+
294
+ </h3><div class="docstring">
295
+ <div class="discussion">
296
+
297
+ <p>This method concatenates the object data in the right order for a string output.</p>
298
+
299
+
300
+ </div>
301
+ </div>
302
+ <div class="tags">
303
+
304
+
305
+ </div><table class="source_code">
306
+ <tr>
307
+ <td>
308
+ <pre class="lines">
309
+
310
+
311
+ 40
312
+ 41
313
+ 42</pre>
314
+ </td>
315
+ <td>
316
+ <pre class="code"><span class="info file"># File 'lib/vtt2ass/ASSFile.rb', line 40</span>
317
+
318
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
319
+ <span class='kw'>return</span> <span class='ivar'>@header</span> <span class='op'>+</span> <span class='ivar'>@ass_styles</span> <span class='op'>+</span> <span class='ivar'>@events</span> <span class='op'>+</span> <span class='ivar'>@ass_subs</span>
320
+ <span class='kw'>end</span></pre>
321
+ </td>
322
+ </tr>
323
+ </table>
324
+ </div>
325
+
326
+ </div>
327
+
328
+ </div>
329
+
330
+ <div id="footer">
331
+ Generated on Thu Jan 14 00:31:16 2021 by
332
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
333
+ 0.9.26 (ruby-2.7.2).
334
+ </div>
335
+
336
+ </div>
337
+ </body>
338
+ </html>