sensible-cinema 0.20.0 → 0.20.1
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +24 -6
- data/VERSION +1 -1
- data/bin/sensible-cinema +36 -25
- data/lib/edl_parser.rb +65 -45
- data/lib/mencoder_wrapper.rb +2 -2
- data/lib/mplayer_edl.rb +3 -3
- data/lib/overlayer.rb +4 -20
- data/sensible-cinema.gemspec +2 -2
- data/spec/edl_parser.spec.rb +49 -4
- data/spec/mplayer_edl.spec.rb +17 -14
- data/spec/notes +9 -0
- data/spec/sensible_cinema_gui.spec.rb +435 -409
- data/zamples/edit_decision_lists/dvds/Harry Potter 2.txt +2 -1
- data/zamples/edit_decision_lists/dvds/happiest baby on the block.txt +2 -1
- metadata +3 -3
data/spec/mplayer_edl.spec.rb
CHANGED
@@ -31,37 +31,40 @@ describe MplayerEdl do
|
|
31
31
|
EOL
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
it "should ignore overlaps" do
|
36
|
-
a = MplayerEdl.convert_to_edl({ "mutes"=>{105=>145}, "blank_outs" => {105 => 145} } )
|
37
|
-
a.should == <<EOL
|
38
|
-
105.0 145.0 0
|
39
|
-
EOL
|
40
|
-
end
|
41
|
-
|
42
34
|
it "should add to mutes" do
|
43
35
|
a = MplayerEdl.convert_to_edl({ "mutes"=>{105=>106}, "blank_outs" => {110 => 111} }, 1 )
|
44
36
|
a.should == <<EOL
|
45
37
|
105.0 107.0 1
|
46
|
-
110.0
|
38
|
+
110.0 112.0 0
|
47
39
|
EOL
|
48
40
|
end
|
49
41
|
|
50
42
|
it "should catch overlaps from additions to mutes" do
|
51
|
-
|
52
|
-
|
43
|
+
pending do
|
44
|
+
a = MplayerEdl.convert_to_edl({ "mutes"=>{105=>106}, "blank_outs" => {106 => 107} }, 1 )
|
45
|
+
a.should == <<-EOL
|
53
46
|
105.0 106.0 1
|
54
47
|
106.0 107.0 0
|
55
|
-
EOL
|
56
|
-
end
|
48
|
+
EOL
|
49
|
+
end
|
50
|
+
end
|
57
51
|
|
58
52
|
it "should add to beginning and ending of mutes" do
|
59
53
|
a = MplayerEdl.convert_to_edl({ "mutes"=>{105=>106}, "blank_outs" => {110 => 111} }, 1, 1 )
|
60
54
|
a.should == <<EOL
|
61
55
|
104.0 107.0 1
|
62
|
-
|
56
|
+
109.0 112.0 0
|
63
57
|
EOL
|
64
58
|
|
65
59
|
end
|
60
|
+
|
61
|
+
it "should accomodate for split sections in some dvd's and order the output" do
|
62
|
+
a = MplayerEdl.convert_to_edl({ "mutes"=>{5=>6,105=>106}, "blank_outs" => {110 => 111}}, 0, 0, [103] )
|
63
|
+
a.should == <<-EOL
|
64
|
+
2.0 3.0 1
|
65
|
+
5.0 6.0 1
|
66
|
+
7.0 8.0 0
|
67
|
+
EOL
|
68
|
+
end
|
66
69
|
|
67
70
|
end
|
data/spec/notes
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
watching a DVD "from the DVD" in smplayer seemed to have the right audio always. yep.
|
2
|
+
|
3
|
+
previewing section on HP 2 hours or so and the first thing overlapped the muted section in error...went too long...huh?
|
4
|
+
call ffmpeg -i C:\HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.fulli_unedited.tmp.mpg -vcodec copy -acodec copy -ss 7260.0 -t 10.499 C:\HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.1.avi
|
5
|
+
call ffmpeg -i C:\HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.fulli_unedited.tmp.mpg -vcodec copy -acodec ac3 -vol 0 -ss 7270.5 -t 1.499 C:\HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.2.avi
|
6
|
+
call ffmpeg -i C:\HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.fulli_unedited.tmp.mpg -vcodec copy -acodec copy -ss 7272.0 -t 3.999 C:\HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.3.avi
|
7
|
+
|
8
|
+
resulted in sectors of 13.17 1.93, 5.03 instead of 10.5, 1.5, and 4. huh?
|
9
|
+
|
1
10
|
$ to fix mplayer out of sync audio:
|
2
11
|
$ ffmpeg -i HP_AND_THE_CHAMBER_OF_SECRETS_edited_version.fulli_unedited.tmp.mpg -target ntsc-dvd -t 1600 yo.mpg
|
3
12
|
seemed to be as good as adding a harddup via mplayer. except...umm...VLC can play it right so why can't mplayer? Hopefully all doesn't matter [?]
|
@@ -1,409 +1,435 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright 2010, Roger Pack
|
3
|
-
This file is part of Sensible Cinema.
|
4
|
-
|
5
|
-
Sensible Cinema is free software: you can redistribute it and/or modify
|
6
|
-
it under the terms of the GNU General Public License as published by
|
7
|
-
the Free Software Foundation, either version 3 of the License, or
|
8
|
-
(at your option) any later version.
|
9
|
-
|
10
|
-
Sensible Cinema is distributed in the hope that it will be useful,
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
GNU General Public License for more details.
|
14
|
-
|
15
|
-
You should have received a copy of the GNU General Public License
|
16
|
-
along with Sensible Cinema. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
=end
|
18
|
-
|
19
|
-
require 'ostruct'
|
20
|
-
require File.expand_path(File.dirname(__FILE__) + '/common')
|
21
|
-
load '../bin/sensible-cinema'
|
22
|
-
|
23
|
-
module SensibleSwing
|
24
|
-
describe MainWindow do
|
25
|
-
|
26
|
-
it "should be able to start up" do
|
27
|
-
MainWindow.new.dispose# doesn't crash :)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should auto-select a EDL if it matches a DVD's title" do
|
31
|
-
MainWindow.new.single_edit_list_matches_dvd("19d121ae8dc40cdd70b57ab7e8c74f76").should_not be nil
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should not auto-select if you pass it nil" do
|
35
|
-
MainWindow.new.single_edit_list_matches_dvd(nil).should be nil
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should not die if you choose a poorly formed edl (should warn)" do
|
39
|
-
time_through = 0
|
40
|
-
@subject.stub!(:single_edit_list_matches_dvd) {
|
41
|
-
'fake filename doesnt matter because we fake its being parsed'
|
42
|
-
}
|
43
|
-
|
44
|
-
@subject.stub!(:parse_edl) {
|
45
|
-
if time_through == 0
|
46
|
-
time_through += 1
|
47
|
-
eval("a-----") # force it to throw a Syntax Error first time
|
48
|
-
else
|
49
|
-
"stuff"
|
50
|
-
end
|
51
|
-
}
|
52
|
-
@subject.choose_dvd_and_edl_for_it
|
53
|
-
@
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should warn if you don't have enough disk space" do
|
57
|
-
@subject.get_freespace('.').should be > 0
|
58
|
-
@subject.get_freespace("c:\\nonexistent").should be > 0
|
59
|
-
@subject.stub!(:get_freespace) {
|
60
|
-
0
|
61
|
-
}
|
62
|
-
@subject.get_save_to_filename 'dvd_title'
|
63
|
-
@
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should not warn if you have enough free disk space" do
|
67
|
-
@subject.stub!(:get_freespace) {
|
68
|
-
16_000_000_000
|
69
|
-
}
|
70
|
-
@subject.get_save_to_filename 'dvd_title'
|
71
|
-
@
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should not select a file if poorly formed" do
|
75
|
-
@subject.stub!(:parse_edl) {
|
76
|
-
eval("a----")
|
77
|
-
}
|
78
|
-
@subject.single_edit_list_matches_dvd
|
79
|
-
end
|
80
|
-
|
81
|
-
def with_clean_edl_dir_as this
|
82
|
-
FileUtils.rm_rf 'temp'
|
83
|
-
Dir.mkdir 'temp'
|
84
|
-
old_edl = MainWindow::EDL_DIR
|
85
|
-
MainWindow.const_set(:EDL_DIR, 'temp')
|
86
|
-
begin
|
87
|
-
yield
|
88
|
-
ensure
|
89
|
-
MainWindow.const_set(:EDL_DIR, old_edl)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should prompt if two EDL's match a DVD title" do
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
File.binwrite('
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
@subject.
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
@subject.
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
end
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
@subject.
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
@
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
@
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
@
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
@subject.
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
@
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
@
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
@
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
@
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
@
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
@
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
@
|
323
|
-
end
|
324
|
-
|
325
|
-
it "should
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
@
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
1
|
+
=begin
|
2
|
+
Copyright 2010, Roger Pack
|
3
|
+
This file is part of Sensible Cinema.
|
4
|
+
|
5
|
+
Sensible Cinema is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
Sensible Cinema is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with Sensible Cinema. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
=end
|
18
|
+
|
19
|
+
require 'ostruct'
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + '/common')
|
21
|
+
load '../bin/sensible-cinema'
|
22
|
+
|
23
|
+
module SensibleSwing
|
24
|
+
describe MainWindow do
|
25
|
+
|
26
|
+
it "should be able to start up" do
|
27
|
+
MainWindow.new.dispose# doesn't crash :)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should auto-select a EDL if it matches a DVD's title" do
|
31
|
+
MainWindow.new.single_edit_list_matches_dvd("19d121ae8dc40cdd70b57ab7e8c74f76").should_not be nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should not auto-select if you pass it nil" do
|
35
|
+
MainWindow.new.single_edit_list_matches_dvd(nil).should be nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should not die if you choose a poorly formed edl (should warn)" do
|
39
|
+
time_through = 0
|
40
|
+
@subject.stub!(:single_edit_list_matches_dvd) {
|
41
|
+
'fake filename doesnt matter because we fake its being parsed'
|
42
|
+
}
|
43
|
+
|
44
|
+
@subject.stub!(:parse_edl) {
|
45
|
+
if time_through == 0
|
46
|
+
time_through += 1
|
47
|
+
eval("a-----") # force it to throw a Syntax Error first time
|
48
|
+
else
|
49
|
+
"stuff"
|
50
|
+
end
|
51
|
+
}
|
52
|
+
@subject.choose_dvd_and_edl_for_it
|
53
|
+
@show_blocking_message_dialog_last_arg.should_not be nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should warn if you don't have enough disk space" do
|
57
|
+
@subject.get_freespace('.').should be > 0
|
58
|
+
@subject.get_freespace("c:\\nonexistent").should be > 0
|
59
|
+
@subject.stub!(:get_freespace) {
|
60
|
+
0
|
61
|
+
}
|
62
|
+
@subject.get_save_to_filename 'dvd_title'
|
63
|
+
@show_blocking_message_dialog_last_arg.should =~ /may not be enough/
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should not warn if you have enough free disk space" do
|
67
|
+
@subject.stub!(:get_freespace) {
|
68
|
+
16_000_000_000
|
69
|
+
}
|
70
|
+
@subject.get_save_to_filename 'dvd_title'
|
71
|
+
@show_blocking_message_dialog_last_arg.should be nil
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should not select a file if poorly formed" do
|
75
|
+
@subject.stub!(:parse_edl) {
|
76
|
+
eval("a----")
|
77
|
+
}
|
78
|
+
@subject.single_edit_list_matches_dvd('fake md5') # doesn't die
|
79
|
+
end
|
80
|
+
|
81
|
+
def with_clean_edl_dir_as this
|
82
|
+
FileUtils.rm_rf 'temp'
|
83
|
+
Dir.mkdir 'temp'
|
84
|
+
old_edl = MainWindow::EDL_DIR
|
85
|
+
MainWindow.const_set(:EDL_DIR, 'temp')
|
86
|
+
begin
|
87
|
+
yield
|
88
|
+
ensure
|
89
|
+
MainWindow.const_set(:EDL_DIR, old_edl)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should prompt if two EDL's match a DVD title" do
|
94
|
+
MainWindow.new.single_edit_list_matches_dvd("BOBS_BIG_PLAN").should be nil
|
95
|
+
with_clean_edl_dir_as 'temp' do
|
96
|
+
MainWindow.new.single_edit_list_matches_dvd("BOBS_BIG_PLAN").should be nil
|
97
|
+
Dir.chdir 'temp' do
|
98
|
+
File.binwrite('a.txt', "\"disk_unique_id\" => \"abcdef1234\"")
|
99
|
+
File.binwrite('b.txt', "\"disk_unique_id\" => \"abcdef1234\"")
|
100
|
+
end
|
101
|
+
MainWindow.new.single_edit_list_matches_dvd("abcdef1234").should be nil
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should modify path to have mencoder available" do
|
106
|
+
ENV['PATH'].should include("mencoder")
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should not modify path to have mplayer available" do
|
110
|
+
ENV['PATH'].should_not include("mplayer")
|
111
|
+
end
|
112
|
+
|
113
|
+
before do
|
114
|
+
@subject = MainWindow.new
|
115
|
+
@subject.stub!(:choose_dvd_drive) {
|
116
|
+
["mock_dvd_drive", "Volume", "19d121ae8dc40cdd70b57ab7e8c74f76"] # happiest baby on the block
|
117
|
+
}
|
118
|
+
@subject.stub!(:get_mencoder_commands) { |*args|
|
119
|
+
args[-5].should match(/abc/)
|
120
|
+
@args = args
|
121
|
+
'fake get_mencoder_commands'
|
122
|
+
}
|
123
|
+
@subject.stub!(:new_filechooser) {
|
124
|
+
FakeFileChooser.new
|
125
|
+
}
|
126
|
+
@subject.stub!(:get_drive_with_most_space_with_slash) {
|
127
|
+
"e:\\"
|
128
|
+
}
|
129
|
+
@subject.stub!(:show_blocking_message_dialog) { |*args|
|
130
|
+
@show_blocking_message_dialog_last_arg = args[0]
|
131
|
+
}
|
132
|
+
|
133
|
+
@subject.stub!(:get_user_input) {'01:00'}
|
134
|
+
@subject.stub!(:system_blocking) { |command|
|
135
|
+
@system_blocking_command = command
|
136
|
+
}
|
137
|
+
|
138
|
+
@subject.stub!(:system_non_blocking) { |command|
|
139
|
+
@system_non_blocking_command = command
|
140
|
+
Thread.new {} # fake out the return...
|
141
|
+
}
|
142
|
+
@subject.stub!(:open_file_to_edit_it) {}
|
143
|
+
|
144
|
+
PlayAudio.stub!(:play) {
|
145
|
+
# don't play anything, by default :)
|
146
|
+
}
|
147
|
+
|
148
|
+
@subject.stub!(:get_freespace) {
|
149
|
+
# during testing, we *always* have enough free space :)
|
150
|
+
16_000_000_000
|
151
|
+
}
|
152
|
+
# less chatty...
|
153
|
+
@subject.stub!(:p) {}
|
154
|
+
@subject.stub!(:puts) {}
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
after do
|
159
|
+
@subject.background_thread.join if @subject.background_thread
|
160
|
+
end
|
161
|
+
|
162
|
+
class FakeFileChooser
|
163
|
+
def set_title x; end
|
164
|
+
def set_file y; end
|
165
|
+
def go
|
166
|
+
'abc'
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# name like :@rerun_previous
|
171
|
+
def click_button(name)
|
172
|
+
@subject.instance_variable_get(name).simulate_click
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should be able to do a normal copy to hard drive, edited" do
|
176
|
+
@subject.system_non_blocking "ls"
|
177
|
+
@subject.do_copy_dvd_to_hard_drive(false).should == [false, "abc.fulli_unedited.tmp.mpg"]
|
178
|
+
File.exist?('test_file_to_see_if_we_have_permission_to_write_to_this_folder').should be false
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should have a good default title of 1" do
|
182
|
+
@subject.get_title_track({}).should == "1"
|
183
|
+
descriptors = {"dvd_title_track" => "3"}
|
184
|
+
@subject.get_title_track(descriptors).should == "3"
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should call through to explorer for the full thing" do
|
188
|
+
PlayAudio.stub!(:play) {
|
189
|
+
@played = true
|
190
|
+
}
|
191
|
+
@subject.do_copy_dvd_to_hard_drive(false)
|
192
|
+
@subject.background_thread.join
|
193
|
+
@args[-4].should == nil
|
194
|
+
@system_blocking_command.should match /explorer/
|
195
|
+
@system_blocking_command.should_not match /fulli/
|
196
|
+
@played.should == true
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should be able to return the fulli name if it already exists" do
|
200
|
+
FileUtils.touch "abc.fulli_unedited.tmp.mpg.done"
|
201
|
+
@subject.do_copy_dvd_to_hard_drive(false,true).should == [true, "abc.fulli_unedited.tmp.mpg"]
|
202
|
+
FileUtils.rm "abc.fulli_unedited.tmp.mpg.done"
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should call explorer eventually, if it has to create the fulli file" do
|
206
|
+
@subject.do_copy_dvd_to_hard_drive(true).should == [false, "abc.fulli_unedited.tmp.mpg"]
|
207
|
+
join_background_thread
|
208
|
+
@args[-2].should == 1
|
209
|
+
@args[-3].should == "01:00"
|
210
|
+
@system_non_blocking_command.should match /smplayer/
|
211
|
+
@system_non_blocking_command.should_not match /fulli/
|
212
|
+
end
|
213
|
+
|
214
|
+
def prompt_for_start_and_end_times
|
215
|
+
click_button(:@preview_section)
|
216
|
+
join_background_thread
|
217
|
+
@args[-2].should == 1
|
218
|
+
@args[-3].should == "01:00"
|
219
|
+
@system_non_blocking_command.should match /smplayer/
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should prompt for start and end times" do
|
223
|
+
prompt_for_start_and_end_times
|
224
|
+
end
|
225
|
+
|
226
|
+
temp_dir = Dir.tmpdir
|
227
|
+
|
228
|
+
def join_background_thread
|
229
|
+
@subject.background_thread.join # must be running...
|
230
|
+
end
|
231
|
+
|
232
|
+
it "should be able to preview unedited" do
|
233
|
+
@subject.stub!(:get_user_input).and_return('06:00', '07:00')
|
234
|
+
@subject.unstub!(:get_mencoder_commands)
|
235
|
+
click_button(:@preview_section_unedited)
|
236
|
+
join_background_thread # scary timing spec
|
237
|
+
temp_file = temp_dir + '/vlc.temp.bat'
|
238
|
+
File.read(temp_file).should include("59.99")
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should call something for fast preview" do
|
242
|
+
click_button(:@fast_preview).join
|
243
|
+
join_background_thread
|
244
|
+
#XXXX @system_blocking_command.should =~ /ffmpeg.*ntsc-dvd/ # I think this is a timing thing...
|
245
|
+
@system_blocking_command.should =~ /mplayer.*fast/ # pending, smplayer
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should be able to rerun the latest start and end times with the rerun button" do
|
249
|
+
prompt_for_start_and_end_times
|
250
|
+
old_args = @args
|
251
|
+
old_args.should_not == nil
|
252
|
+
@args = nil
|
253
|
+
click_button(:@rerun_preview).join
|
254
|
+
@args.should == old_args
|
255
|
+
@system_non_blocking_command.should match(/smplayer/)
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should not die if you pass it the same start and end time frames--graceful acceptance" do
|
259
|
+
@subject.stub!(:get_mencoder_commands) {
|
260
|
+
raise MencoderWrapper::TimingError
|
261
|
+
}
|
262
|
+
click_button(:@rerun_preview)
|
263
|
+
@show_blocking_message_dialog_last_arg.should =~ /you chose a time frame/
|
264
|
+
end
|
265
|
+
|
266
|
+
it "should not die if you pass it the same start and end time frames--graceful acceptance" do
|
267
|
+
@subject.stub!(:get_mencoder_commands) {
|
268
|
+
raise Errno::EACCES
|
269
|
+
}
|
270
|
+
click_button(:@rerun_preview) # lodo rspec error: wrong backtrace if no => e!
|
271
|
+
@show_blocking_message_dialog_last_arg.should =~ /a file/
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should warn if you watch an edited time frame with no edits in it" do
|
275
|
+
@subject.unstub!(:get_mencoder_commands)
|
276
|
+
click_button(:@preview_section)
|
277
|
+
@show_blocking_message_dialog_last_arg.should =~ /unable to/
|
278
|
+
@subject.stub!(:get_user_input).and_return('06:00', '07:00')
|
279
|
+
# rspec bug: wrong'ish backtrace: proc { prompt_for_start_and_end_times #}.should_not raise_error LODO
|
280
|
+
click_button(:@preview_section)
|
281
|
+
join_background_thread
|
282
|
+
@system_blocking_command.should == "echo wrote (probably successfully) to abc.avi"
|
283
|
+
end
|
284
|
+
|
285
|
+
it "if the .done files exists, watch unedited should call smplayer ja" do
|
286
|
+
FileUtils.touch "abc.fulli_unedited.tmp.mpg.done"
|
287
|
+
@subject.instance_variable_get(:@watch_unedited).simulate_click
|
288
|
+
@system_non_blocking_command.should == "smplayer abc.fulli_unedited.tmp.mpg"
|
289
|
+
FileUtils.rm "abc.fulli_unedited.tmp.mpg.done"
|
290
|
+
end
|
291
|
+
|
292
|
+
it "if the .done file does not exist, watch unedited should call smplayer after x seconds" do
|
293
|
+
@subject.stub!(:sleep) {
|
294
|
+
@slept = true
|
295
|
+
} # speed this test up...
|
296
|
+
@subject.unstub!(:get_mencoder_commands)
|
297
|
+
click_button(:@watch_unedited).join
|
298
|
+
join_background_thread
|
299
|
+
@system_blocking_command.should_not == nil
|
300
|
+
@slept.should == true
|
301
|
+
@show_blocking_message_dialog_last_arg.should == nil
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should create a new file for ya" do
|
305
|
+
out = MainWindow::EDL_DIR + "/sweetest_disc_ever.txt"
|
306
|
+
File.exist?( out ).should be_false
|
307
|
+
@subject.stub!(:get_user_input) {'sweetest disc ever'}
|
308
|
+
@subject.instance_variable_get(:@create_new_edl_for_current_dvd).simulate_click
|
309
|
+
begin
|
310
|
+
File.exist?( out ).should be_true
|
311
|
+
content = File.read(out)
|
312
|
+
content.should_not include("\"title\"")
|
313
|
+
content.should include("disk_unique_id")
|
314
|
+
content.should include("dvd_title_track")
|
315
|
+
content.should include("mplayer_dvd_splits")
|
316
|
+
ensure
|
317
|
+
FileUtils.rm_rf out
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
it "should display unique disc in an input box" do
|
322
|
+
@subject.instance_variable_get(:@display_unique).simulate_click.should == "01:00"
|
323
|
+
end
|
324
|
+
|
325
|
+
it "should create an edl and pass it through to mplayer" do
|
326
|
+
click_button(:@mplayer_edl).join
|
327
|
+
@system_blocking_command.should match(/mplayer.*-edl/)
|
328
|
+
@system_blocking_command.should match(/-dvd-device /)
|
329
|
+
end
|
330
|
+
|
331
|
+
it "should play edl with elongated mutes" do
|
332
|
+
click_button(:@mplayer_edl).join
|
333
|
+
wrote = File.read(MainWindow::EdlTempFile)
|
334
|
+
# normally "378.0 379.1 1"
|
335
|
+
p wrote
|
336
|
+
wrote.should include("377.5 379.1 1")
|
337
|
+
end
|
338
|
+
|
339
|
+
def should_allow_for_changing_file corrupt_the_file = false
|
340
|
+
with_clean_edl_dir_as 'temp' do
|
341
|
+
File.binwrite('temp/a.txt', "\"disk_unique_id\" => \"abcdef1234\"")
|
342
|
+
@subject.stub!(:choose_dvd_drive) {
|
343
|
+
["mock_dvd_drive", "Volume", "abcdef1234"]
|
344
|
+
}
|
345
|
+
@subject.choose_dvd_and_edl_for_it[4]['mutes'].should == []
|
346
|
+
new_file_contents = '"disk_unique_id" => "abcdef1234","mutes"=>["0:33", "0:34"]'
|
347
|
+
new_file_contents = '"a syntax error' if corrupt_the_file
|
348
|
+
File.binwrite('temp/a.txt', new_file_contents)
|
349
|
+
# file has been modified!
|
350
|
+
@subject.choose_dvd_and_edl_for_it[4]['mutes'].should_not == []
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
it "should allow for file to change contents while editing it" do
|
355
|
+
should_allow_for_changing_file
|
356
|
+
end
|
357
|
+
|
358
|
+
it "should prompt you if you re-choose, and your file now has a failure in it" do
|
359
|
+
@subject.stub(:show_blocking_message_dialog) {
|
360
|
+
@got_here = true
|
361
|
+
@subject.stub(:parse_edl) { 'pass the second time through' }
|
362
|
+
}
|
363
|
+
should_allow_for_changing_file true
|
364
|
+
@got_here.should == true
|
365
|
+
end
|
366
|
+
|
367
|
+
it "should only prompt for save to filename once" do
|
368
|
+
count = 0
|
369
|
+
@subject.stub!(:new_filechooser) {
|
370
|
+
count += 1
|
371
|
+
FakeFileChooser.new
|
372
|
+
}
|
373
|
+
@subject.get_save_to_filename 'yo'
|
374
|
+
@subject.get_save_to_filename 'yo'
|
375
|
+
count.should == 1
|
376
|
+
end
|
377
|
+
|
378
|
+
describe 'with unstubbed choose_dvd_drive' do
|
379
|
+
before do
|
380
|
+
DriveInfo.stub!(:get_dvd_drives_as_openstruct) {
|
381
|
+
a = OpenStruct.new
|
382
|
+
# NB no VolumeName set
|
383
|
+
a.Name = 'a name'
|
384
|
+
[a]
|
385
|
+
}
|
386
|
+
@subject.unstub!(:choose_dvd_drive)
|
387
|
+
end
|
388
|
+
|
389
|
+
it "should only prompt for drive once" do
|
390
|
+
count = 0
|
391
|
+
DriveInfo.stub!(:md5sum_disk) {
|
392
|
+
count += 1
|
393
|
+
'19d121ae8dc40cdd70b57ab7e8c74f76'
|
394
|
+
}
|
395
|
+
@subject.choose_dvd_and_edl_for_it
|
396
|
+
@subject.choose_dvd_and_edl_for_it
|
397
|
+
count.should == 1
|
398
|
+
end
|
399
|
+
|
400
|
+
it "should prompt you if you need to insert a dvd" do
|
401
|
+
proc {@subject.choose_dvd_drive}.should raise_error(/might not yet have.*in it/)
|
402
|
+
@show_blocking_message_dialog_last_arg.should_not be nil
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should not show the normal buttons in create mode" do
|
407
|
+
MainWindow.new.buttons.length.should == 3 # exit button, two normal buttons
|
408
|
+
ARGV << "--create-mode"
|
409
|
+
MainWindow.new.buttons.length.should == 10
|
410
|
+
ARGV.pop # test cleanup--why not :)
|
411
|
+
end
|
412
|
+
|
413
|
+
it "should read splits from the file" do
|
414
|
+
splits1 = nil
|
415
|
+
MplayerEdl.stub(:convert_to_edl) do |d,s,s,splits|
|
416
|
+
splits1 = splits
|
417
|
+
end
|
418
|
+
@subject.do_mplayer_edl nil, 0, 0
|
419
|
+
splits1.should == []
|
420
|
+
end
|
421
|
+
|
422
|
+
it "should warn if there are no DVD splits and you try to use EDL" do
|
423
|
+
with_clean_edl_dir_as 'temp' do
|
424
|
+
File.binwrite('temp/a.txt', "\"disk_unique_id\" => \"abcdef1234\"")
|
425
|
+
@subject.stub!(:choose_dvd_drive) {
|
426
|
+
["mock_dvd_drive", "mockVolume", "abcdef1234"]
|
427
|
+
}
|
428
|
+
@subject.do_mplayer_edl(nil, 0, 0)
|
429
|
+
@show_blocking_message_dialog_last_arg.should =~ /does not contain mplayer replay information \[mplayer_dvd_splits\]/
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
end # describe MainWindow
|
434
|
+
|
435
|
+
end
|