sensible-cinema 0.28.1 → 0.34.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.TXT} +35 -14
- data/Rakefile +49 -41
- data/TODO +337 -250
- data/VERSION +1 -1
- data/bin/sensible-cinema +15 -14
- data/bin/sensible-cinema-cli +1 -1
- data/business_ideas.txt +8 -0
- data/change_log_with_feature_list.txt +198 -1
- data/documentation/is_it_legal_to_copy_dvds.txt +44 -30
- data/goc.bat +1 -1
- data/gpl-2.0.txt +339 -0
- data/history_and_related_works_list.txt +37 -33
- data/{cone.png → inventionzy_files/cone.png} +0 -0
- data/legal_draft +23 -0
- data/lib/add_any_bundled_gems_to_load_path.rb +4 -3
- data/lib/check_installed_mac.rb +10 -10
- data/lib/count_down_timer_jruby_swing.rb +4 -4
- data/lib/edl_parser.rb +155 -142
- data/lib/extract/dumpstream.bat +1 -0
- data/lib/extract/get_init.bat +3 -0
- data/lib/extract/pause_early.rb +13 -0
- data/lib/gui/base.rb +707 -0
- data/lib/gui/create-file.rb +244 -0
- data/lib/gui/create.rb +565 -0
- data/lib/gui/dependencies.rb +177 -0
- data/lib/gui/normal.rb +190 -0
- data/lib/gui/{sensible-cinema-upconvert.rb → upconvert.rb} +33 -14
- data/lib/keyboard_input.rb +0 -2
- data/lib/mencoder_wrapper.rb +8 -3
- data/lib/movie_hasher.rb +27 -0
- data/lib/mplayer_edl.rb +1 -0
- data/lib/subtitle_profanity_finder.rb +141 -103
- data/lib/vlc_programmer.rb +1 -1
- data/lib/zoom_player_max_edl.rb +50 -0
- data/{developer_how_to_contribute_to_the_project.txt → notes_for_potential_developers.txt} +18 -11
- data/roadmap_possibilities +12 -0
- data/spec/arse.srt +6 -1
- data/spec/dragon.srt +3 -0
- data/spec/edl_parser.spec.rb +57 -52
- data/spec/mencoder_wrapper.spec.rb +26 -19
- data/spec/mplayer_edl.spec.rb +40 -10
- data/spec/notes +3043 -9
- data/spec/sensible_cinema_gui.spec.rb +8 -3
- data/spec/subtitle_profanity_finder.spec.rb +91 -36
- data/spec/zoom_player_max_edl.spec.rb +29 -0
- data/template_bats/README_DISTRO.TXT +3 -1
- data/template_bats/RUN SENSIBLE CINEMA CLICK HERE WINDOWS.bat +25 -0
- data/template_bats/mac/RUN SENSIBLE CINEMA CLICK HERE.command +2 -1
- data/template_bats/mac/advanced--create or edit sensible cinema edit list files.command +2 -1
- data/template_bats/mac/advanced--run-upconverting-video-player.command +2 -1
- data/template_bats/pc/advanced--create or edit sensible cinema edit list files.bat +2 -0
- data/template_bats/pc/advanced--run-upconverting-video-player.bat +2 -0
- data/todo.inventionzy.txt +69 -2
- data/todo.propaganda +34 -10
- data/todo.upconvert +8 -1
- data/{upconvert_netflix/latest2 → upconvert_from_screen}/go_upscaling.bat +0 -0
- data/{also_see_rogerdpack_youtube_account_and_sourceforge_files_movies_account → upconvert_from_screen/go_upscaling_works} +0 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/latest2/combine_video.avs +0 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/latest2/go_no_upscaling.bat +0 -0
- data/upconvert_from_screen/old/latest2/go_upscaling.bat +12 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/latest2/push2.GRF +0 -0
- data/upconvert_from_screen/old/latest2/push3.grf +0 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/latest2/setup_capture_coords.rb +0 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/latest2/setup_directshow_filter_params.rb +0 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/latest2/upconvert_from_screen_me2.avs +1 -1
- data/{upconvert_netflix → upconvert_from_screen}/old/latest_now_possibly_oudated/push2.GRF +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/latest_now_possibly_oudated/upconvert_from_screen_me2.avs +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/position_window.png +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/push_source_desktop.GRF +0 -0
- data/{upconvert_netflix → upconvert_from_screen/old}/record_screen/record.bat +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/upconvert_from_screen.avs +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/upconvert_from_screen_me.avs +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/upconvert_from_screen_me2.avs +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/upconvert_from_screen_me_push_source.avs +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/uscreen.GRF +0 -0
- data/{upconvert_netflix → upconvert_from_screen}/old/uscreen_me.GRF +0 -0
- data/upconvert_from_screen/push3.grf +0 -0
- data/upconvert_from_screen/upconvert_from_screen_me2.avs +19 -0
- data/vendor/mplayer_patches/apply.bat +12 -0
- data/vendor/{rdp-win32screenshot-0.0.9/RDP_BRANCH_HAS_MASTER_WITH_CORRECT_VERSION_NUMBER → mplayer_patches/configure_from_betterlogic} +0 -0
- data/vendor/mplayer_patches/libdvdnav/2905259c3b45529b3d8dedba572b6e4f67a2d8f4.diff +19 -0
- data/vendor/mplayer_patches/libdvdnav/83f1c9256f500285e46f1e44bcc74ffce90159db.diff +16 -0
- data/vendor/mplayer_patches/libdvdnav/eb91fb74680d30322461a1b9e425918ad4e2b2df.diff +21 -0
- data/vendor/mplayer_patches/libdvdnav/jump_to_time.diff +654 -0
- data/vendor/mplayer_patches/libdvdnav/non_strict.diff +13 -0
- data/vendor/mplayer_patches/mplayer_edl.diff +354 -0
- data/vendor/mplayer_patches/port_dir/PortIndex.quick +2 -0
- data/vendor/mplayer_patches/port_dir/how_to +13 -0
- data/vendor/mplayer_patches/port_dir/multimedia/mplayer-edl/Portfile +300 -0
- data/vendor/mplayer_patches/port_dir/multimedia/mplayer-edl/files/configure.x11.patch +20 -0
- data/vendor/mplayer_patches/port_dir/multimedia/mplayer-edl/files/llvm-gcc-workaround.patch +11 -0
- data/vendor/mplayer_patches/port_dir/multimedia/rdp-projects/Portfile +43 -0
- data/vendor/{rdp-win32screenshot-0.0.9/RDP_VERSION_IS_IN_RDP_BRANCH → mplayer_patches/updated_lib_too} +0 -0
- data/vendor/{readme.txt → readme.txt.setpriority} +0 -0
- data/www/content_editor.html +28 -28
- data/www/index.html +6 -1
- data/www/upconverting_movie_player.html +13 -3
- data/www/youtube_edl/.htaccess +44 -0
- data/{inventionzy_files/control_youtube.html → www/youtube_edl/control_youtube.rhtml} +39 -33
- data/www/youtube_edl/dispatch.fcgi +25 -0
- data/www/youtube_edl/render_edited.rb +25 -0
- data/{inventionzy_files/serve.rb → www/youtube_edl/server_this_dir.rb} +0 -0
- data/www/youtube_edl/todo +23 -0
- data/www/zoomplayer_max.png +0 -0
- data/zamples/edit_decision_lists/dvds/Harry Potter 2 chamber of secrets.txt +10 -5
- data/zamples/edit_decision_lists/dvds/aladdin.txt +30 -0
- data/zamples/edit_decision_lists/dvds/bambi.txt +1 -1
- data/zamples/edit_decision_lists/dvds/big_buck_bunny_dvd.txt +2 -0
- data/zamples/edit_decision_lists/dvds/bobs_big_plan.txt +2 -2
- data/zamples/edit_decision_lists/dvds/cars_2.txt +26 -0
- data/zamples/edit_decision_lists/dvds/cars_disney.txt +1 -1
- data/zamples/edit_decision_lists/dvds/condor_man_widescreen.txt +22 -0
- data/zamples/edit_decision_lists/dvds/court_jester.txt +10 -13
- data/zamples/edit_decision_lists/dvds/edls_being_edited/making_marriage_work.txt +15 -0
- data/zamples/edit_decision_lists/dvds/edls_being_edited/national_treasure.txt +23 -0
- data/zamples/edit_decision_lists/dvds/edls_being_edited/ratatouille.txt +35 -0
- data/zamples/edit_decision_lists/dvds/edls_being_edited/the_explorers.txt +49 -0
- data/zamples/edit_decision_lists/dvds/finding_neverland.txt +32 -0
- data/zamples/edit_decision_lists/dvds/flight_of_the_navigator.txt +22 -16
- data/zamples/edit_decision_lists/dvds/harry_potter_3_prisoner_of_azkaban.txt +21 -4
- data/zamples/edit_decision_lists/dvds/hitchhiker's_guide_to_the_galaxy.txt +1 -1
- data/zamples/edit_decision_lists/dvds/{edls_being_edited/king_of_kings.txt → king_of_kings.txt} +5 -5
- data/zamples/edit_decision_lists/dvds/nanny_mcphee.txt +31 -0
- data/zamples/edit_decision_lists/dvds/pack_jackson_wedding_2007-03-03.txt +9 -2
- data/zamples/edit_decision_lists/dvds/remember_the_titans.txt +35 -0
- data/zamples/edit_decision_lists/dvds/sintel_open_source_blender_ntsc_dvd.txt +8 -4
- data/zamples/edit_decision_lists/dvds/speed_racer.txt +1 -1
- data/zamples/edit_decision_lists/dvds/tangled.txt +21 -0
- data/zamples/edit_decision_lists/dvds/tron_legacy.txt +4 -1
- data/zamples/edit_decision_lists/files/conference_music_video.txt +10 -0
- data/zamples/edit_decision_lists/notes_on_movies_without_edls_yet/tron.txt +10 -0
- data/zamples/edit_decision_lists/old_not_yet_updated/example_edit_decision_list.txt +1 -1
- metadata +139 -117
- data/conclusions +0 -6
- data/documentation/how_to_create_your_own_delete_lists.txt +0 -69
- data/lib/gui/sensible-cinema-base.rb +0 -620
- data/lib/gui/sensible-cinema-create.rb +0 -331
- data/lib/gui/sensible-cinema-dependencies.rb +0 -28
- data/lib/gui/sensible-cinema-normal.rb +0 -351
- data/lib/gui/sensible-cinema-side-by-side.rb +0 -27
- data/lib/shutdown_kill.rb +0 -32
- data/lib/storage.rb +0 -105
- data/ocr.todo_if_need_speed +0 -6
- data/upconvert_netflix/record_screen/recording/1.png +0 -0
- data/upconvert_netflix/record_screen/recording/10.png +0 -0
- data/upconvert_netflix/record_screen/recording/2.png +0 -0
- data/upconvert_netflix/record_screen/recording/3.png +0 -0
- data/upconvert_netflix/record_screen/recording/4.png +0 -0
- data/upconvert_netflix/record_screen/recording/5.png +0 -0
- data/upconvert_netflix/record_screen/recording/6.png +0 -0
- data/upconvert_netflix/record_screen/recording/7.png +0 -0
- data/upconvert_netflix/record_screen/recording/8.png +0 -0
- data/upconvert_netflix/record_screen/recording/9.png +0 -0
- data/upconvert_netflix/record_screen/recording/d.png +0 -0
- data/vendor/monkey.png +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/.document +0 -5
- data/vendor/rdp-win32screenshot-0.0.9/History.rdoc +0 -53
- data/vendor/rdp-win32screenshot-0.0.9/LICENSE +0 -20
- data/vendor/rdp-win32screenshot-0.0.9/README.rdoc +0 -95
- data/vendor/rdp-win32screenshot-0.0.9/Rakefile +0 -63
- data/vendor/rdp-win32screenshot-0.0.9/VERSION +0 -1
- data/vendor/rdp-win32screenshot-0.0.9/enumerated +0 -55576
- data/vendor/rdp-win32screenshot-0.0.9/lib/aero_offscreen_srccopy_captureblt_doesnt_have_everything.bmp.gz +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/enumerate.rb +0 -6
- data/vendor/rdp-win32screenshot-0.0.9/lib/firefox.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/normal.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/normal2.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/notes +0 -5
- data/vendor/rdp-win32screenshot-0.0.9/lib/snapshot.rb +0 -10
- data/vendor/rdp-win32screenshot-0.0.9/lib/srccopy.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/srccopyplus.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/srccopyplusdirectx.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/vc.bmp +0 -0
- data/vendor/rdp-win32screenshot-0.0.9/lib/win32/screenshot.rb +0 -95
- data/vendor/rdp-win32screenshot-0.0.9/lib/win32/screenshot/bitmap_maker.rb +0 -200
- data/vendor/rdp-win32screenshot-0.0.9/lib/win32/util.rb +0 -93
- data/vendor/rdp-win32screenshot-0.0.9/spec/spec.opts +0 -1
- data/vendor/rdp-win32screenshot-0.0.9/spec/spec_helper.rb +0 -85
- data/vendor/rdp-win32screenshot-0.0.9/spec/win32_screenshot_spec.rb +0 -194
- data/vendor/rdp-win32screenshot-0.0.9/spec/win32_screenshot_util_spec.rb +0 -75
- data/vendor/rdp-win32screenshot-0.0.9/win32screenshot.gemspec +0 -69
- data/vendor/tsmuxer_1.10.6/licence.txt +0 -42
- data/zamples/edit_decision_lists/dvds/making_marriage_work.txt +0 -15
- data/zamples/edit_decision_lists/notes/tron.txt +0 -4
- data/zamples/edit_decision_lists/old_not_yet_updated/dvds/making marriage work.txt +0 -9
@@ -1,331 +0,0 @@
|
|
1
|
-
module SensibleSwing
|
2
|
-
|
3
|
-
class MainWindow
|
4
|
-
|
5
|
-
def setup_advanced_buttons
|
6
|
-
|
7
|
-
new_jbutton("Display the standard buttons") do
|
8
|
-
window = new_child_window
|
9
|
-
window.setup_normal_buttons
|
10
|
-
end
|
11
|
-
|
12
|
-
@mplayer_edl = new_jbutton( "Watch DVD edited (realtime) (mplayer)")
|
13
|
-
@mplayer_edl.on_clicked {
|
14
|
-
play_mplayer_edl_non_blocking nil, [], true, false
|
15
|
-
}
|
16
|
-
|
17
|
-
add_text_line 'Realtime/Create Options:'
|
18
|
-
|
19
|
-
@create_new_edl_for_current_dvd = new_jbutton("Create new Edit List for a DVD",
|
20
|
-
"If your DVD doesn't have an EDL created for it, this will be your first step--create an EDL file for it.")
|
21
|
-
@create_new_edl_for_current_dvd.on_clicked do
|
22
|
-
create_brand_new_edl
|
23
|
-
@display_dvd_info.simulate_click # for now...
|
24
|
-
end
|
25
|
-
|
26
|
-
@open_list = new_jbutton("Open/Edit a previously created Edit List file", "If your DVD has a previously existing EDL for it, you can open it to edit it with this button.")
|
27
|
-
@open_list.on_clicked {
|
28
|
-
filename = new_existing_file_selector_and_select_file( "Pick any file to open in editor", EdlParser::EDL_DIR)
|
29
|
-
open_file_to_edit_it filename
|
30
|
-
}
|
31
|
-
|
32
|
-
@play_smplayer = new_jbutton( "Watch full DVD unedited (realtime smplayer)")
|
33
|
-
@play_smplayer.tool_tip = <<-EOL
|
34
|
-
This will play the DVD unedited within smplayer.
|
35
|
-
NB it will default to title 1, so updated your EDL file that matches this DVD with the proper title if this doesn't work for you
|
36
|
-
i.e. if it just plays a single preview title or what not, and not the main title, you need to change this value.
|
37
|
-
This is useful if you want to just kind of watch the movie to enjoy it, and look for scenes to cut out.
|
38
|
-
You can use the built-in OSD (on-screen-display) to see what time frame the questionable scenes are at
|
39
|
-
(type "o" to toggle it). However, just realize that the OSD is in 30 fps, and our time stamps are all in 29.97
|
40
|
-
fps, so you'll need to convert it (the convert timestamp button) to be able to use it in a file.
|
41
|
-
EOL
|
42
|
-
@play_smplayer.on_clicked {
|
43
|
-
play_dvd_smplayer_unedited false, true, true
|
44
|
-
}
|
45
|
-
|
46
|
-
@play_mplayer_raw = new_jbutton( "Watch full DVD unedited (realtime mplayer)")
|
47
|
-
@play_mplayer_raw.tool_tip = <<-EOL
|
48
|
-
This is also useful for comparing subtitle files to see if they have accurate timings.
|
49
|
-
If you turn on subtitles (use the v button), then compare your srt file at say, the 1 hour mark, or 2 hour mark,
|
50
|
-
with the subtitles that mplayer displays, it *should* match exactly with the output in the command line,
|
51
|
-
like "V: 3600.0" should match your subtitle line "01:00:00,000 --> ..."
|
52
|
-
EOL
|
53
|
-
@play_mplayer_raw.on_clicked {
|
54
|
-
play_dvd_smplayer_unedited true, true, true
|
55
|
-
}
|
56
|
-
|
57
|
-
@parse_srt = new_jbutton("Scan a subtitle file (.srt) to detect profanity times automatically" )
|
58
|
-
@parse_srt.tool_tip = <<-EOL
|
59
|
-
You can download a .srt file and use it to programmatically search for the location of various profanities.
|
60
|
-
Basically download it from opensubtitles.org (or engsub.net et al),
|
61
|
-
(for opensubtitles.org enter dvd title in the search box, click on a result, click one from the list with an English flag,
|
62
|
-
then choose 'Download(zip)', then unzip the file)
|
63
|
-
NB that you'll want/need to *carefully* double check your subtitle file for accuracy. Here's how:
|
64
|
-
Now carefully compare a beginning timestamp in it with the actual words in the .srt file
|
65
|
-
with the actual DVD.
|
66
|
-
(see the button "Watch DVD unedited (realtime mplayer)")
|
67
|
-
(smplayer can kind of do it, too, play it, hit the 'o' button to display
|
68
|
-
the OSD timestamp, then go to just before the verbiage,
|
69
|
-
and hit the '.' key until a subtitle very first appears.
|
70
|
-
Next convert that number to 29.97 fps (using the button for that).
|
71
|
-
EOL
|
72
|
-
|
73
|
-
@parse_srt.on_clicked do
|
74
|
-
srt_filename = new_existing_file_selector_and_select_file("Pick srt file to scan for profanity:")
|
75
|
-
# TODO nuke
|
76
|
-
add_to_beginning = "0.0"#get_user_input("How much time to subtract from the beginning of every subtitle entry (ex: (1:00,1:01) becomes (0:59,1:01))", "0.0")
|
77
|
-
add_to_end = "0.0"#get_user_input("How much time to add to the end of every subtitle entry (ex: (1:00,1:04) becomes (1:00,1:05))", "0.0")
|
78
|
-
|
79
|
-
open_file_to_edit_it srt_filename
|
80
|
-
sleep 0.5 # let it open first
|
81
|
-
bring_to_front
|
82
|
-
|
83
|
-
if JOptionPane.show_select_buttons_prompt('Would you like to enter timing adjust information on the .srt file? [final pass should, even if it matches]') == :yes
|
84
|
-
start_text = get_user_input("enter the text from any subtitle entry near beginning [like \"Hello, welcome to our movie.\"]", "...")
|
85
|
-
start_srt = get_user_input("enter beginning timestamp within the .srt file #{File.basename(srt_filename)[0..10]}... for \"#{start_text}\"", "00:00:00,000")
|
86
|
-
start_movie_ts = get_user_input("enter beginning timestamp within the movie itself for said text", "0:00:00")
|
87
|
-
|
88
|
-
end_text = get_user_input("enter the text from a subtitle entry far within or near the end of the movie", "...")
|
89
|
-
end_srt = get_user_input("enter the beginning timestamps within the .srt for \"#{end_text}\"", "02:30:00,000")
|
90
|
-
end_movie_ts = get_user_input("enter beginning timestamps within the movie itself for \"#{end_text}\"", "2:30:00.0 or 9000.0")
|
91
|
-
else
|
92
|
-
start_srt = 0
|
93
|
-
start_movie_ts =0
|
94
|
-
end_srt = 1000
|
95
|
-
end_movie_ts = 1000
|
96
|
-
end
|
97
|
-
parsed_profanities = SubtitleProfanityFinder.edl_output srt_filename, {}, add_to_beginning.to_f, add_to_end.to_f, start_srt, start_movie_ts, end_srt, end_movie_ts
|
98
|
-
File.write EdlTempFile, "# add these into your mute section if you deem them mute-worthy\n" + parsed_profanities +
|
99
|
-
%!\n\n#Also add these two lines for later coordination:\n"beginning_subtitle" => ["#{start_text}", "#{start_movie_ts}"],! +
|
100
|
-
%!\n"ending_subtitle_entry" => ["#{end_text}", "#{end_movie_ts}"]!
|
101
|
-
open_file_to_edit_it EdlTempFile
|
102
|
-
end
|
103
|
-
|
104
|
-
@display_dvd_info = new_jbutton( "Display information about current DVD (ID, etc.)" )
|
105
|
-
@display_dvd_info.tool_tip = "This is useful to setup a DVD's 'unique ID' within an EDL for it. \nIf your EDL doesn't have a line like disk_unique_id => \"...\" then you will want to run this to be able to add that line in."
|
106
|
-
@display_dvd_info.on_clicked {
|
107
|
-
drive, volume_name, dvd_id = choose_dvd_drive_or_file true # real DVD disk
|
108
|
-
# display it, allow them to copy and paste it out
|
109
|
-
title_lengths = nil
|
110
|
-
t = Thread.new { title_lengths= `mplayer dvdnav:// -nocache -dvd-device #{drive} -identify -frames 0 2>&1| grep LENGTH` }
|
111
|
-
id_string = "\"disk_unique_id\" => \"#{dvd_id}\", # #{volume_name}"
|
112
|
-
show_copy_pastable_string "#{drive} #{volume_name} for your copying+pasting pleasure (highlight, then ctrl+c to copy)\n
|
113
|
-
This is USED eventually to identify a disk to match it to its EDL, later.", id_string
|
114
|
-
t.join
|
115
|
-
File.write EdlTempFile, id_string + "\n" + title_lengths
|
116
|
-
open_file_to_edit_it EdlTempFile
|
117
|
-
id_string
|
118
|
-
}
|
119
|
-
|
120
|
-
@convert_seconds_to_ts = new_jbutton( "Convert 3600.0 <-> 1:00:00 style timestamps" )
|
121
|
-
@convert_seconds_to_ts.on_clicked {
|
122
|
-
input = get_user_input("Enter \"from\" timestamps, like 3600 or 1:40:00:", "1:00:00.1 or 3600.1")
|
123
|
-
while(input)
|
124
|
-
if input =~ /:/
|
125
|
-
output = EdlParser.translate_string_to_seconds input
|
126
|
-
else
|
127
|
-
output = EdlParser.translate_time_to_human_readable input.to_f, true
|
128
|
-
end
|
129
|
-
input = show_copy_pastable_string("Converted:", output)
|
130
|
-
end
|
131
|
-
}
|
132
|
-
|
133
|
-
@convert_timestamp = new_jbutton( "Convert timestamp from DVD player time to EDL time (30->29.97 fps)" )
|
134
|
-
@convert_timestamp.tool_tip=<<-EOL
|
135
|
-
Our EDL's assume 29.97 fps (which is what a DVD actually has). Unfortunately most hardware or commercial DVD players
|
136
|
-
think that the DVD is 30 fps, which means that if you use them for timestamps for your EDL's,
|
137
|
-
you will be slightly off (at the end of a 2 hour film, by 8 seconds). So all your edits will be wrong.
|
138
|
-
How to fix: convert your times from "DVD player" time to "EDL accurate" time by using this button.
|
139
|
-
This is necessary for all hardware DVD player timestamps, PowerDVD player (software), Windows Media Player (playing a DVD),
|
140
|
-
and mplayer's "on screen display" DVD timestamps.
|
141
|
-
It is not necessary for smplayer timestamps (or mplayer's "V: 3600" in the command line), which are already 29.97.
|
142
|
-
smplayer's on-screen-display (the 'o' key) is accurate (and doesn't suffer from dvd_mplayer_splits)
|
143
|
-
but is 30 fps, so timestamps would need to be converted.
|
144
|
-
Dont use VLC for DVD timestamps at all--it can get up to 30s off! VLC playing back a file is usually pretty accurate to 29.97.
|
145
|
-
In general, GUI's like VLC or smplayer are always a tidge off (maybe 0.3s) from the right timestamp, so take that into consideration.
|
146
|
-
Mplayers "V: 3600" is usually right on (29.97 fps), however.
|
147
|
-
EOL
|
148
|
-
@convert_timestamp.on_clicked {
|
149
|
-
thirty_fps = get_user_input("Enter your DVD (30 fps) timestamp, I'll convert it to 29.97 (usable in EDL's):", "1:00:00.1")
|
150
|
-
thirty_fps_in_seconds = EdlParser.translate_string_to_seconds thirty_fps
|
151
|
-
twenty_nine_seven_fps = ConvertThirtyFps.from_thirty(thirty_fps_in_seconds)
|
152
|
-
human_twenty_nine_seven = EdlParser.translate_time_to_human_readable twenty_nine_seven_fps, true
|
153
|
-
show_copy_pastable_string("Sensible cinema usable value (29.97 fps) for #{thirty_fps} would be: ", human_twenty_nine_seven)
|
154
|
-
}
|
155
|
-
|
156
|
-
@create_dot_edl = new_jbutton( "Create a side-by-side moviefilename.edl file")
|
157
|
-
@create_dot_edl.tool_tip = <<-EOL
|
158
|
-
Creates a moviefilename.edl file (corresponding to some moviefilename.some_ext file already existing)
|
159
|
-
XBMC/smplayer (smplayer can be used by WMC plugins, etc.) "automagically detect",
|
160
|
-
if it exists, and automatically use it .edl to show that file edited played back.
|
161
|
-
If you use smplayer, note that you'll need to download the "lord mulder mplayer"
|
162
|
-
version (which includes an updated version of mplayer that fixes some bugs in EDL playback)
|
163
|
-
EOL
|
164
|
-
@create_dot_edl.on_clicked {
|
165
|
-
choose_file_and_edl_and_create_sxs_or_play true
|
166
|
-
}
|
167
|
-
|
168
|
-
add_text_line 'Create Options with local intermediary file:'
|
169
|
-
|
170
|
-
new_jbutton("Show options with local intermediary file") do
|
171
|
-
window = new_child_window
|
172
|
-
window.add_options_that_use_local_files
|
173
|
-
end
|
174
|
-
|
175
|
-
# @reload = new_jbutton("reload bin/sensible-cinema code") do
|
176
|
-
# load $0
|
177
|
-
# end
|
178
|
-
|
179
|
-
end # advanced buttons
|
180
|
-
|
181
|
-
def add_options_that_use_local_files
|
182
|
-
add_text_line 'Create Options that first create/use a local intermediary file:'
|
183
|
-
|
184
|
-
@preview_section = new_jbutton( "Preview a certain time frame from fulli file (edited)" )
|
185
|
-
@preview_section.tool_tip = <<-EOL
|
186
|
-
This allows you to preview an edit easily.
|
187
|
-
It is the equivalent of saying \"watch this file edited from exactly minute x second y to minute z second q"
|
188
|
-
Typically if you want to test an edit, you can start a few seconds before, and end a few seconds after it, to test it precisely.
|
189
|
-
EOL
|
190
|
-
@preview_section.on_clicked {
|
191
|
-
do_create_edited_copy_via_file true
|
192
|
-
}
|
193
|
-
|
194
|
-
@preview_section_unedited = new_jbutton("Preview a certain time frame from fulli file (unedited)" )
|
195
|
-
@preview_section.tool_tip = "Allows you to view a certain time frame unedited (ex: 10:00 to 10:05), so you can narrow down to pinpoint where questionable scenes are, etc. This is the only way to view a specific scene if there are not cuts within that scene yet."
|
196
|
-
@preview_section_unedited.on_clicked {
|
197
|
-
do_create_edited_copy_via_file true, false, true
|
198
|
-
}
|
199
|
-
|
200
|
-
@rerun_preview = new_jbutton( "Re-run most recently watched preview time frame from fulli file" )
|
201
|
-
@rerun_preview.tool_tip = "This will re-run the preview that you most recently performed. Great for checking to see if you last edits were successful or not."
|
202
|
-
@rerun_preview.on_clicked {
|
203
|
-
repeat_last_copy_dvd_to_hard_drive
|
204
|
-
}
|
205
|
-
|
206
|
-
# Maybe this button should go too...
|
207
|
-
@fast_preview = new_jbutton("fast preview all from fulli file (smplayer EDL)")
|
208
|
-
@fast_preview.tool_tip = <<-EOL
|
209
|
-
Plays smplayer on a file with an EDL.
|
210
|
-
This gives you a rough estimate to see if your edits are accurate, and is really fast to seek, etc.
|
211
|
-
This is useful because you can't use mplayer on a DVD for accurate timestamps if it has any
|
212
|
-
timestamp splits in it [because some DVD's are buggy]
|
213
|
-
EOL
|
214
|
-
@fast_preview.on_clicked {
|
215
|
-
success, wrote_to_here_fulli = do_create_edited_copy_via_file false, true
|
216
|
-
sleep 0.5 # lodo take out ???
|
217
|
-
background_thread.join if background_thread # let it write out the original fulli, if necessary [?]
|
218
|
-
nice_file = wrote_to_here_fulli
|
219
|
-
run_smplayer_blocking nice_file, nil, "-edl #{normalize_path EdlTempFile}", false, true, false
|
220
|
-
}
|
221
|
-
end
|
222
|
-
|
223
|
-
def do_create_edited_copy_via_file should_prompt_for_start_and_end_times, exit_early_if_fulli_exists = false, watch_unedited = false
|
224
|
-
drive_or_file, dvd_volume_name, dvd_id, edit_list_path, descriptors = choose_dvd_or_file_and_edl_for_it
|
225
|
-
|
226
|
-
descriptors = parse_edl(edit_list_path)
|
227
|
-
if watch_unedited
|
228
|
-
# reset them
|
229
|
-
descriptors['mutes'] = descriptors['blank_outs'] = []
|
230
|
-
end
|
231
|
-
|
232
|
-
# LODO allow for spaces in the save_to filename
|
233
|
-
if should_prompt_for_start_and_end_times
|
234
|
-
# only show this message once :)
|
235
|
-
@show_block ||= show_blocking_message_dialog(<<-EOL, "Preview")
|
236
|
-
Ok, let's preview just a portion of it.
|
237
|
-
Note that you'll want to preview a section that wholly includes a deleted section in it.
|
238
|
-
For example, if it mutes from second 1 to second 10, you'll want to play from 00:00 to 00:12 or what not.
|
239
|
-
Also note that the first time you preview a section of a video, it will take a long time (like an hour) as it sets up the entire video for processing.
|
240
|
-
Subsequent previews will be faster, though, as long as you use the same filename, as it won't have to re-set it up for processing.
|
241
|
-
Also note that if you change your edit list, you'll need to close, and restart the video to be able to see it with your new settings.
|
242
|
-
EOL
|
243
|
-
old_start = LocalStorage['start_time']
|
244
|
-
start_time = get_user_input("At what point in the video would you like to start your preview? (like 01:00 for starting at 1 minute)", LocalStorage['start_time'])
|
245
|
-
default_end = LocalStorage['end_time']
|
246
|
-
if start_time and start_time != old_start
|
247
|
-
default_end = EdlParser.translate_string_to_seconds(start_time) + 10
|
248
|
-
default_end = EdlParser.translate_time_to_human_readable(default_end)
|
249
|
-
end
|
250
|
-
end_time = get_user_input("At what point in the video would you like to finish your preview? (like 02:00 for ending at the 2 minute mark)", default_end)
|
251
|
-
unless start_time and end_time
|
252
|
-
# this one is raw showMessageDialog...
|
253
|
-
JOptionPane.showMessageDialog(nil, " Please choose start and end", "Failed", JOptionPane::ERROR_MESSAGE)
|
254
|
-
return
|
255
|
-
end
|
256
|
-
LocalStorage['start_time'] = start_time
|
257
|
-
LocalStorage['end_time'] = end_time
|
258
|
-
end
|
259
|
-
dvd_friendly_name = descriptors['name']
|
260
|
-
unless dvd_friendly_name
|
261
|
-
drive_or_file, dvd_volume_name, dvd_id, edit_list_path, descriptors = choose_dvd_or_file_and_edl_for_it
|
262
|
-
descriptors = parse_edl(edit_list_path)
|
263
|
-
raise 'no dvd name in EDL?' + edit_list_path + File.read(edit_list_path)
|
264
|
-
end
|
265
|
-
|
266
|
-
dvd_title_track = get_title_track(descriptors)
|
267
|
-
if dvd_id == NonDvd
|
268
|
-
file_from = drive_or_file
|
269
|
-
else
|
270
|
-
file_from = get_grabbed_equivalent_filename_once dvd_friendly_name, dvd_title_track # we don't even care about the drive letter anymore...
|
271
|
-
end
|
272
|
-
if file_from =~ /\.mkv/i
|
273
|
-
show_blocking_message_dialog "warning .mkv files from makemkv have been known to be off timing wise, please convert to a .ts file using tsmuxer first if it came from makemkv"
|
274
|
-
end
|
275
|
-
if file_from !~ /\.(ts|mpg|mpeg)$/i
|
276
|
-
show_blocking_message_dialog("warning: file #{file_from} is not a .mpg or .ts file--it may not work properly all the way, but we'll try...")
|
277
|
-
end
|
278
|
-
|
279
|
-
save_to_edited = get_save_to_filename dvd_friendly_name
|
280
|
-
fulli = MencoderWrapper.calculate_fulli_filename save_to_edited
|
281
|
-
if exit_early_if_fulli_exists
|
282
|
-
if fulli_dot_done_file_exists? save_to_edited
|
283
|
-
return [true, fulli]
|
284
|
-
end
|
285
|
-
# make it create a dummy response file for us :)
|
286
|
-
start_time = "00:00"
|
287
|
-
end_time = "00:01"
|
288
|
-
end
|
289
|
-
should_run_mplayer = should_prompt_for_start_and_end_times || exit_early_if_fulli_exists
|
290
|
-
require_deletion_entry = true unless watch_unedited
|
291
|
-
generate_and_run_bat_file save_to_edited, edit_list_path, descriptors, file_from, dvd_friendly_name, start_time, end_time, dvd_title_track, should_run_mplayer, require_deletion_entry
|
292
|
-
[false, fulli] # false means it's running in a background thread :P
|
293
|
-
end
|
294
|
-
|
295
|
-
def create_brand_new_edl
|
296
|
-
drive, volume, dvd_id = choose_dvd_drive_or_file true
|
297
|
-
english_name = get_user_input("Enter a human readable DVD description for #{volume}", volume.gsub('_', ' ').downcase)
|
298
|
-
input = <<-EOL
|
299
|
-
# comments can go after a # on any line, for example this one.
|
300
|
-
"name" => "#{english_name}",
|
301
|
-
|
302
|
-
"mutes" => [
|
303
|
-
# an example line, uncomment the leading "#" to make it active
|
304
|
-
# "0:00:01.0", "0:00:02.0", "profanity", "da..",
|
305
|
-
],
|
306
|
-
|
307
|
-
"blank_outs" => [
|
308
|
-
# an example line, uncomment the leading "#" to make it active
|
309
|
-
# "00:03:00.0" , "00:04:00.0", "violence", "of some sort",
|
310
|
-
],
|
311
|
-
|
312
|
-
"volume_name" => "#{volume}",
|
313
|
-
"disk_unique_id" => "#{dvd_id}",
|
314
|
-
"dvd_title_track" => "1", # the "show DVD info" button will tell you title lengths (typically longest title is the title track)
|
315
|
-
# "dvd_title_track_length" => "9999", # length, on the DVD, of dvd_title_track (use the show DVD info button to get this number).
|
316
|
-
# "subtitle_url" => "1234567",
|
317
|
-
# "not edited out stuff" => "some...",
|
318
|
-
# "closing thoughts" => "only...",
|
319
|
-
# In mplayer, the DVD timestamp "resets" to zero for some reason, so you need to specify when if you want to use mplayer DVD realtime playback, or use mencoder -edl to split your file. See http://goo.gl/yMfqX
|
320
|
-
# "mplayer_dvd_splits" => ["59:59", "1:04:59"], # or [] if there are none. Additive currently. 12345.6 ok.
|
321
|
-
EOL
|
322
|
-
# TODO auto-ify above, move docs to a file in documentation.
|
323
|
-
filename = EdlParser::EDL_DIR + "/edls_being_edited/" + english_name.gsub(' ', '_') + '.txt'
|
324
|
-
filename.downcase!
|
325
|
-
File.write(filename, input) unless File.exist?(filename)
|
326
|
-
open_file_to_edit_it filename
|
327
|
-
end
|
328
|
-
|
329
|
-
|
330
|
-
end
|
331
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'java'
|
2
|
-
|
3
|
-
require 'sane'
|
4
|
-
|
5
|
-
module SensibleSwing
|
6
|
-
|
7
|
-
class MainWindow < javax.swing.JFrame
|
8
|
-
|
9
|
-
def self.download full_url, to_here
|
10
|
-
require 'open-uri'
|
11
|
-
require 'openssl'
|
12
|
-
eval("OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE") if full_url =~ /https/
|
13
|
-
writeOut = open(to_here, "wb")
|
14
|
-
writeOut.write(open(full_url).read)
|
15
|
-
writeOut.close
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.download_to_string full_url
|
19
|
-
require 'tempfile'
|
20
|
-
to = Tempfile.new 'abc'
|
21
|
-
download(full_url, to.path)
|
22
|
-
out = File.binread(to.path)
|
23
|
-
to.delete
|
24
|
-
out
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
@@ -1,351 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby # so my editor will like the file...
|
2
|
-
=begin
|
3
|
-
Copyright 2010, Roger Pack
|
4
|
-
This file is part of Sensible Cinema.
|
5
|
-
|
6
|
-
Sensible Cinema is free software: you can redistribute it and/or modify
|
7
|
-
it under the terms of the GNU General Public License as published by
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
9
|
-
(at your option) any later version.
|
10
|
-
|
11
|
-
Sensible Cinema is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
GNU General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU General Public License
|
17
|
-
along with Sensible Cinema. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
=end
|
19
|
-
|
20
|
-
module SensibleSwing
|
21
|
-
|
22
|
-
class MainWindow < JFrame
|
23
|
-
|
24
|
-
attr_accessor :parent, :upconv_line
|
25
|
-
|
26
|
-
|
27
|
-
# converts to full path, 8.3 if on doze
|
28
|
-
def normalize_path path
|
29
|
-
path = File.expand_path path
|
30
|
-
path = EightThree.convert_path_to_8_3 path if OS.doze?
|
31
|
-
end
|
32
|
-
|
33
|
-
def setup_normal_buttons
|
34
|
-
add_text_line ""
|
35
|
-
|
36
|
-
@mplayer_edl = new_jbutton( "Watch DVD edited (realtime)")
|
37
|
-
@mplayer_edl.tool_tip = "This will watch your DVD in realtime from your computer while skipping/muting questionable scenes."
|
38
|
-
@mplayer_edl.on_clicked {
|
39
|
-
play_mplayer_edl_non_blocking
|
40
|
-
}
|
41
|
-
|
42
|
-
@create = new_jbutton( "Create edited copy of DVD/file on Your Hard Drive" )
|
43
|
-
@create.tool_tip = <<-EOL
|
44
|
-
This takes a file and creates a new file on your hard disk like dvd_name_edited.mpg that you can watch when it's done.
|
45
|
-
The file you create will contain the whole movie edited.
|
46
|
-
It takes quite awhile maybe 2 hours. Sometimes the progress bar will look paused--it typically continues eventually.
|
47
|
-
EOL
|
48
|
-
@create.on_clicked {
|
49
|
-
do_create_edited_copy_via_file false
|
50
|
-
}
|
51
|
-
|
52
|
-
@watch_file_edl = new_jbutton( "Watch movie file edited (realtime)" ) do
|
53
|
-
choose_file_and_edl_and_create_sxs_or_play false
|
54
|
-
end
|
55
|
-
|
56
|
-
if LocalStorage[UpConvertEnglish]
|
57
|
-
add_text_line ''
|
58
|
-
add_open_documentation_button
|
59
|
-
@upconv_line = add_text_line " #{get_current_upconvert_as_phrase}"
|
60
|
-
else
|
61
|
-
@upconv_line = add_text_line ''
|
62
|
-
add_open_documentation_button
|
63
|
-
end
|
64
|
-
|
65
|
-
add_change_upconvert_options_button
|
66
|
-
|
67
|
-
@progress_bar = JProgressBar.new(0, 100)
|
68
|
-
@progress_bar.set_bounds(44,@starting_button_y,@button_width,23)
|
69
|
-
@progress_bar.visible = false
|
70
|
-
@panel.add @progress_bar
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
def add_open_documentation_button
|
75
|
-
@open_help_file = new_jbutton("View Sensible Cinema Documentation") do
|
76
|
-
show_in_explorer __DIR__ + "/../documentation" # TODO mac :)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def choose_file_and_edl_and_create_sxs_or_play just_create_dot_edl_file_instead_of_play
|
81
|
-
filename_mpg = new_existing_file_selector_and_select_file( "Pick moviefile (like moviename.mpg or video_ts/anything.ext)")
|
82
|
-
edl_filename = new_existing_file_selector_and_select_file( "Pick an EDL file to use with it", EdlParser::EDL_DIR)
|
83
|
-
assert_ownership_dialog
|
84
|
-
if just_create_dot_edl_file_instead_of_play
|
85
|
-
descriptors = EdlParser.parse_file edl_filename
|
86
|
-
# LODO these timings...DRY up...plus is XBMC the same? what about on a slower computer?
|
87
|
-
# NB these are just for the Side by side EDL's!
|
88
|
-
|
89
|
-
edl_contents = MplayerEdl.convert_to_edl descriptors, add_secs_end = MplayerEndBuffer, MplayerBeginingBuffer, splits = []
|
90
|
-
output_file = filename_mpg.gsub(/\.[^\.]+$/, '') + '.edl' # sanitize...
|
91
|
-
File.write(output_file, edl_contents)
|
92
|
-
raise unless File.exist?(output_file)
|
93
|
-
show_blocking_message_dialog("created #{output_file}")
|
94
|
-
else
|
95
|
-
play_mplayer_edl_non_blocking [filename_mpg, edl_filename]
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def we_are_in_upconvert_mode
|
100
|
-
ARGV.index("--upconvert-mode")
|
101
|
-
end
|
102
|
-
|
103
|
-
def setup_default_buttons
|
104
|
-
if we_are_in_upconvert_mode
|
105
|
-
add_play_upconvert_buttons
|
106
|
-
else
|
107
|
-
|
108
|
-
if we_are_in_create_mode
|
109
|
-
setup_advanced_buttons
|
110
|
-
add_text_line 'Contact:'
|
111
|
-
else
|
112
|
-
setup_normal_buttons
|
113
|
-
end
|
114
|
-
|
115
|
-
@upload = new_jbutton("Submit Feedback/Upload new EDL's/Request Help") # keeps this one last! :)
|
116
|
-
@upload.tool_tip = "We welcome all feedback!\nQuestion, comments, request help.\nAlso if you create a new EDL, please submit it back to us so that others can benefit from it later!"
|
117
|
-
@upload.on_clicked {
|
118
|
-
system_non_blocking("start mailto:sensible-cinema@googlegroups.com")
|
119
|
-
system_non_blocking("start http://groups.google.com/group/sensible-cinema")
|
120
|
-
}
|
121
|
-
increment_button_location
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
@exit = new_jbutton("Exit", "Exits the application and kills any background processes that are running at all--don't exit unless you are done processing all the way!")
|
126
|
-
@exit.on_clicked {
|
127
|
-
Thread.new { self.close } # don't waste the time to close it :P
|
128
|
-
puts 'Thank you for using Sensible Cinema. Come again!'
|
129
|
-
System.exit 0
|
130
|
-
}
|
131
|
-
|
132
|
-
increment_button_location
|
133
|
-
increment_button_location
|
134
|
-
self
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
def repeat_last_copy_dvd_to_hard_drive
|
139
|
-
generate_and_run_bat_file *LocalStorage['last_params']
|
140
|
-
end
|
141
|
-
|
142
|
-
def parse_edl path
|
143
|
-
EdlParser.parse_file path
|
144
|
-
end
|
145
|
-
|
146
|
-
def get_freespace path
|
147
|
-
JFile.new(File.dirname(path)).get_usable_space
|
148
|
-
end
|
149
|
-
|
150
|
-
def get_title_track descriptors, use_default_of_one = true
|
151
|
-
given = descriptors["dvd_title_track"]
|
152
|
-
given ||= "1" if use_default_of_one
|
153
|
-
given
|
154
|
-
end
|
155
|
-
|
156
|
-
def get_grabbed_equivalent_filename_once dvd_title, dvd_title_track
|
157
|
-
@_get_grabbed_equivalent_filename_once ||=
|
158
|
-
begin
|
159
|
-
new_existing_file_selector_and_select_file "Please choose the file that is your ripped equivalent of #{dvd_title} (title track #{dvd_title_track}) (.mpg or .ts--see file documentation/how_to_get_files_from_dvd.txt)"
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def get_save_to_filename dvd_title
|
164
|
-
@_get_save_to_filename ||=
|
165
|
-
begin
|
166
|
-
save_to_file_name = dvd_title + ' edited version'
|
167
|
-
save_to_file_name = save_to_file_name.gsub(' ', '_').gsub( /\W/, '') + ".avi" # no punctuation or spaces for now, to not complicate...
|
168
|
-
save_to = new_nonexisting_filechooser_and_go "Pick where to save #{dvd_title} edited version to", nil, get_drive_with_most_space_with_slash + save_to_file_name
|
169
|
-
raise 'no spaces allowed yet' if save_to =~ / /
|
170
|
-
begin
|
171
|
-
a = File.open(File.dirname(save_to) + "/test_file_to_see_if_we_have_permission_to_write_to_this_folder", "w")
|
172
|
-
a.close
|
173
|
-
File.delete a.path
|
174
|
-
rescue Errno::EACCES => e
|
175
|
-
show_blocking_message_dialog "unable to write to that directory, please pick again: " + e.to_s
|
176
|
-
raise 'pick again!'
|
177
|
-
end
|
178
|
-
freespace = get_freespace(save_to)
|
179
|
-
if freespace < 8_000_000_000
|
180
|
-
show_blocking_message_dialog("Warning: there may not be enough space on the disk for #{save_to}
|
181
|
-
(depending on DVD size, you may need around 10G free--you have #{freespace/1_000_000_000}GB free). Click OK to continue.")
|
182
|
-
end
|
183
|
-
save_to.gsub(/\.avi$/, '')
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
def get_drive_with_most_space_with_slash
|
188
|
-
DriveInfo.get_drive_with_most_space_with_slash
|
189
|
-
end
|
190
|
-
|
191
|
-
def fulli_dot_done_file_exists? save_to_edited
|
192
|
-
fulli = MencoderWrapper.calculate_fulli_filename save_to_edited
|
193
|
-
File.exist?(fulli + ".done") # stinky!
|
194
|
-
end
|
195
|
-
|
196
|
-
# to make it stubbable :)
|
197
|
-
def get_mencoder_commands descriptors, file_from, save_to, start_time, end_time, dvd_title_track, require_deletion_entry
|
198
|
-
delete_partials = true unless start_time # in case anybody wants to look really really close [?]
|
199
|
-
MencoderWrapper.get_bat_commands descriptors, file_from, save_to, start_time, end_time, dvd_title_track, delete_partials, require_deletion_entry
|
200
|
-
end
|
201
|
-
|
202
|
-
def generate_and_run_bat_file save_to, edit_list_path, descriptors, file_from, dvd_title, start_time, end_time, dvd_title_track, run_mplayer, require_deletion_entry
|
203
|
-
LocalStorage['last_params'] = [save_to, edit_list_path, descriptors, file_from, dvd_title, start_time, end_time, dvd_title_track, run_mplayer, require_deletion_entry]
|
204
|
-
begin
|
205
|
-
commands = get_mencoder_commands descriptors, file_from, save_to, start_time, end_time, dvd_title_track, require_deletion_entry
|
206
|
-
rescue MencoderWrapper::TimingError => e
|
207
|
-
show_blocking_message_dialog("Appears you chose a time frame with no deletion segment in it--please try again:" + e)
|
208
|
-
return
|
209
|
-
rescue Errno::EACCES => e
|
210
|
-
show_blocking_message_dialog("Appears a file on the system is locked: perhaps you need to close down some instance of mplayer?" + e)
|
211
|
-
return
|
212
|
-
end
|
213
|
-
temp_dir = Dir.tmpdir
|
214
|
-
temp_file = temp_dir + '/vlc.temp.bat'
|
215
|
-
File.write(temp_file, commands)
|
216
|
-
popup_message = <<-EOL
|
217
|
-
Applying #{File.basename edit_list_path}
|
218
|
-
to #{file_from} (#{dvd_title}).
|
219
|
-
Copying to #{save_to}.
|
220
|
-
EOL
|
221
|
-
if !fulli_dot_done_file_exists?(save_to)
|
222
|
-
popup_message += "This could take quite awhile (several hours), and will prompt you with a chime noise when it is done.\n
|
223
|
-
You can close this window and minimize sensible cinema and continue using your computer while it runs in the background.\n"
|
224
|
-
end
|
225
|
-
|
226
|
-
if !start_time
|
227
|
-
# assume a full run..
|
228
|
-
popup_message += <<-EOL
|
229
|
-
NB that the created file will be playable only with VLC (possibly also with smplayer),
|
230
|
-
but probably not with windows media player.
|
231
|
-
EOL
|
232
|
-
end
|
233
|
-
|
234
|
-
popup = show_non_blocking_message_dialog(popup_message, "OK")
|
235
|
-
|
236
|
-
# allow our popups to still be serviced while it is running
|
237
|
-
@background_thread = Thread.new { run_batch_file_commands_and_use_output_somehow commands, save_to, file_from, run_mplayer }
|
238
|
-
when_thread_done(@background_thread) { popup.dispose }
|
239
|
-
# LODO warn if they will overwrite a file in the end...
|
240
|
-
end
|
241
|
-
|
242
|
-
attr_accessor :background_thread, :buttons
|
243
|
-
|
244
|
-
def run_batch_file_commands_and_use_output_somehow batch_commands, save_to, file_from, run_mplayer_after_done
|
245
|
-
@buttons.each{|b| b.set_enabled false}
|
246
|
-
success = true
|
247
|
-
lines = batch_commands.lines.to_a
|
248
|
-
total_size = lines.length.to_f
|
249
|
-
@progress_bar.visible=true
|
250
|
-
@progress_bar.set_value(10) # start at 10% always, so they can see something.
|
251
|
-
lines.each_with_index{|line, idx|
|
252
|
-
if success
|
253
|
-
puts "running #{line}"
|
254
|
-
success = system_blocking(line, true)
|
255
|
-
if !success
|
256
|
-
puts "\n", 'line failed: ' + line + "\n" + ' see troubleshooting section in README.txt file! ignoring further processing commands...'
|
257
|
-
end
|
258
|
-
end
|
259
|
-
@progress_bar.set_value(10 + idx/total_size*90)
|
260
|
-
}
|
261
|
-
@progress_bar.visible=false
|
262
|
-
@buttons.each{|b| b.set_enabled true}
|
263
|
-
if success
|
264
|
-
saved_to = save_to + '.avi'
|
265
|
-
if run_mplayer_after_done
|
266
|
-
run_smplayer_non_blocking saved_to, nil, '', false, false, true
|
267
|
-
else
|
268
|
-
if File.exist?(saved_to) && (File.size(saved_to).to_f/File.size(file_from) < 0.5) # less than 50% size is suspicious...indeed...check if exists for unit tests.
|
269
|
-
show_blocking_message_dialog("Warning: file size differs by more than 50%--it's possible that transcoding failed somehow")
|
270
|
-
end
|
271
|
-
show_in_explorer saved_to
|
272
|
-
PlayAudio.play(File.expand_path(File.dirname(__FILE__)) + "/../vendor/music.wav")
|
273
|
-
msg = "Done--you may now watch file\n #{saved_to}\n in VLC player (or possibly smplayer)"
|
274
|
-
puts msg # for being able to tell it's done on the command line
|
275
|
-
show_blocking_message_dialog msg
|
276
|
-
show_in_explorer saved_to # and again, just for kicks [?]
|
277
|
-
end
|
278
|
-
else
|
279
|
-
SwingHelpers.show_blocking_message_dialog "Failed--please examine console output and report back!\nAlso consult the documentation/troubleshooting file.", "Failed", JOptionPane::ERROR_MESSAGE
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
NonDvd = 'non dvd has no dvdid' # we need it for convenience, say you want to go through your indexed vids and convert them all?
|
284
|
-
|
285
|
-
# returns e:\, volume_name, dvd_id
|
286
|
-
# or full_path.mkv, filename, ''
|
287
|
-
def choose_dvd_drive_or_file force_choose_only_dvd_drive
|
288
|
-
opticals = DriveInfo.get_dvd_drives_as_openstruct
|
289
|
-
if @saved_opticals == opticals && @_choose_dvd_drive_or_file
|
290
|
-
# memoize...if disks haven't changed :)
|
291
|
-
return @_choose_dvd_drive_or_file
|
292
|
-
else
|
293
|
-
@saved_opticals = opticals # save currently mounted disk list, so we know if we should re-select later...
|
294
|
-
# is this ok for os x?
|
295
|
-
end
|
296
|
-
|
297
|
-
has_at_least_one_dvd_inserted = opticals.find{|d| d.VolumeName }
|
298
|
-
if !has_at_least_one_dvd_inserted && force_choose_only_dvd_drive
|
299
|
-
show_blocking_message_dialog 'insert a dvd first'
|
300
|
-
raise 'no dvd found'
|
301
|
-
end
|
302
|
-
names = opticals.map{|d| d.Name + "\\" + " (" + (d.VolumeName || 'Insert DVD to use') + ")"}
|
303
|
-
if !force_choose_only_dvd_drive && !has_at_least_one_dvd_inserted
|
304
|
-
names += ['No DVD mounted so choose Local File (or insert DVD, re-try)'] # LODO cannot read it...
|
305
|
-
used_local_file_option = true
|
306
|
-
end
|
307
|
-
|
308
|
-
count = 0
|
309
|
-
opticals.each{|d| count += 1 if d.VolumeName}
|
310
|
-
if count == 1 && !used_local_file_option
|
311
|
-
# just choose it if there's only one disk available..
|
312
|
-
p 'selecting only disk present in the various DVD drives'
|
313
|
-
selected_idx = opticals.index{|d| d.VolumeName}
|
314
|
-
unless selected_idx
|
315
|
-
show_blocking_message_dialog "Please insert a disk first"
|
316
|
-
raise 'inset disk'
|
317
|
-
end
|
318
|
-
|
319
|
-
else
|
320
|
-
dialog = get_disk_chooser_window names
|
321
|
-
selected_idx = dialog.go
|
322
|
-
end
|
323
|
-
|
324
|
-
if used_local_file_option
|
325
|
-
raise unless selected_idx == 0 # it was our only option...they must have selected it!
|
326
|
-
filename = new_existing_file_selector_and_select_file("Select yer previously grabbed from DVD file")
|
327
|
-
assert_ownership_dialog
|
328
|
-
return [filename, File.basename(filename), NonDvd]
|
329
|
-
else
|
330
|
-
disk = opticals[selected_idx]
|
331
|
-
out = show_non_blocking_message_dialog "calculating current disk's unique id...if this pauses more than 10s then clean your DVD..."
|
332
|
-
begin
|
333
|
-
dvd_id = DriveInfo.md5sum_disk(disk.MountPoint)
|
334
|
-
rescue Exception => e
|
335
|
-
show_blocking_message_dialog e.to_s # todo a bit ugly...
|
336
|
-
raise
|
337
|
-
ensure
|
338
|
-
out.dispose
|
339
|
-
end
|
340
|
-
@_choose_dvd_drive_or_file = [disk.MountPoint, opticals[selected_idx].VolumeName, dvd_id]
|
341
|
-
return @_choose_dvd_drive_or_file
|
342
|
-
end
|
343
|
-
end
|
344
|
-
|
345
|
-
def get_disk_chooser_window names
|
346
|
-
DropDownSelector.new(self, names, "Click to select DVD drive")
|
347
|
-
end
|
348
|
-
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|