titlekit 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,10 +3,10 @@ require File.join(File.expand_path(__dir__), '../spec_helper')
3
3
  describe Titlekit::Job do
4
4
 
5
5
  describe 'Simultaneous Subtitles' do
6
-
6
+
7
7
  context 'with dual subtitles' do
8
8
  let(:ins) do
9
- %w{one two}.map do |file|
9
+ %w(one two).map do |file|
10
10
  File.join(__dir__, 'dual', "#{file}.srt")
11
11
  end
12
12
  end
@@ -23,7 +23,7 @@ describe Titlekit::Job do
23
23
  job = Titlekit::Job.new
24
24
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
25
25
  job.want.file(@out)
26
-
26
+
27
27
  expect(job.run).to be true
28
28
  end
29
29
 
@@ -65,19 +65,19 @@ describe Titlekit::Job do
65
65
  job = Titlekit::Job.new
66
66
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
67
67
  job.want.file(@out)
68
-
68
+
69
69
  expect(job.run).to be true
70
70
  end
71
71
 
72
72
  it 'delivers the expected output' do
73
73
  expect(FileUtils.compare_file(@out, @expected)).to be true
74
74
  end
75
- end
75
+ end
76
76
  end
77
77
 
78
78
  context 'with triple subtitles' do
79
79
  let(:ins) do
80
- %w{one two three}.map do |file|
80
+ %w(one two three).map do |file|
81
81
  File.join(__dir__, 'triple', "#{file}.srt")
82
82
  end
83
83
  end
@@ -94,7 +94,7 @@ describe Titlekit::Job do
94
94
  job = Titlekit::Job.new
95
95
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
96
96
  job.want.file(@out)
97
-
97
+
98
98
  expect(job.run).to be true
99
99
  end
100
100
 
@@ -115,7 +115,7 @@ describe Titlekit::Job do
115
115
  job = Titlekit::Job.new
116
116
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
117
117
  job.want.file(@out)
118
-
118
+
119
119
  expect(job.run).to be true
120
120
  end
121
121
 
@@ -136,19 +136,19 @@ describe Titlekit::Job do
136
136
  job = Titlekit::Job.new
137
137
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
138
138
  job.want.file(@out)
139
-
139
+
140
140
  expect(job.run).to be true
141
141
  end
142
142
 
143
143
  it 'delivers the expected output' do
144
144
  expect(FileUtils.compare_file(@out, @expected)).to be true
145
145
  end
146
- end
146
+ end
147
147
  end
148
148
 
149
149
  context 'with three+ simultaneous subtitles' do
150
150
  let(:ins) do
151
- %w{one two three four five six}.map do |file|
151
+ %w(one two three four five six).map do |file|
152
152
  File.join(__dir__, 'triple_plus', "#{file}.srt")
153
153
  end
154
154
  end
@@ -159,13 +159,13 @@ describe Titlekit::Job do
159
159
  @expected = File.join(__dir__, 'triple_plus', 'srt', 'expected.srt')
160
160
 
161
161
  File.delete(@out) if File.exist?(@out)
162
- end
162
+ end
163
163
 
164
164
  it 'runs the job' do
165
165
  job = Titlekit::Job.new
166
166
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
167
167
  job.want.file(@out)
168
-
168
+
169
169
  expect(job.run).to be true
170
170
  end
171
171
 
@@ -180,13 +180,13 @@ describe Titlekit::Job do
180
180
  @expected = File.join(__dir__, 'triple_plus', 'ssa', 'expected.ssa')
181
181
 
182
182
  File.delete(@out) if File.exist?(@out)
183
- end
183
+ end
184
184
 
185
185
  it 'runs the job' do
186
186
  job = Titlekit::Job.new
187
187
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
188
188
  job.want.file(@out)
189
-
189
+
190
190
  expect(job.run).to be true
191
191
  end
192
192
 
@@ -201,20 +201,20 @@ describe Titlekit::Job do
201
201
  @expected = File.join(__dir__, 'triple_plus', 'ass', 'expected.ass')
202
202
 
203
203
  File.delete(@out) if File.exist?(@out)
204
- end
204
+ end
205
205
 
206
206
  it 'runs the job' do
207
207
  job = Titlekit::Job.new
208
208
  ins.each { |file| job.have.file(file).encoding('UTF-8') }
209
209
  job.want.file(@out)
210
-
210
+
211
211
  expect(job.run).to be true
212
212
  end
213
213
 
214
214
  it 'delivers the expected output' do
215
215
  expect(FileUtils.compare_file(@out, @expected)).to be true
216
216
  end
217
- end
217
+ end
218
218
  end
219
219
  end
