sensible-cinema 0.22.1 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.TXT +7 -4
- data/README +84 -68
- data/Rakefile +21 -23
- data/TODO +93 -60
- data/VERSION +1 -1
- data/bin/sensible-cinema +201 -123
- data/change_log_with_feature_list.txt +10 -0
- data/development.txt +11 -2
- data/go.bat +1 -1
- data/go.sh +1 -0
- data/go_ocr_tracker.bat +1 -1
- data/goc.bat +1 -0
- data/lib/auto_convert.rb +4 -3
- data/lib/check_installed_mac.rb +40 -0
- data/lib/drive_info.rb +25 -13
- data/lib/edl_parser.rb +1 -3
- data/lib/mencoder_wrapper.rb +11 -6
- data/lib/mouse.rb +1 -1
- data/lib/mplayer_edl.rb +1 -2
- data/lib/ocr.rb +8 -3
- data/lib/subtitle_profanity_finder.rb +68 -21
- data/lib/swing_helpers.rb +1 -1
- data/sensible-cinema.gemspec +20 -5
- data/spec/arse.srt +36 -0
- data/spec/common.rb +1 -1
- data/spec/deity_end.srt +11 -0
- data/spec/dragon.srt +1 -2
- data/spec/drive_info.spec.rb +25 -6
- data/spec/notes +99 -15
- data/spec/sensible_cinema_gui.spec.rb +8 -5
- data/spec/subtitle_profanity_finder.spec.rb +56 -6
- data/template_bats/RUN SENSIBLE CINEMA CLICK HERE.bat +2 -2
- data/todo.inventionzy.txt +0 -12
- data/todo.open_edl_list_org.txt +2 -0
- data/{propaganda → todo.propaganda} +4 -1
- data/todo.subtitle +3 -22
- data/vendor/mac_dvdid/bin/dvdid +0 -0
- data/vendor/mac_dvdid/include/dvdid/dvdid.h +67 -0
- data/vendor/mac_dvdid/include/dvdid/dvdid2.h +131 -0
- data/vendor/mac_dvdid/include/dvdid/export.h +32 -0
- data/vendor/mac_dvdid/lib/libdvdid.0.dylib +0 -0
- data/vendor/mac_dvdid/lib/libdvdid.a +0 -0
- data/vendor/mac_dvdid/lib/libdvdid.dylib +0 -0
- data/vendor/mac_dvdid/lib/libdvdid.la +41 -0
- data/www/index.html +16 -5
- data/zamples/edit_decision_lists/dvds/COOL_RUNNINGS.txt +3 -3
- data/zamples/edit_decision_lists/dvds/Harry Potter 2.txt +3 -4
- data/zamples/edit_decision_lists/dvds/bambi.txt +20 -0
- data/zamples/edit_decision_lists/dvds/big_buck_bunny_dvd.txt +6 -7
- data/zamples/edit_decision_lists/dvds/bob the builder pets in a pickle.txt +1 -1
- data/zamples/edit_decision_lists/dvds/bobs_big_plan.txt +1 -1
- data/zamples/edit_decision_lists/dvds/happiest baby on the block.txt +1 -1
- data/zamples/edit_decision_lists/dvds/how_to_train_your_dragon.txt +2 -2
- data/zamples/edit_decision_lists/dvds/kung_fu_panda_1.txt +17 -0
- data/zamples/edit_decision_lists/dvds/legend_of_the_guardians_the_owls_of_gahoole.txt +1 -1
- data/zamples/edit_decision_lists/dvds/making_marriage_work.txt +3 -5
- data/zamples/edit_decision_lists/dvds/narnia_voyage_of_the_dawn_treader.txt +16 -0
- data/zamples/edit_decision_lists/dvds/old_and_inaccurate/star_trek_generations_hulu.txt +1 -1
- data/zamples/edit_decision_lists/dvds/pack_wedding_2007-03-03.txt +4 -4
- data/zamples/edit_decision_lists/dvds/sintel_open_source_blender.txt +2 -1
- data/zamples/edit_decision_lists/dvds/tron_legacy.txt +1 -1
- data/zamples/edit_decision_lists/dvds/turn_around_alma_younger.txt +1 -1
- data/zamples/edit_decision_lists/dvds/{example_delete_list_that_has_no_cuts_in_it.txt → zz_example_delete_list_that_has_no_cuts_in_it.txt} +2 -2
- data/zamples/edit_decision_lists/old_not_yet_updated/example_edit_decision_list.txt +2 -2
- data/zamples/edit_decision_lists/youtube/demo_mutes.txt +1 -1
- metadata +20 -5
- data/gocreatemode.bat +0 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.23.0
|
data/bin/sensible-cinema
CHANGED
@@ -20,15 +20,16 @@ This file is part of Sensible Cinema.
|
|
20
20
|
print 'Loading Sensible Cinema...'
|
21
21
|
require File.expand_path(File.dirname(__FILE__) + "/../lib/add_any_bundled_gems_to_load_path.rb")
|
22
22
|
begin
|
23
|
-
require 'sane'
|
23
|
+
require 'sane'
|
24
24
|
rescue LoadError
|
25
|
-
p '
|
25
|
+
p 'please run $ rake rebundle_copy_in_dependencies first, as we dislike needing locally installed rubygems'
|
26
26
|
raise
|
27
27
|
end
|
28
28
|
|
29
29
|
raise 'need jruby' unless OS.java?
|
30
|
-
raise 'need newer jruby!' unless RUBY_DESCRIPTION >= 'jruby 1.6.0
|
30
|
+
raise 'need newer jruby!' unless RUBY_DESCRIPTION >= 'jruby 1.6.0' # may not need this since we still have to accomodate for so many oddities :P
|
31
31
|
|
32
|
+
alias system_original system
|
32
33
|
require_relative '../lib/mencoder_wrapper'
|
33
34
|
require_relative '../lib/storage'
|
34
35
|
require_relative '../lib/edl_parser'
|
@@ -39,19 +40,25 @@ require 'tmpdir'
|
|
39
40
|
require_relative '../lib/swing_helpers'
|
40
41
|
require_relative '../lib/drive_info'
|
41
42
|
require 'whichr'
|
42
|
-
require '
|
43
|
+
require 'os'
|
44
|
+
require 'ruby-wmi' unless OS.mac?
|
43
45
|
|
44
46
|
vendor_cache = File.expand_path(File.dirname(__FILE__)) + '/../vendor/cache'
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
if OS.windows?
|
49
|
+
for name in ['.', 'mencoder', 'ffmpeg']
|
50
|
+
# put them all before the old path
|
51
|
+
ENV['PATH'] = (vendor_cache + '/' + name).to_filename + ';' + ENV['PATH']
|
52
|
+
end
|
53
|
+
|
54
|
+
installed_smplayer_folders = Dir['{c,d,e,f,g}:/program files*/MPlayer for Windows*'] # sometimes ends with UI? huh?
|
50
55
|
|
51
|
-
|
56
|
+
for folder in installed_smplayer_folders
|
57
|
+
ENV['PATH'] = ENV['PATH'] + ";#{folder.gsub('/', "\\")}"
|
58
|
+
end
|
52
59
|
|
53
|
-
|
54
|
-
ENV['PATH'] = ENV['PATH'] +
|
60
|
+
else
|
61
|
+
ENV['PATH'] = ENV['PATH'] + ':' + '/opt/local/bin' # add macports' bin in, just in case...
|
55
62
|
end
|
56
63
|
|
57
64
|
import 'javax.swing.ImageIcon'
|
@@ -91,10 +98,10 @@ module SensibleSwing
|
|
91
98
|
def initialize
|
92
99
|
super "Sensible-Cinema #{VERSION} (GPL)"
|
93
100
|
if !(Storage['main_license_accepted'] == VERSION)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
'is_it_legal_to_copy_dvds.txt file', 'I acknowledge that I have read, understand,
|
101
|
+
require_blocking_license_accept_dialog 'Sensible Cinema', 'gplv3', 'http://www.gnu.org/licenses/gpl.html', 'Sensible Cinema license agreement',
|
102
|
+
"Sensible Cinema is distributed under the gplv3.\nBY CLICKING \"accept\" YOU SIGNIFY THAT YOU HAVE READ, UNDERSTOOD AND AGREED TO ABIDE BY THE TERMS OF THIS AGREEMENT"
|
103
|
+
require_blocking_license_accept_dialog 'Sensible Cinema', 'is_it_legal_to_copy_dvds.txt file', File.expand_path(File.dirname(__FILE__) + "/../is_it_legal_to_copy_dvds.txt"),
|
104
|
+
'is_it_legal_to_copy_dvds.txt file', 'I acknowledge that I have read, understand, accept and agree to abide by the implications noted in the is_it_legal_to_copy_dvds.txt file'
|
98
105
|
Storage['main_license_accepted'] = VERSION
|
99
106
|
end
|
100
107
|
|
@@ -142,9 +149,13 @@ module SensibleSwing
|
|
142
149
|
@play_smplayer = new_jbutton( "Watch DVD unedited (realtime smplayer)", true).on_clicked {
|
143
150
|
play_dvd_smplayer_unedited
|
144
151
|
}
|
145
|
-
|
152
|
+
|
153
|
+
@play_mplayer_raw = new_jbutton( "Watch DVD unedited (realtime mplayer--useful for subtitle timing)", true).on_clicked {
|
154
|
+
play_dvd_smplayer_unedited true
|
155
|
+
}
|
156
|
+
|
146
157
|
# @watch_created_file = new_jbutton( "Watch edited file copy of DVD", false).on_clicked {
|
147
|
-
# raise 'todo'
|
158
|
+
# raise 'todo' # TODO
|
148
159
|
# }
|
149
160
|
|
150
161
|
@preview_section = new_jbutton( "Preview a certain time frame from file (edited)", true )
|
@@ -168,7 +179,7 @@ module SensibleSwing
|
|
168
179
|
background_thread.join if background_thread # let it write out the original fulli, if necessary [?]
|
169
180
|
nice_file = wrote_to_here_fulli #+ ".fast.mpg"
|
170
181
|
if false#!File.exist?(nice_file)
|
171
|
-
p =
|
182
|
+
p = show_non_blocking_message_dialog("Creating quick lookup file--NB that for each changed deletion,
|
172
183
|
you'll need to restart the fast preview SMplayer
|
173
184
|
Also note that the start and end times will be slightly off if reality [delayed]
|
174
185
|
Also note that while doing fast preview, it can be doing a normal preview as well
|
@@ -179,16 +190,13 @@ module SensibleSwing
|
|
179
190
|
end
|
180
191
|
p.dispose # it will be active for sure
|
181
192
|
end
|
182
|
-
|
183
|
-
|
184
|
-
new_prefs = old_prefs.gsub(/mplayer_additional_options=.*/, "mplayer_additional_options=-edl #{EdlTempFile}")
|
185
|
-
File.write(smplayer_prefs_file, new_prefs)
|
186
|
-
thread = do_mplayer_edl( "smplayer #{nice_file}") # note the smplayer, but it's for the fast file...
|
193
|
+
set_smplayer_opts "-edl #{EdlTempFile}"
|
194
|
+
thread = do_mplayer_edl( "smplayer_portable #{nice_file}") # note the smplayer, but it's for the fast file...
|
187
195
|
Thread.new { # XXX do we need this?
|
188
196
|
begin
|
189
197
|
thread.join
|
190
198
|
ensure
|
191
|
-
|
199
|
+
set_smplayer_opts ''
|
192
200
|
end
|
193
201
|
}
|
194
202
|
}
|
@@ -197,18 +205,18 @@ module SensibleSwing
|
|
197
205
|
@watch_unedited.on_clicked {
|
198
206
|
success_no_run, wrote_to_here_fulli = do_copy_dvd_to_hard_drive false, true, true
|
199
207
|
sleep 5 unless success_no_run
|
200
|
-
command = "
|
208
|
+
command = "smplayer_portable #{wrote_to_here_fulli}"
|
201
209
|
system_non_blocking command
|
202
210
|
}
|
203
211
|
|
204
212
|
|
205
213
|
# until I can let them know *why* they would ever need this button...
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
214
|
+
@display_unique = new_jbutton( "Display a DVD's unique ID", true ).on_clicked {
|
215
|
+
drive, volume, dvd_id = choose_dvd_drive
|
216
|
+
# display it, allow them to copy and paste it out
|
217
|
+
get_user_input("#{drive} #{volume} for your copying+pasting pleasure (highlight, then ctrl+c to copy)\n
|
218
|
+
This is USED to identify a disk to match it to its EDL, later.", "\"disk_unique_id\" => \"#{dvd_id}\",")
|
219
|
+
}
|
212
220
|
|
213
221
|
@upload = new_jbutton("Upload/E-mail suggestion/Submit anything", true).on_clicked {
|
214
222
|
system_non_blocking("start mailto:sensible-cinema@googlegroups.com")
|
@@ -224,7 +232,9 @@ module SensibleSwing
|
|
224
232
|
increment_button_location
|
225
233
|
|
226
234
|
@exit = new_jbutton("Exit", false, true).on_clicked {
|
227
|
-
self.close
|
235
|
+
#self.close # don't waste time :P
|
236
|
+
kill_processes
|
237
|
+
java.lang.System.exit 0
|
228
238
|
}
|
229
239
|
|
230
240
|
increment_button_location
|
@@ -235,11 +245,26 @@ module SensibleSwing
|
|
235
245
|
check_for_dependencies
|
236
246
|
end
|
237
247
|
|
248
|
+
require 'fileutils'
|
249
|
+
|
250
|
+
def set_smplayer_opts to_this
|
251
|
+
smplayer_prefs_file = File.expand_path("~/.smplayer/smplayer.ini")
|
252
|
+
old_prefs = File.read(smplayer_prefs_file) rescue ''
|
253
|
+
old_prefs = "[advanced]\nmplayer_additional_options=" unless old_prefs.contain? 'mplayer_additional_options='
|
254
|
+
new_prefs = old_prefs.gsub(/mplayer_additional_options=.*/, "mplayer_additional_options=#{to_this}")
|
255
|
+
FileUtils.mkdir_p File.dirname(smplayer_prefs_file) # case it doesn't exist'
|
256
|
+
File.write(smplayer_prefs_file, new_prefs)
|
257
|
+
p 'wrote', new_prefs.length, smplayer_prefs_file, to_this
|
258
|
+
# no worky doze File.write(File.expand_path('~/.mplayer/config'), to_this)
|
259
|
+
smplayer_prefs_file
|
260
|
+
end
|
261
|
+
|
238
262
|
def create_brand_new_edl
|
239
|
-
drive, volume,
|
263
|
+
drive, volume, dvd_id = choose_dvd_drive
|
240
264
|
english_name = get_user_input("Enter a human readable DVD description for #{volume}", volume.gsub('_', ' ').downcase)
|
241
265
|
input = <<-EOL
|
242
266
|
# comments can go after a # on any line, for example this one.
|
267
|
+
"name" => "#{english_name}",
|
243
268
|
|
244
269
|
"mutes" => [
|
245
270
|
# example line, uncomment the leading "#" to make it active
|
@@ -251,11 +276,9 @@ module SensibleSwing
|
|
251
276
|
# "00:03:00.0" , "00:04:00.0", "violence", "of some sort",
|
252
277
|
],
|
253
278
|
|
254
|
-
"name" => "#{english_name}",
|
255
279
|
"volume_name" => "#{volume}",
|
256
|
-
"disk_unique_id" => "#{
|
257
|
-
|
258
|
-
# "dvd_title_track" => "1", # most DVD's use title 1. Not all do, though. If sensible-cinema plays anything except the main title (for example, a trailer), when you use it, see http://goo.gl/QHLIF to set this right.
|
280
|
+
"disk_unique_id" => "#{dvd_id}",
|
281
|
+
"dvd_title_track" => "1", # most DVD's use title 1. Not all do, though. If sensible-cinema plays anything except the main title (for example, a trailer), when you use it, see http://goo.gl/QHLIF to set this right.
|
259
282
|
# "not edited out stuff" => "some violence",
|
260
283
|
# "closing thoughts" => "still...",
|
261
284
|
# "mplayer_dvd_splits" => ["59:59", "1:04:59"], # these are where, in mplayer, the DVD timestamp "resets" to zero for some reason (bug) http://goo.gl/yMfqX . [] is a valid option, if there are none.
|
@@ -267,7 +290,6 @@ module SensibleSwing
|
|
267
290
|
open_file_to_edit_it filename
|
268
291
|
end
|
269
292
|
|
270
|
-
alias system_original system
|
271
293
|
|
272
294
|
def system_blocking command, low_prio = false
|
273
295
|
return true if command =~ /^@rem/ # jruby+MRI bug, I think...
|
@@ -292,7 +314,7 @@ module SensibleSwing
|
|
292
314
|
p 'unable to find to set priority ' + exe_name
|
293
315
|
end
|
294
316
|
rescue Exception => e
|
295
|
-
p 'warning, got exception trying to set
|
317
|
+
p 'warning, got exception trying to set priority [jruby? ...]', e
|
296
318
|
end
|
297
319
|
end
|
298
320
|
print out.read # let it finish
|
@@ -304,7 +326,7 @@ module SensibleSwing
|
|
304
326
|
end
|
305
327
|
|
306
328
|
def system_non_blocking command
|
307
|
-
|
329
|
+
Thread.new { system_original command }
|
308
330
|
end
|
309
331
|
|
310
332
|
# make them choose which system call to use explicitly
|
@@ -317,18 +339,40 @@ module SensibleSwing
|
|
317
339
|
writeOut.close
|
318
340
|
end
|
319
341
|
|
320
|
-
def
|
321
|
-
|
322
|
-
|
323
|
-
|
342
|
+
def _dbg
|
343
|
+
require 'ruby-debug'
|
344
|
+
debugger
|
345
|
+
end
|
346
|
+
|
347
|
+
def play_dvd_smplayer_unedited use_mplayer_instead = false
|
348
|
+
# LODO really even if there are 2 it should still pick out the title track...hmm...on demand :P
|
349
|
+
# lodo mac os x 'ify'
|
350
|
+
drive, dvd_volume_name, dvd_id, edl_path_maybe_nil, descriptors_maybe_nil = choose_dvd_and_edl_for_it false
|
351
|
+
if descriptors_maybe_nil
|
352
|
+
title_track_maybe_nil = get_title_track(descriptors_maybe_nil, false)
|
353
|
+
end
|
354
|
+
if use_mplayer_instead
|
355
|
+
exe = "mplayer "
|
356
|
+
# maybe, maybe following would be useful for people just watching through the film (?)
|
357
|
+
#"-font #{ENV['SystemRoot']}\\fonts\\ARIAL.TTF "
|
358
|
+
else
|
359
|
+
config_path = set_smplayer_opts " " # smplayer doesn't take -osdlevel 2 sniff...
|
360
|
+
exe = "smplayer_portable -config-path \"#{File.dirname config_path}\" "
|
361
|
+
end
|
362
|
+
command = "#{exe} dvdnav://#{title_track_maybe_nil}/#{drive} -osd-fractions 2 -nocache "
|
324
363
|
p command
|
364
|
+
@play_smplayer_warn ||= show_non_blocking_message_dialog "Directions:
|
365
|
+
'o' key: turn on on-screen time stamps (note: these are 30 fps timestamps so will need to be converted to use).
|
366
|
+
'v' key: turn off subtitles.
|
367
|
+
'.' key: step one frame.
|
368
|
+
'f' for full screen."
|
325
369
|
system_non_blocking command
|
326
370
|
end
|
327
371
|
|
328
372
|
EdlTempFile = Dir.tmpdir + '/mplayer.temp.edl'
|
329
373
|
|
330
374
|
def do_mplayer_edl play_this_mplayer = nil, add_secs_end = 0, add_secs_beginning = 0.5
|
331
|
-
drive, dvd_volume_name,
|
375
|
+
drive, dvd_volume_name, dvd_id, edl_path, descriptors = choose_dvd_and_edl_for_it
|
332
376
|
descriptors = EdlParser.parse_file edl_path
|
333
377
|
splits = descriptors['mplayer_dvd_splits']
|
334
378
|
if splits == nil && !play_this_mplayer
|
@@ -343,26 +387,33 @@ module SensibleSwing
|
|
343
387
|
File.write(EdlTempFile, edl_contents)
|
344
388
|
title_track = get_title_track(descriptors)
|
345
389
|
# oh the insanity of the console UI...LODO more user friendly player
|
346
|
-
@popup ||=
|
390
|
+
@popup ||= show_non_blocking_message_dialog("About to run mplayer DVD. To control it, use\n space for pause,\n f for full screen,\n arrow keys to seek.")
|
347
391
|
# LODO dry up mplayer dvd opts...
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
392
|
+
if OS.windows?
|
393
|
+
play_this_mplayer ||= "mplayer -nocache dvdnav://#{title_track} "
|
394
|
+
else
|
395
|
+
# macports' mplayer has no dvdnav ??
|
396
|
+
play_this_mplayer ||= "mplayer dvd://#{title_track} "
|
397
|
+
end
|
398
|
+
if OS.windows?
|
399
|
+
# direct3d for windows 7 old nvidia's sake yipes
|
400
|
+
play_this_mplayer += " -vo direct3d "
|
401
|
+
play_this_mplayer += " -font #{ENV['SystemRoot']}\\fonts\\ARIAL.TTF"
|
402
|
+
end
|
403
|
+
command = "#{play_this_mplayer} -framedrop -alang en -sid 1000 -edl #{File.expand_path EdlTempFile} -dvd-device #{drive}"
|
404
|
+
# -hardframedrop might help but hurts just too much
|
354
405
|
p command
|
355
406
|
Thread.new { system_blocking command; @popup.dispose }
|
356
407
|
end
|
357
408
|
|
358
|
-
def
|
409
|
+
def require_blocking_license_accept_dialog program, license_name, license_url_should_also_be_embedded_by_you_in_message,
|
359
410
|
title = 'Confirm Acceptance of License Agreement', message = nil
|
360
411
|
puts 'Please confirm license agreement in open window.'
|
361
412
|
old = ['no', 'yes', 'ok'].map{|name| 'OptionPane.' + name + 'ButtonText'}.map{|name| [name, UIManager.get(name)]}
|
362
413
|
UIManager.put("OptionPane.yesButtonText", 'Accept')
|
363
414
|
UIManager.put("OptionPane.noButtonText", "View License (#{license_name})")
|
364
415
|
# cancel button stays the same...
|
365
|
-
|
416
|
+
|
366
417
|
message ||= "Sensible Cinema requires a separately installed program (#{program}). You can install this program
|
367
418
|
separately, or Sensible Cinema can download it for you.
|
368
419
|
By clicking accept, below, you are confirming that you have read and agree to be bound by the
|
@@ -400,7 +451,7 @@ module SensibleSwing
|
|
400
451
|
Dir.mkdir('./vendor/cache') unless File.directory? 'vendor/cache' # development may not have it created yet... [?]
|
401
452
|
unless File.exist? 'vendor/cache/7za.exe'
|
402
453
|
Dir.chdir('vendor/cache') do
|
403
|
-
print 'downloading unzipper...'
|
454
|
+
print 'downloading unzipper (400K) ...'
|
404
455
|
download("http://downloads.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip", "7za920.zip")
|
405
456
|
system_blocking("../unzip.exe -o 7za920.zip") # -o means "overwrite" without prompting
|
406
457
|
end
|
@@ -419,30 +470,48 @@ module SensibleSwing
|
|
419
470
|
end
|
420
471
|
end
|
421
472
|
|
473
|
+
require 'lib/check_installed_mac.rb'
|
474
|
+
|
475
|
+
def check_for_exe windows_loc, unix_name
|
476
|
+
# in windows, that exe *at that location* must exist...
|
477
|
+
if OS.windows?
|
478
|
+
File.exist?(windows_loc)
|
479
|
+
else
|
480
|
+
if !CheckInstalledMac.check_for_installed(unix_name)
|
481
|
+
exit 1
|
482
|
+
else
|
483
|
+
true
|
484
|
+
end
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
422
488
|
def check_for_dependencies
|
423
|
-
#ffmpeg = RubyWhich.new.which('ffmpeg')
|
424
489
|
ffmpeg_exe_loc = File.expand_path('vendor/cache/ffmpeg/ffmpeg.exe')
|
425
|
-
if !
|
426
|
-
|
490
|
+
if !check_for_exe(ffmpeg_exe_loc, 'ffmpeg')
|
491
|
+
require_blocking_license_accept_dialog 'ffmpeg', 'gplv2', 'http://www.gnu.org/licenses/gpl-2.0.html', "Appears that you need to install a dependency: ffmpeg."
|
427
492
|
download_zip_to "ffmpeg (5MB)", "http://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-git-1929807-win32-shared.7z", "ffmpeg"
|
428
493
|
end
|
429
|
-
raise unless File.exist?(ffmpeg_exe_loc)
|
430
494
|
|
431
|
-
if !
|
432
|
-
|
433
|
-
download_zip_to "Mplayer/mencoder (6MB)", "http://downloads.sourceforge.net/project/mplayer-win32/MPlayer%20and%20MEncoder/revision%
|
495
|
+
if !check_for_exe('vendor/cache/mencoder/mencoder.exe', 'mencoder')
|
496
|
+
require_blocking_license_accept_dialog 'mplayer', 'gplv2', 'http://www.gnu.org/licenses/gpl-2.0.html', "Appears that you need to install a dependency: mplayer with mencoder."
|
497
|
+
download_zip_to "Mplayer/mencoder (6MB)", "http://downloads.sourceforge.net/project/mplayer-win32/MPlayer%20and%20MEncoder/revision%2033574/MPlayer-rtm-svn-33574.7z", "mencoder"
|
434
498
|
end
|
435
499
|
|
436
500
|
if ARGV.index('--create-mode')
|
437
501
|
# they're going to want these dependencies
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
502
|
+
if OS.windows?
|
503
|
+
path = RubyWhich.new.which('smplayer_portable')
|
504
|
+
if(path.length == 0)
|
505
|
+
# this one has its own installer...
|
506
|
+
show_blocking_message_dialog("It appears that you need to install a dependency: MPlayer for Windows (MPUI).\n
|
507
|
+
Click ok to be directed to its download website, where you can download and install it (recommend: MPUI Full-package), then restart sensible cinema.",
|
508
|
+
"Lacking dependency", JOptionPane::ERROR_MESSAGE)
|
509
|
+
system_non_blocking("start http://mulder.dummwiedeutsch.de/#mplayer") # LODO would launchy help/work here with the full url?
|
510
|
+
System.exit(1)
|
511
|
+
end
|
512
|
+
else
|
513
|
+
check_for_exe("mplayer", "mplayer") # OS X ...
|
514
|
+
puts 'warning for OS X users--the smplayer-type buttons aren\'t going to work'
|
446
515
|
end
|
447
516
|
end
|
448
517
|
end
|
@@ -451,10 +520,10 @@ module SensibleSwing
|
|
451
520
|
system_non_blocking "notepad \"#{filename}\""
|
452
521
|
end
|
453
522
|
|
454
|
-
def single_edit_list_matches_dvd
|
523
|
+
def single_edit_list_matches_dvd dvd_id
|
455
524
|
matching = Dir[EDL_DIR + '/*.txt'].select{|file|
|
456
525
|
begin
|
457
|
-
parse_edl(file)["disk_unique_id"] ==
|
526
|
+
parse_edl(file)["disk_unique_id"] == dvd_id
|
458
527
|
rescue SyntaxError
|
459
528
|
# ignore poorly formed delete lists for the auto choose
|
460
529
|
p 'warning, unable to parse:' + file
|
@@ -463,7 +532,7 @@ module SensibleSwing
|
|
463
532
|
}
|
464
533
|
if matching.length == 1
|
465
534
|
file = matching[0]
|
466
|
-
p "selecting the one matching file #{file} #{
|
535
|
+
p "selecting the one matching file #{file} #{dvd_id}"
|
467
536
|
file
|
468
537
|
else
|
469
538
|
nil
|
@@ -485,6 +554,12 @@ module SensibleSwing
|
|
485
554
|
true
|
486
555
|
end
|
487
556
|
|
557
|
+
# call dispose on this to close it if it hasn't been canceled yet...
|
558
|
+
def show_non_blocking_message_dialog message, close_button_text = 'Close'
|
559
|
+
# lodo NonBlockingDialog it can get to the top instead of being so buried...
|
560
|
+
NonBlockingDialog.new(message, close_button_text)
|
561
|
+
end
|
562
|
+
|
488
563
|
include_class javax.swing.UIManager
|
489
564
|
|
490
565
|
def get_user_input(message, default = '')
|
@@ -501,37 +576,39 @@ module SensibleSwing
|
|
501
576
|
JFile.new(File.dirname(path)).get_usable_space
|
502
577
|
end
|
503
578
|
|
504
|
-
def choose_dvd_and_edl_for_it
|
505
|
-
drive, dvd_volume_name,
|
506
|
-
@_edit_list_path
|
507
|
-
|
508
|
-
|
509
|
-
edit_list_path = single_edit_list_matches_dvd(md5sum)
|
510
|
-
if !edit_list_path
|
579
|
+
def choose_dvd_and_edl_for_it choose_file = true
|
580
|
+
drive, dvd_volume_name, dvd_id = choose_dvd_drive
|
581
|
+
unless @_edit_list_path
|
582
|
+
edit_list_path = single_edit_list_matches_dvd(dvd_id)
|
583
|
+
if !edit_list_path && choose_file
|
511
584
|
fc = FileDialog.new(self)
|
512
585
|
fc.set_title "Please pick a DVD Delete List File (non matching found)"
|
513
586
|
fc.set_directory EDL_DIR
|
514
587
|
edit_list_path = fc.go
|
588
|
+
raise 'cancelled' unless edit_list_path
|
515
589
|
end
|
516
|
-
|
517
|
-
edit_list_path
|
590
|
+
@_edit_list_path = edit_list_path
|
518
591
|
end
|
519
592
|
|
520
|
-
|
521
|
-
|
522
|
-
|
593
|
+
if @_edit_list_path
|
594
|
+
# reload it just in case it has changed on disk
|
595
|
+
descriptors = nil
|
596
|
+
while(!descriptors)
|
523
597
|
begin
|
524
598
|
descriptors = parse_edl @_edit_list_path
|
525
599
|
rescue SyntaxError => e
|
526
600
|
puts e
|
527
|
-
show_blocking_message_dialog("
|
601
|
+
show_blocking_message_dialog("this file has an error--please fix then hit ok: \n" + @_edit_list_path + "\n " + e)
|
528
602
|
end
|
603
|
+
end
|
529
604
|
end
|
530
|
-
[drive, dvd_volume_name,
|
605
|
+
[drive, dvd_volume_name, dvd_id, @_edit_list_path, descriptors]
|
531
606
|
end
|
532
607
|
|
533
|
-
def get_title_track descriptors
|
534
|
-
descriptors["dvd_title_track"]
|
608
|
+
def get_title_track descriptors, use_default_of_one = true
|
609
|
+
given = descriptors["dvd_title_track"]
|
610
|
+
given ||= "1" if use_default_of_one
|
611
|
+
given
|
535
612
|
end
|
536
613
|
|
537
614
|
def get_save_to_filename dvd_title
|
@@ -557,7 +634,7 @@ module SensibleSwing
|
|
557
634
|
end
|
558
635
|
|
559
636
|
def do_copy_dvd_to_hard_drive should_prompt_for_start_and_end_times, exit_early_if_fulli_exists = false, watch_unedited = false
|
560
|
-
drive, dvd_volume_name,
|
637
|
+
drive, dvd_volume_name, dvd_id, edit_list_path, descriptors = choose_dvd_and_edl_for_it
|
561
638
|
|
562
639
|
descriptors = parse_edl(edit_list_path)
|
563
640
|
if watch_unedited
|
@@ -627,7 +704,7 @@ module SensibleSwing
|
|
627
704
|
temp_dir = Dir.tmpdir
|
628
705
|
temp_file = temp_dir + '/vlc.temp.bat'
|
629
706
|
File.write(temp_file, commands)
|
630
|
-
popup =
|
707
|
+
popup = show_non_blocking_message_dialog(
|
631
708
|
"Applying #{File.basename edit_list_path} \n against #{drive} (#{dvd_title}).\n" +
|
632
709
|
"Copying to #{save_to}.\n" +
|
633
710
|
"This could take quite awhile, and will prompt you and chime a noise when it is done.\n" +
|
@@ -668,9 +745,9 @@ module SensibleSwing
|
|
668
745
|
if success
|
669
746
|
saved_to = save_to + '.avi'
|
670
747
|
if run_mplayer
|
671
|
-
|
748
|
+
set_smplayer_opts ''
|
749
|
+
system_non_blocking "smplayer_portable #{saved_to}"
|
672
750
|
else
|
673
|
-
# lodo NonBlockingDialog once it can get to the top instead of being so buried...
|
674
751
|
show_file = "explorer /e,/select,\"#{File.expand_path(saved_to).to_filename}\""
|
675
752
|
system_blocking show_file # returns immediately
|
676
753
|
PlayAudio.play(File.expand_path(File.dirname(__FILE__)) + "/../vendor/music.wav")
|
@@ -681,14 +758,17 @@ module SensibleSwing
|
|
681
758
|
end
|
682
759
|
end
|
683
760
|
|
684
|
-
# returns e:\, volume,
|
761
|
+
# returns e:\, volume, dvd_id
|
685
762
|
def choose_dvd_drive
|
686
763
|
opticals = DriveInfo.get_dvd_drives_as_openstruct
|
687
764
|
if @saved_opticals == opticals
|
688
765
|
# memoize...kind of :)
|
689
766
|
return @_choose_dvd_drive
|
690
767
|
end
|
691
|
-
|
768
|
+
unless opticals.find{|d| d.VolumeName }
|
769
|
+
show_blocking_message_dialog 'insert a dvd first'
|
770
|
+
exit 1
|
771
|
+
end
|
692
772
|
names = opticals.map{|d| d.Name + "\\" + " (" + (d.VolumeName || 'Insert DVD to use') + ")"}
|
693
773
|
|
694
774
|
if opticals.length != 1
|
@@ -706,16 +786,14 @@ module SensibleSwing
|
|
706
786
|
end
|
707
787
|
else
|
708
788
|
selected_idx = 0
|
709
|
-
p 'selecting user\'s only
|
789
|
+
p 'selecting user\'s only DVD drive ' + names[0]
|
710
790
|
end
|
711
791
|
|
712
792
|
if selected_idx
|
713
793
|
disk = opticals[selected_idx]
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
@_choose_dvd_drive = [prefix, opticals[selected_idx].VolumeName, md5sum]
|
718
|
-
@saved_opticals = opticals
|
794
|
+
dvd_id = DriveInfo.md5sum_disk(disk.MountPoint)
|
795
|
+
@_choose_dvd_drive = [disk.MountPoint, opticals[selected_idx].VolumeName, dvd_id]
|
796
|
+
@saved_opticals = opticals # since we force them to have their disc already in there...guess this is ok for os x :)
|
719
797
|
return @_choose_dvd_drive
|
720
798
|
else
|
721
799
|
puts 'did not select a drive...hard exiting'
|
@@ -750,17 +828,6 @@ module SensibleSwing
|
|
750
828
|
end
|
751
829
|
end
|
752
830
|
|
753
|
-
require 'ffi'
|
754
|
-
|
755
|
-
module Win
|
756
|
-
extend FFI::Library
|
757
|
-
ffi_lib 'kernel32'
|
758
|
-
ffi_convention :stdcall
|
759
|
-
attach_function :get_process_id, :GetProcessId, [ :long ], :uint
|
760
|
-
end
|
761
|
-
|
762
|
-
|
763
|
-
|
764
831
|
class ShutdownHook
|
765
832
|
include java.lang.Runnable
|
766
833
|
def initialize( &block)
|
@@ -772,21 +839,32 @@ class ShutdownHook
|
|
772
839
|
end
|
773
840
|
end
|
774
841
|
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
842
|
+
def at_exit2( &block)
|
843
|
+
hook = ShutdownHook.new( &block)
|
844
|
+
java.lang.Runtime.getRuntime.addShutdownHook(java.lang.Thread.new( hook ))
|
845
|
+
end
|
846
|
+
|
847
|
+
def kill_processes
|
848
|
+
if OS.windows?
|
849
|
+
system_original("taskkill /f /im mencoder.exe 2>NUL") # todo...is there a better way?
|
850
|
+
system_original("taskkill /f /im ffmpeg.exe 2>NUL")
|
851
|
+
system_original("taskkill /f /im smplayer_portable.exe 2>NUL")
|
852
|
+
system_original("taskkill /f /im mplayer.exe 2>NUL")
|
853
|
+
end
|
854
|
+
end
|
779
855
|
|
780
856
|
at_exit2 {
|
781
|
-
|
782
|
-
system("taskkill /f /im ffmpeg.exe 2>NUL")
|
783
|
-
system("taskkill /f /im mplayer.exe 2>NUL")
|
857
|
+
kill_processes # just in case
|
784
858
|
}
|
785
859
|
|
786
860
|
if $0 == __FILE__
|
787
|
-
|
788
|
-
|
789
|
-
|
861
|
+
if ARGV.index('-h') || ARGV.index('--help')
|
862
|
+
puts 'syntax: [--create-mode]'
|
863
|
+
else
|
864
|
+
a = SensibleSwing::MainWindow.new
|
865
|
+
a.set_visible true
|
866
|
+
puts 'Please use the Sensible Cinema GUI window popup...'
|
867
|
+
end
|
790
868
|
end
|
791
869
|
|
792
|
-
# icon
|
870
|
+
# icon derived from: http://www.threes.com/index.php?option=com_content&view=article&id=1800:three-wise-monkeys&catid=82:mythology&Itemid=62
|