encoder-tools 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -23
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -10
- data/Gemfile.lock +37 -83
- data/LICENSE +1 -1
- data/README.md +14 -0
- data/Rakefile +3 -43
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/encoder-tools.gemspec +28 -0
- data/lib/encoder-tools.rb +1 -0
- data/lib/encoder-tools/cli.rb +23 -12
- data/lib/encoder-tools/cli/subtitles.rb +1 -0
- data/lib/encoder-tools/cli/subtitles/base.rb +26 -3
- data/lib/encoder-tools/cli/subtitles/fix_lengths.rb +35 -21
- data/lib/encoder-tools/cli/subtitles/offset.rb +33 -12
- data/lib/encoder-tools/cli/subtitles/renumber.rb +3 -1
- data/lib/encoder-tools/cli/subtitles/spell_check.rb +73 -0
- data/lib/encoder-tools/subtitles/list.rb +5 -0
- data/lib/encoder-tools/subtitles/parser.rb +1 -1
- data/lib/encoder-tools/subtitles/subtitle.rb +9 -2
- data/lib/encoder-tools/util.rb +5 -0
- data/lib/encoder-tools/util/text_reader.rb +26 -0
- data/lib/encoder-tools/version.rb +3 -0
- metadata +95 -96
- data/README.rdoc +0 -17
- data/VERSION +0 -1
- data/spec/cli/subtitles/fix_lengths_spec.rb +0 -51
- data/spec/cli/subtitles/offset_spec.rb +0 -40
- data/spec/cli/subtitles/renumber_spec.rb +0 -23
- data/spec/fixtures/subtitles/adjusted-long-subtitles.srt +0 -16
- data/spec/fixtures/subtitles/bad-numbering-corrected.srt +0 -16
- data/spec/fixtures/subtitles/bad-numbering.srt +0 -16
- data/spec/fixtures/subtitles/kill-bill-vol-2.srt +0 -345
- data/spec/fixtures/subtitles/no-long-subtitles.srt +0 -16
- data/spec/fixtures/subtitles/short-example-offset-2.srt +0 -16
- data/spec/fixtures/subtitles/short-example-offset-minus-2.srt +0 -16
- data/spec/fixtures/subtitles/short-example-offset-plus-2.srt +0 -16
- data/spec/fixtures/subtitles/short-example.srt +0 -16
- data/spec/fixtures/subtitles/some-long-subtitles.srt +0 -16
- data/spec/options/title_spec.rb +0 -41
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -31
- data/spec/strategies/movie_spec.rb +0 -23
- data/spec/subtitles/list_spec.rb +0 -57
- data/spec/subtitles/subtitle_spec.rb +0 -31
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= encoder-tools
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Brian Donovan. See LICENSE for details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.2
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe EncoderTools::CLI::Subtitles::FixLengths do
|
4
|
-
it_should_behave_like 'a CLI command'
|
5
|
-
before { stub_shell! }
|
6
|
-
|
7
|
-
context "with no subtitle lengths over the threshold" do
|
8
|
-
before { input.string = subfile('no-long-subtitles') }
|
9
|
-
|
10
|
-
it "says that there are no subtitles over the threshold" do
|
11
|
-
shell.should_receive(:say).with("No subtitles found over #{described_class::THRESHOLD}s")
|
12
|
-
subject.run
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "with some subtitle lengths over the threshold" do
|
17
|
-
before { input.string = subfile('some-long-subtitles') }
|
18
|
-
|
19
|
-
it "asks whether the user wants to fix the long subtitles" do
|
20
|
-
shell.should_receive(:yes?).with("Found 2 long subtitles. Would you like to fix them?").and_return(false)
|
21
|
-
subject.run
|
22
|
-
end
|
23
|
-
|
24
|
-
it "asks for each subtitle how long it should be" do
|
25
|
-
shell.should_receive(:yes?).and_return(true)
|
26
|
-
shell.should_receive(:say).with(<<-TEXT)
|
27
|
-
00:45:21,373 --> 01:45:22,681 (3601s)
|
28
|
-
It causes my ears discomfort.
|
29
|
-
|
30
|
-
TEXT
|
31
|
-
shell.should_receive(:say).with(<<-TEXT)
|
32
|
-
01:45:22,748 --> 02:45:24,274 (3601s)
|
33
|
-
You bray like an ass!
|
34
|
-
|
35
|
-
TEXT
|
36
|
-
shell.should_receive(:ask).
|
37
|
-
with("How long should it be?").
|
38
|
-
twice.
|
39
|
-
and_return('2')
|
40
|
-
subject.run
|
41
|
-
end
|
42
|
-
|
43
|
-
it "writes the adjusted subtitles" do
|
44
|
-
shell.should_receive(:yes?).and_return(true)
|
45
|
-
shell.should_receive(:say).twice
|
46
|
-
shell.should_receive(:ask).twice.and_return('2')
|
47
|
-
subject.run
|
48
|
-
output.string.should == subfile('adjusted-long-subtitles')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe EncoderTools::CLI::Subtitles::Offset do
|
4
|
-
it_should_behave_like 'a CLI command'
|
5
|
-
|
6
|
-
it "does nothing with an empty subtitle list" do
|
7
|
-
options[:offset] = '+0'
|
8
|
-
input.string = ""
|
9
|
-
subject.run
|
10
|
-
output.string.should == ""
|
11
|
-
end
|
12
|
-
|
13
|
-
it "does not alter a subtitle list with zero offset" do
|
14
|
-
options[:offset] = '+0'
|
15
|
-
input.string = subfile("kill-bill-vol-2")
|
16
|
-
subject.run
|
17
|
-
output.string.should == subfile("kill-bill-vol-2")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "writes a file with positive offset" do
|
21
|
-
options[:offset] = '+2'
|
22
|
-
input.string = subfile("short-example")
|
23
|
-
subject.run
|
24
|
-
output.string.should == subfile("short-example-offset-plus-2")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "writes a file with negative offset" do
|
28
|
-
options[:offset] = '-2'
|
29
|
-
input.string = subfile("short-example")
|
30
|
-
subject.run
|
31
|
-
output.string.should == subfile("short-example-offset-minus-2")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "writes a file with absolute offset" do
|
35
|
-
options[:offset] = '2'
|
36
|
-
input.string = subfile("short-example")
|
37
|
-
subject.run
|
38
|
-
output.string.should == subfile("short-example-offset-2")
|
39
|
-
end
|
40
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe EncoderTools::CLI::Subtitles::Renumber do
|
4
|
-
it_should_behave_like 'a CLI command'
|
5
|
-
|
6
|
-
it "does nothing with an empty subtitle list" do
|
7
|
-
input.string = ""
|
8
|
-
subject.run
|
9
|
-
output.string.should == ""
|
10
|
-
end
|
11
|
-
|
12
|
-
it "does not alter a correctly-numbered subtitle list" do
|
13
|
-
input.string = subfile("kill-bill-vol-2")
|
14
|
-
subject.run
|
15
|
-
output.string.should == subfile("kill-bill-vol-2")
|
16
|
-
end
|
17
|
-
|
18
|
-
it "fixes bad numbering in a subtitle list" do
|
19
|
-
input.string = subfile("bad-numbering")
|
20
|
-
subject.run
|
21
|
-
output.string.should == subfile("bad-numbering-corrected")
|
22
|
-
end
|
23
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
1
|
2
|
-
00:45:16,000 --> 00:45:17,145
|
3
|
-
Master...
|
4
|
-
|
5
|
-
2
|
6
|
-
00:45:18,815 --> 00:45:20,440
|
7
|
-
Your Mandarin is lousy.
|
8
|
-
|
9
|
-
3
|
10
|
-
00:45:21,373 --> 00:45:23,373
|
11
|
-
It causes my ears discomfort.
|
12
|
-
|
13
|
-
4
|
14
|
-
01:45:22,748 --> 01:45:24,748
|
15
|
-
You bray like an ass!
|
16
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
1
|
2
|
-
00:45:16,000 --> 00:45:17,145
|
3
|
-
Master...
|
4
|
-
|
5
|
-
2
|
6
|
-
00:45:18,815 --> 00:45:20,440
|
7
|
-
Your Mandarin is lousy.
|
8
|
-
|
9
|
-
3
|
10
|
-
00:45:21,373 --> 00:45:22,681
|
11
|
-
It causes my ears discomfort.
|
12
|
-
|
13
|
-
4
|
14
|
-
00:45:22,748 --> 00:45:24,274
|
15
|
-
You bray like an ass!
|
16
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
5
|
2
|
-
00:45:16,000 --> 00:45:17,145
|
3
|
-
Master...
|
4
|
-
|
5
|
-
9
|
6
|
-
00:45:18,815 --> 00:45:20,440
|
7
|
-
Your Mandarin is lousy.
|
8
|
-
|
9
|
-
12
|
10
|
-
00:45:21,373 --> 00:45:22,681
|
11
|
-
It causes my ears discomfort.
|
12
|
-
|
13
|
-
899
|
14
|
-
00:45:22,748 --> 00:45:24,274
|
15
|
-
You bray like an ass!
|
16
|
-
|
@@ -1,345 +0,0 @@
|
|
1
|
-
1
|
2
|
-
00:45:16,000 --> 00:45:17,145
|
3
|
-
Master...
|
4
|
-
|
5
|
-
2
|
6
|
-
00:45:18,815 --> 00:45:20,440
|
7
|
-
Your Mandarin is lousy.
|
8
|
-
|
9
|
-
3
|
10
|
-
00:45:21,373 --> 00:45:22,681
|
11
|
-
It causes my ears discomfort.
|
12
|
-
|
13
|
-
4
|
14
|
-
00:45:22,748 --> 00:45:24,274
|
15
|
-
You bray like an ass!
|
16
|
-
|
17
|
-
5
|
18
|
-
00:45:25,050 --> 00:45:27,089
|
19
|
-
You are not to speak unless spoken to.
|
20
|
-
|
21
|
-
6
|
22
|
-
00:45:27,960 --> 00:45:31,405
|
23
|
-
Is it too much to hope...
|
24
|
-
you understand Cantonese?
|
25
|
-
|
26
|
-
7
|
27
|
-
00:45:34,995 --> 00:45:36,423
|
28
|
-
I speak Japanese very well...
|
29
|
-
|
30
|
-
8
|
31
|
-
00:45:36,498 --> 00:45:39,562
|
32
|
-
I didn't ask if you speak Japanese...
|
33
|
-
|
34
|
-
9
|
35
|
-
00:45:39,632 --> 00:45:41,802
|
36
|
-
I asked if you understand Cantonese?
|
37
|
-
|
38
|
-
10
|
39
|
-
00:45:44,780 --> 00:45:49,185
|
40
|
-
You are here to learn the mysteries of
|
41
|
-
Kung Fu, not linguistics.
|
42
|
-
|
43
|
-
11
|
44
|
-
00:45:49,577 --> 00:45:53,186
|
45
|
-
If you can't understand me... I will
|
46
|
-
communicate with you like I would a dog.
|
47
|
-
|
48
|
-
12
|
49
|
-
00:45:53,383 --> 00:45:56,729
|
50
|
-
When I yell, when I point, when I beat you
|
51
|
-
with my stick!
|
52
|
-
|
53
|
-
13
|
54
|
-
00:46:02,433 --> 00:46:04,341
|
55
|
-
Bill is your master, is he not?
|
56
|
-
|
57
|
-
14
|
58
|
-
00:46:09,851 --> 00:46:14,321
|
59
|
-
Your master tells me...
|
60
|
-
you're not entirely unschooled.
|
61
|
-
|
62
|
-
15
|
63
|
-
00:46:14,392 --> 00:46:15,700
|
64
|
-
What training do you possess?
|
65
|
-
|
66
|
-
16
|
67
|
-
00:46:24,273 --> 00:46:27,718
|
68
|
-
The exquisite art of the Samurai sword.
|
69
|
-
Don't make me laugh!
|
70
|
-
|
71
|
-
17
|
72
|
-
00:46:27,790 --> 00:46:31,617
|
73
|
-
Your so-called exquisite art,
|
74
|
-
is only fit for...
|
75
|
-
|
76
|
-
18
|
77
|
-
00:46:31,692 --> 00:46:33,446
|
78
|
-
Japanese fat heads!
|
79
|
-
|
80
|
-
19
|
81
|
-
00:46:38,375 --> 00:46:43,293
|
82
|
-
Your anger amuses me. Do you believe
|
83
|
-
you are my match?
|
84
|
-
|
85
|
-
20
|
86
|
-
00:46:43,811 --> 00:46:44,378
|
87
|
-
No.
|
88
|
-
|
89
|
-
21
|
90
|
-
00:46:45,186 --> 00:46:47,073
|
91
|
-
Are you aware I kill at will?
|
92
|
-
|
93
|
-
22
|
94
|
-
00:46:47,713 --> 00:46:48,727
|
95
|
-
Yes.
|
96
|
-
|
97
|
-
23
|
98
|
-
00:46:49,215 --> 00:46:50,556
|
99
|
-
Is it your wish to die?
|
100
|
-
|
101
|
-
24
|
102
|
-
00:46:50,942 --> 00:46:51,291
|
103
|
-
No.
|
104
|
-
|
105
|
-
25
|
106
|
-
00:46:53,373 --> 00:46:54,266
|
107
|
-
Then you must be stupid...
|
108
|
-
|
109
|
-
26
|
110
|
-
00:46:54,300 --> 00:46:56,600
|
111
|
-
Then you must be stupid... so stupid.
|
112
|
-
|
113
|
-
27
|
114
|
-
00:46:56,667 --> 00:47:00,242
|
115
|
-
Rise, and let me look at your
|
116
|
-
ridiculous face.
|
117
|
-
|
118
|
-
28
|
119
|
-
00:47:00,727 --> 00:47:01,839
|
120
|
-
Rise.
|
121
|
-
|
122
|
-
29
|
123
|
-
00:47:06,196 --> 00:47:11,560
|
124
|
-
So my pathetic friend...
|
125
|
-
Is there anything that you can do well?
|
126
|
-
|
127
|
-
30
|
128
|
-
00:47:12,399 --> 00:47:14,253
|
129
|
-
What's the matter?
|
130
|
-
|
131
|
-
31
|
132
|
-
00:47:14,670 --> 00:47:16,523
|
133
|
-
Cat got your tongue?
|
134
|
-
|
135
|
-
32
|
136
|
-
00:47:17,931 --> 00:47:20,777
|
137
|
-
- Oh yes, you speak Japanese.
|
138
|
-
|
139
|
-
33
|
140
|
-
00:47:21,385 --> 00:47:22,758
|
141
|
-
I despise the Goddamn Japs!
|
142
|
-
|
143
|
-
34
|
144
|
-
00:47:25,670 --> 00:47:27,327
|
145
|
-
Go to that rack.
|
146
|
-
|
147
|
-
35
|
148
|
-
00:47:35,296 --> 00:47:36,223
|
149
|
-
Remove the sword.
|
150
|
-
|
151
|
-
36
|
152
|
-
00:48:01,453 --> 00:48:03,175
|
153
|
-
Let's see how good you really are.
|
154
|
-
|
155
|
-
37
|
156
|
-
00:48:04,012 --> 00:48:05,571
|
157
|
-
If...
|
158
|
-
|
159
|
-
38
|
160
|
-
00:48:06,218 --> 00:48:07,842
|
161
|
-
...you land a single blow,
|
162
|
-
|
163
|
-
39
|
164
|
-
00:48:09,512 --> 00:48:11,169
|
165
|
-
I'll bow down and call you master.
|
166
|
-
|
167
|
-
40
|
168
|
-
00:48:24,828 --> 00:48:27,128
|
169
|
-
From here you can get an excellent
|
170
|
-
view of my foot.
|
171
|
-
|
172
|
-
41
|
173
|
-
00:48:32,151 --> 00:48:35,346
|
174
|
-
Your swordsmanship... is amateur at best.
|
175
|
-
|
176
|
-
42
|
177
|
-
00:48:48,908 --> 00:48:54,022
|
178
|
-
Your so-called kung-fu... is really...
|
179
|
-
quite pathetic.
|
180
|
-
|
181
|
-
43
|
182
|
-
00:48:56,742 --> 00:49:00,384
|
183
|
-
I asked you to demonstrate... what you know
|
184
|
-
- and you did...
|
185
|
-
|
186
|
-
44
|
187
|
-
00:49:01,060 --> 00:49:02,204
|
188
|
-
Not a goddamn thing!
|
189
|
-
|
190
|
-
45
|
191
|
-
00:49:03,234 --> 00:49:06,712
|
192
|
-
Let's see your Tiger Crane...
|
193
|
-
match my Eagle's Claw.
|
194
|
-
|
195
|
-
46
|
196
|
-
00:50:01,497 --> 00:50:03,384
|
197
|
-
Like all Yankee women...
|
198
|
-
|
199
|
-
47
|
200
|
-
00:50:03,448 --> 00:50:06,794
|
201
|
-
...all you can do is order in restaurants
|
202
|
-
and spend a man's money.
|
203
|
-
|
204
|
-
48
|
205
|
-
00:50:07,893 --> 00:50:09,550
|
206
|
-
Excruciating... isn't it?
|
207
|
-
|
208
|
-
49
|
209
|
-
00:50:09,620 --> 00:50:10,731
|
210
|
-
Yes!
|
211
|
-
|
212
|
-
50
|
213
|
-
00:50:12,242 --> 00:50:13,517
|
214
|
-
If it was my wish...
|
215
|
-
|
216
|
-
51
|
217
|
-
00:50:14,000 --> 00:50:15,276
|
218
|
-
...I could chop your arm off.
|
219
|
-
|
220
|
-
52
|
221
|
-
00:50:17,966 --> 00:50:20,168
|
222
|
-
It's my arm now. I can do what I please.
|
223
|
-
|
224
|
-
53
|
225
|
-
00:50:20,780 --> 00:50:22,917
|
226
|
-
If you can stop me... I suggest you try.
|
227
|
-
|
228
|
-
54
|
229
|
-
00:50:25,065 --> 00:50:26,013
|
230
|
-
I can't.
|
231
|
-
|
232
|
-
55
|
233
|
-
00:50:27,143 --> 00:50:28,320
|
234
|
-
Because you're helpless?
|
235
|
-
|
236
|
-
56
|
237
|
-
00:50:29,158 --> 00:50:30,019
|
238
|
-
Yes.
|
239
|
-
|
240
|
-
57
|
241
|
-
00:50:32,548 --> 00:50:34,554
|
242
|
-
Have you ever felt this before?
|
243
|
-
|
244
|
-
58
|
245
|
-
00:50:34,946 --> 00:50:35,708
|
246
|
-
No.
|
247
|
-
|
248
|
-
59
|
249
|
-
00:50:36,065 --> 00:50:39,227
|
250
|
-
Compared to me... you're as helpless
|
251
|
-
as a worm fighting an eagle?
|
252
|
-
|
253
|
-
60
|
254
|
-
00:50:40,191 --> 00:50:41,335
|
255
|
-
YES!!!
|
256
|
-
|
257
|
-
61
|
258
|
-
00:50:43,452 --> 00:50:44,150
|
259
|
-
THAT'S THE BEGINNING!
|
260
|
-
|
261
|
-
62
|
262
|
-
00:50:49,687 --> 00:50:52,206
|
263
|
-
Is it your wish to possess this
|
264
|
-
kind of power?
|
265
|
-
|
266
|
-
63
|
267
|
-
00:50:57,842 --> 00:51:00,491
|
268
|
-
Your training will begin... tomorrow.
|
269
|
-
|
270
|
-
64
|
271
|
-
00:51:08,906 --> 00:51:10,215
|
272
|
-
Since your arm now belongs to me...
|
273
|
-
|
274
|
-
65
|
275
|
-
00:51:11,081 --> 00:51:12,324
|
276
|
-
...I want it strong.
|
277
|
-
|
278
|
-
66
|
279
|
-
00:51:13,831 --> 00:51:15,171
|
280
|
-
Can you do that?
|
281
|
-
|
282
|
-
67
|
283
|
-
00:51:16,804 --> 00:51:18,396
|
284
|
-
I can, but not that close.
|
285
|
-
|
286
|
-
68
|
287
|
-
00:51:18,564 --> 00:51:19,807
|
288
|
-
Then you can't do it.
|
289
|
-
|
290
|
-
69
|
291
|
-
00:51:20,993 --> 00:51:24,603
|
292
|
-
What if your enemy... is three inches
|
293
|
-
in front of you...
|
294
|
-
|
295
|
-
70
|
296
|
-
00:51:25,631 --> 00:51:26,840
|
297
|
-
...What do you do then...
|
298
|
-
|
299
|
-
71
|
300
|
-
00:51:27,933 --> 00:51:28,980
|
301
|
-
...Curl into a ball...
|
302
|
-
|
303
|
-
72
|
304
|
-
00:51:30,587 --> 00:51:31,796
|
305
|
-
...or do you put your FIST through him?
|
306
|
-
|
307
|
-
73
|
308
|
-
00:51:33,306 --> 00:51:34,036
|
309
|
-
Now begin.
|
310
|
-
|
311
|
-
74
|
312
|
-
00:52:04,931 --> 00:52:08,823
|
313
|
-
It's the wood that should fear your hand...
|
314
|
-
- not the other way around.
|
315
|
-
|
316
|
-
75
|
317
|
-
00:52:09,600 --> 00:52:15,128
|
318
|
-
No wonder you can't do it... you acquiesce
|
319
|
-
to defeat... before you even begin.
|
320
|
-
|
321
|
-
76
|
322
|
-
00:53:59,091 --> 00:54:01,228
|
323
|
-
If you want to eat like a dog...
|
324
|
-
|
325
|
-
77
|
326
|
-
00:54:02,449 --> 00:54:04,358
|
327
|
-
You can live and sleep outside like a dog.
|
328
|
-
|
329
|
-
78
|
330
|
-
00:54:06,766 --> 00:54:08,587
|
331
|
-
If you want to live and sleep
|
332
|
-
like a human...
|
333
|
-
|
334
|
-
79
|
335
|
-
00:54:10,124 --> 00:54:11,552
|
336
|
-
...pick up those sticks.
|
337
|
-
|
338
|
-
80
|
339
|
-
01:15:10,000 --> 01:15:13,440
|
340
|
-
Elle, you treacherous dog.
|
341
|
-
|
342
|
-
81
|
343
|
-
01:15:18,000 --> 01:15:20,300
|
344
|
-
I - give - you - my - word...
|
345
|
-
|