220
- end
220
+ end
data/spec/spec_helper.rb CHANGED
@@ -5,4 +5,4 @@ RSpec.configure do |config|
5
5
  config.expect_with :rspec do |c|
6
6
  c.syntax = :expect
7
7
  end
8
- end
8
+ end
@@ -63,7 +63,7 @@ shared_examples 'a specification' do
63
63
  it 'returns the set named reference for a timecode' do
64
64
  expect(specification.references[:some_point][:timecode]).to eq(210)
65
65
  end
66
- end
66
+ end
67
67
 
68
68
  context 'specifying an SRT timecode' do
69
69
  let(:specification) do
@@ -105,7 +105,7 @@ shared_examples 'a specification' do
105
105
  it 'returns the set named reference for a timecode' do
106
106
  expect(specification.references[:some_point][:timecode]).to eq(210)
107
107
  end
108
- end
108
+ end
109
109
  end
110
110
  end
111
111
 
@@ -135,4 +135,4 @@ end
135
135
 
136
136
  describe Titlekit::Want do
137
137
  it_behaves_like 'a specification'
138
- end
138
+ end
data/spec/srt_spec.rb CHANGED
@@ -48,7 +48,7 @@ describe Titlekit::SRT do
48
48
  it 'parses and builds correct lines' do
49
49
  expect(subtitles[0][:lines]).to eq("<i>(male narrator) Previously\r\non Battlestar Galactica.</i>")
50
50
  end
51
- end
51
+ end
52
52
 
53
53
  context 'with a file that contains coordinates' do
54
54
  let(:subtitles) do
@@ -75,7 +75,7 @@ describe Titlekit::SRT do
75
75
  it 'ignores the display coordinates' do
76
76
  # just fyi
77
77
  end
78
- end
78
+ end
79
79
  end
80
80
 
81
81
  describe '.export' do
@@ -122,13 +122,13 @@ Oh yeah ... 寧為太平犬,不做亂世人
122
122
 
123
123
  describe '.build_timecode' do
124
124
  it 'builds an SRT timecode from a float timecode value' do
125
- expect(Titlekit::SRT.build_timecode(35.9678)).to eq('00:00:35,968')
125
+ expect(Titlekit::SRT.build_timecode(35.9678)).to eq('00:00:35,968')
126
126
  end
127
127
  end
128
128
 
129
129
  describe '.parse_timecode' do
130
130
  it 'obtains a float timecode value from an SRT timecode' do
131
- expect(Titlekit::SRT.parse_timecode('00:00:35,968')).to eq(35.968)
131
+ expect(Titlekit::SRT.parse_timecode('00:00:35,968')).to eq(35.968)
132
132
  end
133
- end
134
- end
133
+ end
134
+ end
data/spec/ssa_spec.rb CHANGED
@@ -9,7 +9,7 @@ describe Titlekit::SSA do
9
9
  Titlekit::SSA.import(File.read('spec/files/ssa/simple.ssa'))
10
10
  end
11
11
 
12
- it 'parses and builds 3 subtitles' do
12
+ it 'parses and builds 2 subtitles' do
13
13
  expect(subtitles.length).to eq(2)
14
14
  end
15
15
 
@@ -23,7 +23,7 @@ describe Titlekit::SSA do
23
23
  end
24
24
 
25
25
  it 'parses and builds correct lines' do
26
- expect(subtitles[1][:lines]).to eq("{\\a2}Story Script & Direction - MIYAZAKI Hayao")
26
+ expect(subtitles[1][:lines]).to eq('{\\a2}Story Script & Direction - MIYAZAKI Hayao')
27
27
  end
28
28
  end
29
29
  end
@@ -78,13 +78,13 @@ Dialogue: 0,0:00:01.50,0:00:03.70,Default,,0000,0000,0000,,Oh yeah ... 寧為太
78
78
 
79
79
  describe '.build_timecode' do
80
80
  it 'builds an SSA timecode from a float timecode value' do
81
- expect(Titlekit::SSA.build_timecode(35.9678)).to eq('0:00:35.97')
81
+ expect(Titlekit::SSA.build_timecode(35.9678)).to eq('0:00:35.97')
82
82
  end
83
83
  end
84
84
 
85
85
  describe '.parse_timecode' do
86
86
  it 'obtains a float timecode value from an SSA timecode' do
87
- expect(Titlekit::SSA.parse_timecode('0:00:35.96')).to eq(35.96)
87
+ expect(Titlekit::SSA.parse_timecode('0:00:35.96')).to eq(35.96)
88
88
  end
89
- end
90
- end
89
+ end
90
+ end
@@ -29,7 +29,7 @@ describe Titlekit::Job do
29
29
 
30
30
  it 'delivers the expected output' do
31
31
  expect(FileUtils.compare_file(@out, @expected)).to be true
32
- end
32
+ end
33
33
  end
34
34
 
35
35
  context 'Based on a single reference' do
@@ -57,7 +57,7 @@ describe Titlekit::Job do
57
57
 
58
58
  it 'delivers the expected output' do
59
59
  expect(FileUtils.compare_file(@out, @expected)).to be true
60
- end
60
+ end
61
61
  end
62
62
 
63
63
  context 'Based on differing framerates plus a reference' do
@@ -87,7 +87,7 @@ describe Titlekit::Job do
87
87
 
88
88
  it 'delivers the expected output' do
89
89
  expect(FileUtils.compare_file(@out, @expected)).to be true
90
- end
90
+ end
91
91
  end
92
92
 
93
93
  context 'Based on two references' do
@@ -120,4 +120,4 @@ describe Titlekit::Job do
120
120
  end
121
121
  end
122
122
  end
123
- end
123
+ end
@@ -19,11 +19,11 @@ describe Titlekit::Job do
19
19
  have = job.have
20
20
  have.encoding('ISO-8859-1')
21
21
  have.file(@in)
22
-
22
+
23
23
  want = job.want
24
24
  want.encoding('UTF-8')
25
25
  want.file(@out)
26
-
26
+
27
27
  expect(job.run).to be true
28
28
  end
29
29
 
@@ -47,11 +47,11 @@ describe Titlekit::Job do
47
47
  have = job.have
48
48
  have.encoding('Windows-1252')
49
49
  have.file(@in)
50
-
50
+
51
51
  want = job.want
52
52
  want.encoding('UTF-8')
53
53
  want.file(@out)
54
-
54
+
55
55
  expect(job.run).to be true
56
56
  end
57
57
 
@@ -75,11 +75,11 @@ describe Titlekit::Job do
75
75
  have = job.have
76
76
  have.encoding('UTF-8')
77
77
  have.file(@in)
78
-
78
+
79
79
  want = job.want
80
80
  want.encoding('GBK')
81
81
  want.file(@out)
82
-
82
+
83
83
  expect(job.run).to be true
84
84
  end
85
85
 
@@ -103,14 +103,14 @@ describe Titlekit::Job do
103
103
  have = job.have
104
104
  have.encoding('GB2312')
105
105
  have.file(@in)
106
-
106
+
107
107
  want = job.want
108
108
  want.encoding('ASCII')
109
109
  want.file(@out)
110
-
110
+
111
111
  expect(job.run).to be false
112
112
  expect(job.report.join).to include('Failure while transcoding')
113
113
  end
114
- end
114
+ end
115
115
  end
116
- end
116
+ end
data/titlekit.gemspec CHANGED
@@ -4,9 +4,9 @@ Gem::Specification.new do |spec|
4
4
  spec.name = 'titlekit'
5
5
  spec.summary = 'Featureful Ruby library for SRT / ASS / SSA subtitles'
6
6
  spec.description = 'Featureful Ruby library for SRT / ASS / SSA subtitles'
7
-
7
+
8
8
  spec.homepage = 'https://github.com/simonrepp/titlekit'
9
-
9
+
10
10
  spec.author = 'Simon Repp'
11
11
  spec.email = 'simon@fdpl.foundation'
12
12
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.platform = Gem::Platform::RUBY
22
22
  spec.required_ruby_version = '>= 2.0.0'
23
23
  spec.files = `git ls-files`.split($\)
24
- spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
24
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
25
25
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
26
  spec.require_paths = ['lib']
27
27
  spec.version = Titlekit::VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titlekit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Repp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rchardet19
@@ -110,6 +110,7 @@ files:
110
110
  - spec/encoding_detection/c/out.srt
111
111
  - spec/encoding_detection/encoding_detection_spec.rb
112
112
  - spec/files/ass/authentic.ass
113
+ - spec/files/ass/bom.ass
113
114
  - spec/files/ass/hard.ass
114
115
  - spec/files/ass/simple.ass
115
116
  - spec/files/srt/authentic.srt
@@ -211,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
212
  version: '0'
212
213
  requirements: []
213
214
  rubyforge_project:
214
- rubygems_version: 2.4.6
215
+ rubygems_version: 2.4.8
215
216
  signing_key:
216
217
  specification_version: 4
217
218
  summary: Featureful Ruby library for SRT / ASS / SSA subtitles
@@ -233,6 +234,7 @@ test_files:
233
234
  - spec/encoding_detection/c/out.srt
234
235
  - spec/encoding_detection/encoding_detection_spec.rb
235
236
  - spec/files/ass/authentic.ass
237
+ - spec/files/ass/bom.ass
236
238
  - spec/files/ass/hard.ass
237
239
  - spec/files/ass/simple.ass
238
240
  - spec/files/srt/authentic.srt