content-editing-movie-player 0.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (273) hide show
  1. data/.gitmodules +3 -0
  2. data/.rvmrc +1 -0
  3. data/LICENSE.TXT +20 -0
  4. data/README.TXT +225 -0
  5. data/Rakefile +206 -0
  6. data/TODO +740 -0
  7. data/VERSION +1 -0
  8. data/_DO_NOT_RUN_IT_FROM_HERE_DOWNLOAD_THE_RELEASE_ZIP_FROM_SOURCEFORGE_INSTEAD +0 -0
  9. data/bin/sensible-cinema +60 -0
  10. data/bin/sensible-cinema-cli +161 -0
  11. data/business_ideas.txt +21 -0
  12. data/change_log_with_feature_list.txt +952 -0
  13. data/documentation/DOCUMENTATION_README.TXT +44 -0
  14. data/documentation/how_to_get_files_from_dvd.txt +30 -0
  15. data/documentation/is_it_legal_to_copy_dvds.txt +97 -0
  16. data/documentation/troubleshooting.txt +30 -0
  17. data/documentation/upconversion.txt +4 -0
  18. data/experimental_online_player_ocr_readme.txt +45 -0
  19. data/go +1 -0
  20. data/go.bat +2 -0
  21. data/go.sh +1 -0
  22. data/go_ocr_tracker.bat +1 -0
  23. data/goc +1 -0
  24. data/goc.bat +1 -0
  25. data/goc.sh +1 -0
  26. data/gpl-2.0.txt +339 -0
  27. data/gplv3.txt +219 -0
  28. data/history_and_related_works_list.txt +108 -0
  29. data/inventionzy_files/cone.png +0 -0
  30. data/inventionzy_files/md5s.txt +53 -0
  31. data/inventionzy_files/play_with_inserted_scene.bat +8 -0
  32. data/inventionzy_files/play_with_overlay.bat +24 -0
  33. data/inventionzy_files/transcript_mute_vlc.txt +117 -0
  34. data/legal_draft +23 -0
  35. data/lib/add_any_bundled_gems_to_load_path.rb +32 -0
  36. data/lib/auto_window_finder.rb +41 -0
  37. data/lib/blanker.rb +104 -0
  38. data/lib/check_installed_mac.rb +34 -0
  39. data/lib/convert_thirty_fps.rb +20 -0
  40. data/lib/edl_parser.rb +387 -0
  41. data/lib/eight_three.rb +28 -0
  42. data/lib/extract/dumpstream.bat +1 -0
  43. data/lib/extract/get_init.bat +3 -0
  44. data/lib/extract/pause_early.rb +13 -0
  45. data/lib/fake_blanker.rb +35 -0
  46. data/lib/frame_accurate.rb +3 -0
  47. data/lib/gui/base.rb +748 -0
  48. data/lib/gui/create-file.rb +24 -0
  49. data/lib/gui/create.rb +581 -0
  50. data/lib/gui/dependencies.rb +219 -0
  51. data/lib/gui/normal.rb +123 -0
  52. data/lib/gui/upconvert.rb +284 -0
  53. data/lib/keyboard_input.rb +60 -0
  54. data/lib/media_info_parser.rb +27 -0
  55. data/lib/mouse_forever.rb +19 -0
  56. data/lib/movie_hasher.rb +27 -0
  57. data/lib/mplayer_edl.rb +42 -0
  58. data/lib/muter.rb +87 -0
  59. data/lib/ocr.rb +125 -0
  60. data/lib/ocr_seed/netflix_b9.bmp +0 -0
  61. data/lib/overlayer.rb +373 -0
  62. data/lib/screen_tracker.rb +269 -0
  63. data/lib/subtitle_profanity_finder.rb +294 -0
  64. data/lib/vlc_programmer.rb +112 -0
  65. data/lib/zoom_player_max_edl.rb +50 -0
  66. data/never_do +40 -0
  67. data/notes_for_potential_developers.txt +46 -0
  68. data/preamble +17 -0
  69. data/roadmap_possibilities +12 -0
  70. data/spec/arse.srt +41 -0
  71. data/spec/auto_window_finder.spec.rb +65 -0
  72. data/spec/bad_beginning.srt +3778 -0
  73. data/spec/blanker.spec.rb +60 -0
  74. data/spec/common.rb +81 -0
  75. data/spec/convert_image.rb +25 -0
  76. data/spec/deity_end.srt +11 -0
  77. data/spec/dragon.srt +34 -0
  78. data/spec/edl_parser.spec.rb +270 -0
  79. data/spec/frame_accurate.spec.rb +71 -0
  80. data/spec/keyboard_input.spec.rb +73 -0
  81. data/spec/media_info_parser.spec.rb +29 -0
  82. data/spec/mplayer_edl.spec.rb +100 -0
  83. data/spec/muter.spec.rb +50 -0
  84. data/spec/notes +4996 -0
  85. data/spec/ocr.spec.rb +119 -0
  86. data/spec/overlayer.spec.rb +440 -0
  87. data/spec/screen_tracker.spec.rb +318 -0
  88. data/spec/sensible_cinema_gui.spec.rb +452 -0
  89. data/spec/subtitle_profanity_finder.spec.rb +224 -0
  90. data/spec/test_yaml.yml +4 -0
  91. data/spec/tsmuxer.output +33 -0
  92. data/spec/vlc_programmer.spec.rb +124 -0
  93. data/spec/youtube_edl.spec.rb +28 -0
  94. data/spec/zoom_player_max_edl.spec.rb +29 -0
  95. data/template_bats/README_DISTRO.TXT +8 -0
  96. data/template_bats/RUN SENSIBLE CINEMA CLICK HERE WINDOWS.bat +25 -0
  97. data/template_bats/_DO_NOT_RUN_IT_FROM_HERE_DOWNLOAD_THE_RELEASE_ZIP_FROM_SOURCEFORGE_INSTEAD +0 -0
  98. data/template_bats/mac/RUN SENSIBLE CINEMA CLICK HERE.command +5 -0
  99. data/template_bats/mac/advanced--create or edit sensible cinema edit list files.command +3 -0
  100. data/template_bats/mac/advanced--run-upconverting-video-player.command +3 -0
  101. data/template_bats/pc/advanced--create or edit sensible cinema edit list files.bat +2 -0
  102. data/template_bats/pc/advanced--run-upconverting-video-player.bat +2 -0
  103. data/todo.build_library.txt +11 -0
  104. data/todo.inventionzy.txt +162 -0
  105. data/todo.open_edl_list_org.txt +169 -0
  106. data/todo.propaganda +107 -0
  107. data/todo.subtitle +17 -0
  108. data/todo.upconvert +53 -0
  109. data/upconvert.bat +1 -0
  110. data/upconvert_from_screen/go_upscaling.bat +12 -0
  111. data/upconvert_from_screen/go_upscaling_works +0 -0
  112. data/upconvert_from_screen/old/latest2/combine_video.avs +23 -0
  113. data/upconvert_from_screen/old/latest2/go_no_upscaling.bat +1 -0
  114. data/upconvert_from_screen/old/latest2/go_upscaling.bat +12 -0
  115. data/upconvert_from_screen/old/latest2/push2.GRF +0 -0
  116. data/upconvert_from_screen/old/latest2/push3.grf +0 -0
  117. data/upconvert_from_screen/old/latest2/setup_capture_coords.rb +27 -0
  118. data/upconvert_from_screen/old/latest2/setup_directshow_filter_params.rb +29 -0
  119. data/upconvert_from_screen/old/latest2/upconvert_from_screen_me2.avs +19 -0
  120. data/upconvert_from_screen/old/latest_now_possibly_oudated/push2.GRF +0 -0
  121. data/upconvert_from_screen/old/latest_now_possibly_oudated/upconvert_from_screen_me2.avs +18 -0
  122. data/upconvert_from_screen/old/position_window.png +0 -0
  123. data/upconvert_from_screen/old/push_source_desktop.GRF +0 -0
  124. data/upconvert_from_screen/old/record_screen/record.bat +2 -0
  125. data/upconvert_from_screen/old/upconvert_from_screen.avs +21 -0
  126. data/upconvert_from_screen/old/upconvert_from_screen_me.avs +21 -0
  127. data/upconvert_from_screen/old/upconvert_from_screen_me2.avs +3 -0
  128. data/upconvert_from_screen/old/upconvert_from_screen_me_push_source.avs +3 -0
  129. data/upconvert_from_screen/old/uscreen.GRF +0 -0
  130. data/upconvert_from_screen/old/uscreen_me.GRF +0 -0
  131. data/upconvert_from_screen/push3.grf +0 -0
  132. data/upconvert_from_screen/upconvert_from_screen_me2.avs +19 -0
  133. data/vendor/movie-content-editor-read-only/.metadata/.lock +0 -0
  134. data/vendor/movie-content-editor-read-only/.metadata/.mylyn/.tasks.xml.zip +0 -0
  135. data/vendor/movie-content-editor-read-only/.metadata/.mylyn/repositories.xml.zip +0 -0
  136. data/vendor/movie-content-editor-read-only/.metadata/.mylyn/tasks.xml.zip +0 -0
  137. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version +1 -0
  138. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index +0 -0
  139. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version +1 -0
  140. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree +0 -0
  141. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources +0 -0
  142. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs +3 -0
  143. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs +14 -0
  144. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.context.core.prefs +3 -0
  145. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs +5 -0
  146. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs +3 -0
  147. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache +0 -0
  148. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat +0 -0
  149. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml +2 -0
  150. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml +2 -0
  151. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml +10 -0
  152. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.ui.ide/dialog_settings.xml +11 -0
  153. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.ui.intro/dialog_settings.xml +4 -0
  154. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.ui.workbench/dialog_settings.xml +10 -0
  155. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml +232 -0
  156. data/vendor/movie-content-editor-read-only/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml +4 -0
  157. data/vendor/movie-content-editor-read-only/.metadata/version.ini +1 -0
  158. data/vendor/movie-content-editor-read-only/.project +17 -0
  159. data/vendor/movie-content-editor-read-only/.pydevproject +11 -0
  160. data/vendor/movie-content-editor-read-only/.settings/org.eclipse.core.resources.prefs +6 -0
  161. data/vendor/movie-content-editor-read-only/SubIt.py +171 -0
  162. data/vendor/movie-content-editor-read-only/VLCMacVideo.py +257 -0
  163. data/vendor/movie-content-editor-read-only/VideoMac.ui +102 -0
  164. data/vendor/movie-content-editor-read-only/badwords.txt +4 -0
  165. data/vendor/movie-content-editor-read-only/blank.srt +4 -0
  166. data/vendor/movie-content-editor-read-only/edit.py +197 -0
  167. data/vendor/movie-content-editor-read-only/mergeCommands.py +73 -0
  168. data/vendor/movie-content-editor-read-only/mute.txt +5 -0
  169. data/vendor/movie-content-editor-read-only/panda.srt +4235 -0
  170. data/vendor/movie-content-editor-read-only/panda_custom.txt +3 -0
  171. data/vendor/movie-content-editor-read-only/panda_edit.srt +4235 -0
  172. data/vendor/movie-content-editor-read-only/subtitle.py +90 -0
  173. data/vendor/movie-content-editor-read-only/vlc.py +5579 -0
  174. data/vendor/movie-content-editor-read-only/vlcwidget.py +154 -0
  175. data/vendor/mplayer_patches/how_to_doze.bat +6 -0
  176. data/vendor/mplayer_patches/port_dir/PortIndex.quick +2 -0
  177. data/vendor/mplayer_patches/port_dir/how_to +20 -0
  178. data/vendor/mplayer_patches/port_dir/multimedia/mplayer-edl/Portfile +285 -0
  179. data/vendor/mplayer_patches/port_dir/multimedia/mplayer-edl/files/configure.x11.patch +20 -0
  180. data/vendor/mplayer_patches/port_dir/multimedia/mplayer-edl/files/llvm-gcc-workaround.patch +11 -0
  181. data/vendor/mplayer_patches/port_dir/multimedia/rdp-projects/Portfile +43 -0
  182. data/vendor/mplayer_patches/port_dir_is_for_mac +0 -0
  183. data/www/content_editor.html +92 -0
  184. data/www/index.html +47 -0
  185. data/www/upconverting_movie_player.html +62 -0
  186. data/www/video reel.jpg +0 -0
  187. data/www/youtube_edl/.htaccess +44 -0
  188. data/www/youtube_edl/control_youtube.rhtml +141 -0
  189. data/www/youtube_edl/dispatch.fcgi +25 -0
  190. data/www/youtube_edl/render_edited.rb +25 -0
  191. data/www/youtube_edl/server_this_dir.rb +6 -0
  192. data/www/youtube_edl/todo +23 -0
  193. data/www/zoomplayer_max.png +0 -0
  194. data/zamples/edit_decision_lists/dvds/Harry Potter 2 chamber of secrets.txt +22 -0
  195. data/zamples/edit_decision_lists/dvds/aa_example_delete_list_that_has_no_cuts_in_it.txt +10 -0
  196. data/zamples/edit_decision_lists/dvds/aladdin.txt +30 -0
  197. data/zamples/edit_decision_lists/dvds/bambi.txt +17 -0
  198. data/zamples/edit_decision_lists/dvds/big_buck_bunny_dvd.txt +23 -0
  199. data/zamples/edit_decision_lists/dvds/bob the builder pets in a pickle.txt +10 -0
  200. data/zamples/edit_decision_lists/dvds/bobs_big_plan.txt +10 -0
  201. data/zamples/edit_decision_lists/dvds/cars_2.txt +26 -0
  202. data/zamples/edit_decision_lists/dvds/cars_disney.txt +40 -0
  203. data/zamples/edit_decision_lists/dvds/condor_man_widescreen.txt +22 -0
  204. data/zamples/edit_decision_lists/dvds/cool runnings.txt +53 -0
  205. data/zamples/edit_decision_lists/dvds/court_jester.txt +24 -0
  206. data/zamples/edit_decision_lists/dvds/edls_being_edited/amazing_grace.txt +49 -0
  207. data/zamples/edit_decision_lists/dvds/edls_being_edited/father_goose.txt +41 -0
  208. data/zamples/edit_decision_lists/dvds/edls_being_edited/harry_potter_and_the_goblet_of_fire.txt +45 -0
  209. data/zamples/edit_decision_lists/dvds/edls_being_edited/hugo.txt +31 -0
  210. data/zamples/edit_decision_lists/dvds/edls_being_edited/making_marriage_work.txt +15 -0
  211. data/zamples/edit_decision_lists/dvds/edls_being_edited/national_treasure.txt +26 -0
  212. data/zamples/edit_decision_lists/dvds/edls_being_edited/percy_jackson_lightening_thief.txt +40 -0
  213. data/zamples/edit_decision_lists/dvds/edls_being_edited/percy_jackson_lightening_thief_mute_scary.txt +23 -0
  214. data/zamples/edit_decision_lists/dvds/edls_being_edited/prince_of_egypt.txt +28 -0
  215. data/zamples/edit_decision_lists/dvds/edls_being_edited/puss_in_boots.txt +33 -0
  216. data/zamples/edit_decision_lists/dvds/edls_being_edited/ratatouille.txt +35 -0
  217. data/zamples/edit_decision_lists/dvds/edls_being_edited/rio.txt +24 -0
  218. data/zamples/edit_decision_lists/dvds/edls_being_edited/test_delete_list_for_experimenting_with.txt +10 -0
  219. data/zamples/edit_decision_lists/dvds/edls_being_edited/the_explorers.txt +49 -0
  220. data/zamples/edit_decision_lists/dvds/finding_neverland.txt +32 -0
  221. data/zamples/edit_decision_lists/dvds/flight_of_the_navigator.txt +40 -0
  222. data/zamples/edit_decision_lists/dvds/happiest baby on the block.txt +9 -0
  223. data/zamples/edit_decision_lists/dvds/harry_potter_3_prisoner_of_azkaban.txt +37 -0
  224. data/zamples/edit_decision_lists/dvds/hitchhiker's_guide_to_the_galaxy.txt +32 -0
  225. data/zamples/edit_decision_lists/dvds/how_to_train_your_dragon.txt +25 -0
  226. data/zamples/edit_decision_lists/dvds/if_a_man_answers.txt +43 -0
  227. data/zamples/edit_decision_lists/dvds/innerspace.txt +77 -0
  228. data/zamples/edit_decision_lists/dvds/iq.txt +32 -0
  229. data/zamples/edit_decision_lists/dvds/king_of_kings.txt +28 -0
  230. data/zamples/edit_decision_lists/dvds/kung_fu_panda_1.txt +17 -0
  231. data/zamples/edit_decision_lists/dvds/legend_of_the_guardians_the_owls_of_gahoole.txt +18 -0
  232. data/zamples/edit_decision_lists/dvds/monsters_vs_aliens.txt +41 -0
  233. data/zamples/edit_decision_lists/dvds/muppet_treasure_island.txt +21 -0
  234. data/zamples/edit_decision_lists/dvds/nanny_mcphee.txt +31 -0
  235. data/zamples/edit_decision_lists/dvds/narnia_voyage_of_the_dawn_treader.txt +16 -0
  236. data/zamples/edit_decision_lists/dvds/pack_jackson_wedding_2007-03-03.txt +31 -0
  237. data/zamples/edit_decision_lists/dvds/peter_pan.txt +29 -0
  238. data/zamples/edit_decision_lists/dvds/remember_the_titans.txt +35 -0
  239. data/zamples/edit_decision_lists/dvds/sintel_open_source_blender_ntsc_dvd.txt +22 -0
  240. data/zamples/edit_decision_lists/dvds/snow_white_and_the_7_dwarfs_1937.txt +19 -0
  241. data/zamples/edit_decision_lists/dvds/speed_racer.txt +47 -0
  242. data/zamples/edit_decision_lists/dvds/tangled.txt +21 -0
  243. data/zamples/edit_decision_lists/dvds/tron_legacy.txt +29 -0
  244. data/zamples/edit_decision_lists/dvds/turn_around_alma_younger.txt +17 -0
  245. data/zamples/edit_decision_lists/files/conference_music_video.txt +10 -0
  246. data/zamples/edit_decision_lists/netflix_instant/avatar-last-air-bender-movie.txt +13 -0
  247. data/zamples/edit_decision_lists/netflix_instant/avatar-last-airbender-series.txt +1 -0
  248. data/zamples/edit_decision_lists/netflix_instant/greatest_story_ever_told_netflix.txt +10 -0
  249. data/zamples/edit_decision_lists/netflix_instant/wrinkle-in-time.txt +23 -0
  250. data/zamples/edit_decision_lists/notes_on_movies_without_edls_yet/tron.txt +10 -0
  251. data/zamples/edit_decision_lists/old_not_yet_updated/dvds/White Christmas.txt +15 -0
  252. data/zamples/edit_decision_lists/old_not_yet_updated/dvds/all_dogs_go_to_heaven.txt +9 -0
  253. data/zamples/edit_decision_lists/old_not_yet_updated/dvds/cars_disney.txt +24 -0
  254. data/zamples/edit_decision_lists/old_not_yet_updated/dvds/happy_feet.txt +12 -0
  255. data/zamples/edit_decision_lists/old_not_yet_updated/dvds/labyrinth.txt +17 -0
  256. data/zamples/edit_decision_lists/old_not_yet_updated/dvds/star_trek_generations_hulu.txt +8 -0
  257. data/zamples/edit_decision_lists/old_not_yet_updated/example_edit_decision_list.txt +14 -0
  258. data/zamples/edit_decision_lists/old_not_yet_updated/youtube/gummy_bear_song_youtube.txt +9 -0
  259. data/zamples/edit_decision_lists/youtube/demo_mutes.txt +12 -0
  260. data/zamples/edit_decision_lists/youtube/nuki_song_youtube.txt +14 -0
  261. data/zamples/edit_decision_lists/youtube/nuki_song_youtube_pointer.txt +3 -0
  262. data/zamples/players/how_to_create_more_players.txt +24 -0
  263. data/zamples/players/hulu/total_length_over_an_hour.txt +25 -0
  264. data/zamples/players/netflix/netflix_firefox_non_maximized.txt +25 -0
  265. data/zamples/players/vlc/full_screened_total_length_over_an_hour.txt +27 -0
  266. data/zamples/players/vlc/windowed_total_length_over_an_hour.txt +26 -0
  267. data/zamples/players/vlc/windowed_total_length_under_an_hour.txt +22 -0
  268. data/zamples/players/youtube/full_screened_1024x768.txt +20 -0
  269. data/zamples/players/youtube/full_screened_1152x864.txt +20 -0
  270. data/zamples/players/youtube/full_screened_1680x1050.txt +20 -0
  271. data/zamples/players/youtube/normal_in_youtube.com.chrome.txt +23 -0
  272. data/zamples/players/youtube/note_these_assume_less_than_10_minutes_length.txt +2 -0
  273. metadata +483 -0
@@ -0,0 +1,24 @@
1
+ module SensibleSwing
2
+
3
+ class MainWindow
4
+
5
+ def sanity_check_file filename
6
+ check_for_ffmpeg_installed
7
+ out = `ffmpeg -i #{filename} 2>&1`
8
+ print out
9
+ unless out =~ /Duration.*start: 0.00/ || out =~ /Duration.*start: 600/
10
+ show_blocking_message_dialog 'file\'s typically have the movie start at zero, this one doesn\'t? Please report.' + out
11
+ raise # give up, as otherwise we're 0.3 off, I think...hmm...
12
+ end
13
+ if filename =~ /\.mkv/i
14
+ 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 did come from makemkv"
15
+ else
16
+ if filename !~ /\.(ts|mpg|mpeg)$/i
17
+ show_blocking_message_dialog("warning: file #{filename} is not a .mpg or .ts file--conversion may not work properly all the way [produce a truncated file], but we can try it if you want...")
18
+ end
19
+ end
20
+ end
21
+
22
+
23
+ end
24
+ end
@@ -0,0 +1,581 @@
1
+ module SensibleSwing
2
+
3
+ class MainWindow
4
+
5
+ def open_edl_file_when_done thred, filename
6
+ Thread.new {
7
+ thred.join
8
+ open_file_to_edit_it filename
9
+ }
10
+ end
11
+
12
+ def setup_create_buttons
13
+ # only create mode needs this uh guess
14
+ EdlParser.on_any_file_changed_single_cached_thread { DriveInfo.notify_all_drive_blocks_that_change_has_occured }
15
+
16
+ add_text_line 'Normal playback Options:'
17
+ new_jbutton("Display Standard Playback Options") do
18
+ window = new_child_window
19
+ window.setup_normal_buttons
20
+ end
21
+
22
+ add_text_line 'Create: Edit Decision List File Options:'
23
+
24
+ @open_current = new_jbutton("Edit/Open EDL for currently inserted DVD") do
25
+ drive, volume_name, dvd_id = choose_dvd_drive_or_file true # require a real DVD disk :)
26
+ edit_list_path = EdlParser.single_edit_list_matches_dvd(dvd_id)
27
+ if edit_list_path
28
+ open_file_to_edit_it edit_list_path
29
+ else
30
+ show_blocking_message_dialog "EDL for this dvd doesn't exist yet, maybe create it first? #{volume_name}"
31
+ end
32
+ end
33
+
34
+ create_new_edl_for_current_dvd_text = "Create new Edit List for currently inserted DVD"
35
+ @create_new_edl_for_current_dvd = new_jbutton(create_new_edl_for_current_dvd_text,
36
+ "If your DVD doesn't have an EDL created for it, this will be your first step--create an EDL file for it.")
37
+ @create_new_edl_for_current_dvd.on_clicked do
38
+ drive, volume_name, dvd_id = choose_dvd_drive_or_file true # require a real DVD disk :)
39
+ edit_list_path = EdlParser.single_edit_list_matches_dvd(dvd_id, true)
40
+ if edit_list_path
41
+ if show_select_buttons_prompt('It appears that one or more EDL\'s exist for this DVD already--create another?', {}) == :no
42
+ raise 'aborted'
43
+ end
44
+ end
45
+ create_brand_new_dvd_edl
46
+ show_blocking_message_dialog "Now that it's created, you can add some entries by hand, or try downloading a subtitle\nfile and parsing it to look for profanities\nif it finds any, then copy and paste them into the file you just created"
47
+ end
48
+
49
+ add_callback_for_dvd_edl_present { |disk_available, edl_available|
50
+ #TODO rdp file buttons
51
+ @open_current.set_enabled edl_available
52
+ #@create_new_edl_for_current_dvd.set_enabled disk_available
53
+ if edl_available
54
+ @create_new_edl_for_current_dvd.text= create_new_edl_for_current_dvd_text + " [yours already has one!]"
55
+ else
56
+ if disk_available
57
+ @create_new_edl_for_current_dvd.text= create_new_edl_for_current_dvd_text + " [it doesn't have one yet!]"
58
+ else
59
+ @create_new_edl_for_current_dvd.text= create_new_edl_for_current_dvd_text + " [no disk inserted!]"
60
+ end
61
+ end
62
+ }
63
+
64
+ @parse_srt = new_jbutton("Scan a subtitle file to detect profanity timestamps automatically" )
65
+ @parse_srt.tool_tip = <<-EOL
66
+ You can download a .srt file and use it to programmatically search for the location of various profanities.
67
+ Basically download it from opensubtitles.org
68
+ (or google search for something like your equivalent for "prince of egypt subtitles 1cd en",
69
+ (for opensubtitles.org enter dvd title in the search box, click on a result, click one from the list with an English flag,
70
+ then choose 'Download(zip)', then unzip the file)
71
+ NB that you'll want/need to *carefully* double check your subtitle file for accuracy. Here's how:
72
+ Now carefully compare a beginning timestamp in it with the actual words in the .srt file
73
+ with the actual DVD.
74
+ (see the button "Watch DVD unedited (realtime mplayer)")
75
+ (smplayer can kind of do it, too, play it, hit the 'o' button to display
76
+ the OSD timestamp, then go to just before the verbiage,
77
+ and hit the '.' key until a subtitle very first appears.
78
+ Next convert that number to 29.97 fps (using the button for that).
79
+ EOL
80
+
81
+ @parse_srt.on_clicked do
82
+
83
+ srt_filename = new_existing_file_selector_and_select_file("Pick srt file to scan for profanities [may need to download .srt file first]:", File.expand_path('~'))
84
+ if(srt_filename =~ /utf16/) # from subrip sometimes
85
+ show_blocking_message_dialog "warning--filename #{srt_filename} may be in utf16, which we don't yet parse"
86
+ end
87
+ if srt_filename =~ /\.sub$/i
88
+ show_blocking_message_dialog "warning--input file has to be in SubRip [.srt] format, and yours might be in .sub format, which is incompatible"
89
+ end
90
+ # TODO nuke, or do I use them for the 600.0 stuff?
91
+ 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")
92
+ 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")
93
+
94
+ euphemized_entries = euphemized_filename = nil
95
+ with_autoclose_message("parsing srt file... #{File.basename srt_filename}") do
96
+ parsed_profanities, euphemized_entries = SubtitleProfanityFinder.edl_output_from_string File.read(srt_filename), {}, 0, 0, 0, 0, 3000, 3000
97
+ write_subs_to_file euphemized_filename = get_temp_file_name('euphemized.subtitles.srt.txt'), euphemized_entries
98
+ end
99
+
100
+ if show_select_buttons_prompt("Sometimes subtitle files' time signatures don't match precisely with the video.\nWould you like to enter some information to allow it to synchronize the timestamps?\n (on the final pass you should do this, even if it already matches well, for future information' sake)") == :yes
101
+
102
+ if show_select_buttons_prompt("Would you like to start playing the movie in mplayer, to be able to search for subtitle timestamp times [you probably do...]?\n") == :yes
103
+ show_blocking_message_dialog "ok--use the arrow keys and pgdown/pgup to search/scan, and then '.' to pinpoint a precise subtitle start time within mplayer.\nYou will be prompted for a beginning and starting timestamp time to search for."
104
+ play_dvd_smplayer_unedited true
105
+ end
106
+
107
+ open_file_to_edit_it euphemized_filename
108
+ sleep 0.5 # let it open in TextEdit/Notepad first...
109
+ bring_to_front
110
+
111
+ all_entries = euphemized_entries # rename :)
112
+ start_entry = all_entries[0]
113
+ start_text = start_entry.single_line_text
114
+ start_srt_time = start_entry.beginning_time
115
+ human_start = EdlParser.translate_time_to_human_readable(start_srt_time)
116
+ start_movie_sig = get_user_input_with_persistence("Enter beginning timestamp within the movie itself for when the subtitle \"#{start_text}\"\nfirst frame the subtitle appears on the on screen display (possibly near #{human_start})", start_text)
117
+ start_movie_time = EdlParser.translate_string_to_seconds start_movie_sig
118
+ if(show_select_buttons_prompt 'Would you like to select an ending timestamp at the end or 3/4 mark of the movie [end can be a spoiler at times]?', :yes => 'very end of movie', :no => '3/4 of the way into movie') == :yes
119
+ end_entry = all_entries[-1]
120
+ else
121
+ end_entry = all_entries[all_entries.length*0.75]
122
+ end
123
+ end_text = end_entry.single_line_text
124
+ end_srt_time = end_entry.beginning_time
125
+ human_end = EdlParser.translate_time_to_human_readable(end_srt_time)
126
+ end_movie_sig = get_user_input_with_persistence("Enter beginning timestamp within the movie itself for when the subtitle ##{end_entry.index_number}\n\"#{end_text}\"\nfirst appears (possibly near #{human_end}).\nYou can find it by searching to near that time in the movie [pgup+pgdown, then arrow keys], find some subtitle, then find where that subtitle is within the .srt file to see where it lies\nrelative to the one you are interested in\nthen seek relative to that to find the one you want.", end_text)
127
+ end_movie_time = EdlParser.translate_string_to_seconds end_movie_sig
128
+ else
129
+ # the case they know it already matches
130
+ start_srt_time = 0
131
+ start_movie_time = 0
132
+ end_srt_time = 3000
133
+ end_movie_time = 3000
134
+ end
135
+
136
+ parsed_profanities, euphemized_synchronized_entries = nil
137
+ extra_profanity_hash = {}
138
+ if LocalStorage['prompt_obscure_options']
139
+ for entry in get_user_input_with_persistence("enter any 'extra' words to search for, like badword1,badword2 if any", srt_filename).split(',')
140
+ extra_profanity_hash[entry] = entry
141
+ end
142
+ end
143
+ with_autoclose_message("parsing srt file... #{File.basename srt_filename}") do
144
+ parsed_profanities, euphemized_synchronized_entries = SubtitleProfanityFinder.edl_output_from_string File.read(srt_filename), extra_profanity_hash, add_to_beginning.to_f, add_to_end.to_f, start_srt_time, start_movie_time, end_srt_time, end_movie_time
145
+ end
146
+
147
+ filename = get_temp_file_name('partial.edl.txt')
148
+ out = "# copy and paste these into your \"mute\" section of A SEPARATE EDL already created with the other buttons, for lines you deem them mutable\n" + parsed_profanities
149
+ if end_srt_time != 3000
150
+ out += %!\n\n#Also add these lines at the bottom of the EDL (for later coordination):\n"beginning_subtitle" => ["#{start_text}", "#{start_movie_sig}", #{start_entry.index_number}],! +
151
+ %!\n"ending_subtitle_entry" => ["#{end_text}", "#{end_movie_sig}", #{end_entry.index_number}],!
152
+ end
153
+ middle_entry = euphemized_synchronized_entries[euphemized_synchronized_entries.length*0.5]
154
+ show_non_blocking_message_dialog "You may want to double check if the math worked out.\n\"#{middle_entry.single_line_text}\" (##{middle_entry.index_number})\nshould appear at #{EdlParser.translate_time_to_human_readable middle_entry.beginning_time}\nYou can go and check it!\nIf it's off much you may want to try this whole process again\n with a different other .srt file"
155
+ File.write filename, out
156
+ open_file_to_edit_it filename
157
+ sleep 1 # let it open
158
+
159
+ if LocalStorage['prompt_obscure_options']
160
+ if show_select_buttons_prompt("Would you like to write out a synchronized, euphemized .srt file [useful if you want to watch the movie with sanitized subtitles later]\nyou probably don't?") == :yes
161
+ out_file = new_nonexisting_filechooser_and_go("Select filename to write to", File.dirname(srt_filename), File.basename(srt_filename)[0..-5] + ".euphemized.srt")
162
+ write_subs_to_file out_file, euphemized_synchronized_entries
163
+ show_in_explorer out_file
164
+ end
165
+ end
166
+
167
+ end
168
+
169
+ add_text_line 'Create: Advanced View Edited Options'
170
+
171
+ @mplayer_edl_with_subs = new_jbutton( "Watch DVD edited (realtime) (with mplayer, subtitles)") do
172
+ watch_dvd_edited_realtime_mplayer true
173
+ end
174
+
175
+ @mplayer_edl_with_subs.tool_tip="This watches it in mplayer, which has access to its console output, and also includes subtitles."
176
+
177
+ @mplayer_partial = new_jbutton( "Watch DVD edited (realtime) (mplayer) based on timestamp") do
178
+ times = get_start_stop_times_strings
179
+ times.map!{|t| EdlParser.translate_string_to_seconds t}
180
+ start_time = times[0]
181
+ end_time = times[1]
182
+ extra_mplayer_commands = ["-ss #{start_time}", "-endpos #{end_time - start_time}"]
183
+ play_smplayer_edl_non_blocking nil, extra_mplayer_commands, true, false, add_end = 0.0, add_begin = 0.0 # create mode => aggressive
184
+ end
185
+
186
+ @mplayer_partial.tool_tip="this can play just a specific portion of your film, like from second 30 to 35, for testing."
187
+
188
+ new_jbutton("Display mplayer keyboard commands/howto/instructions") do
189
+ show_mplayer_instructions
190
+ end
191
+
192
+ add_text_line "Create: Watch Unedited Options:"
193
+
194
+ @play_smplayer = new_jbutton( "Watch DVD unedited (realtime smplayer)")
195
+ @play_smplayer.tool_tip = <<-EOL
196
+ This will play the DVD unedited within smplayer.
197
+ 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
198
+ i.e. if it just plays a single preview title or what not, and not the main title, you need to change this value.
199
+ This is useful if you want to just kind of watch the movie to enjoy it, and look for scenes to cut out.
200
+ You can use the built-in OSD (on-screen-display) to see what time frame the questionable scenes are at
201
+ (type "o" to toggle it). However, just realize that the OSD is in 30 fps, and our time stamps are all in 29.97
202
+ fps, so you'll need to convert it (the convert timestamp button) to be able to use it in a file.
203
+ NB That you can get the mplayer keyboard control instructions with the show instructions button.
204
+ EOL
205
+ @play_smplayer.on_clicked {
206
+ play_dvd_smplayer_unedited false
207
+ }
208
+
209
+ add_text_line "Less commonly used Edit options:"
210
+
211
+ new_jbutton("Create new Edit List (for netflix instant or movie file)") do # LODO VIDEO_TS here too?
212
+ create_new_for_file_or_netflix
213
+ end
214
+
215
+ new_jbutton("Show more (rarely used) buttons/options") do
216
+ child = new_child_window
217
+ child.show_rarely_used_buttons
218
+ end
219
+
220
+ end
221
+
222
+ def write_subs_to_file out_file, euphemized_synchronized_entries
223
+ File.open(out_file, 'w') do |f|
224
+ euphemized_synchronized_entries.each_with_index{|entry, idx|
225
+ beginning_time = EdlParser.translate_time_to_human_readable(entry.beginning_time).gsub('.',',')
226
+ ending_time = EdlParser.translate_time_to_human_readable(entry.ending_time).gsub('.',',')
227
+ f.puts entry.index_number
228
+ f.puts "#{beginning_time} --> #{ending_time}"
229
+ f.puts entry.text
230
+ f.puts ''
231
+ }
232
+ end
233
+ end
234
+
235
+ def show_rarely_used_buttons
236
+ if we_are_in_developer_mode?
237
+ @reload = new_jbutton("[programmer mode] reload bin/sensible-cinema code") do
238
+ for file in Dir[__DIR__ + '/*.rb']
239
+ p file
240
+ eval(File.read(file), TOPLEVEL_BINDING, file)
241
+ end
242
+ end
243
+ end
244
+
245
+ @display_dvd_info = new_jbutton( "Display information about current DVD (ID, timing, etc.)" )
246
+ @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."
247
+ @display_dvd_info.on_clicked {
248
+ Thread.new {
249
+ out_hashes, title_lengths = get_disk_info
250
+ out_string = out_hashes.map{|name, value| name.inspect + ' => ' + value.inspect + ','}.join("\n") + "\n" + title_lengths.join("\n")
251
+ out_string += %!\n"timestamps_relative_to" => ["dvd_start_offset","29.97"],! # since they're all this way currently
252
+ filename = get_temp_file_name('disk_info.txt')
253
+ File.write filename, out_string
254
+ open_file_to_edit_it filename
255
+ out_string # for unit tests :) TODO
256
+ }
257
+ }
258
+
259
+ @convert_seconds_to_ts = new_jbutton( "Convert 3600.0 <-> 1:00:00 style timestamps" )
260
+ @convert_seconds_to_ts.on_clicked {
261
+ input = get_user_input("Enter \"from\" timestamp, like 3600 or 1:40:00:", "1:00:00.1 or 3600.1")
262
+ while(input)
263
+ if input =~ /:/
264
+ output = EdlParser.translate_string_to_seconds input
265
+ output = "%.02f" % output # so they know we're not rounding for example 6.10 not 6.1
266
+ else
267
+ output = EdlParser.translate_time_to_human_readable input.to_f, true
268
+ end
269
+ input = show_copy_pastable_string("Converted:", output)
270
+ end
271
+ }
272
+
273
+ @convert_timestamp = new_jbutton( "Convert timestamp from DVD player time to EDL time (30->29.97 fps)" )
274
+ @convert_timestamp.tool_tip=<<-EOL
275
+ Our EDL's assume 29.97 fps (which is what a DVD actually has). Unfortunately most hardware or commercial DVD players
276
+ think that the DVD is 30 fps, which means that if you use them for timestamps for your EDL's,
277
+ you will be slightly off (at the end of a 2 hour film, by 8 seconds). So all your edits will be wrong.
278
+ How to fix: convert your times from "DVD player" time to "EDL accurate" time by using this button.
279
+ This is necessary for all hardware DVD player timestamps, PowerDVD player (software), Windows Media Player (playing a DVD),
280
+ and mplayer's "on screen display" DVD timestamps.
281
+ It is not necessary for smplayer timestamps (or mplayer's "V: 3600" in the command line), which are already 29.97.
282
+ smplayer's on-screen-display (the 'o' key) is accurate (and doesn't suffer from MPEG timestamps resets midway through)
283
+ but is 30 fps, so timestamps would need to be converted.
284
+ 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.
285
+ 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.
286
+ Mplayers "V: 3600" is usually right on (29.97 fps), however.
287
+ EOL
288
+ @convert_timestamp.on_clicked {
289
+ thirty_fps = get_user_input("Enter your DVD/hardware (30 fps) timestamp, I'll convert it to 29.97 (usable in EDL's):", "1:00:00.1")
290
+ thirty_fps_in_seconds = EdlParser.translate_string_to_seconds thirty_fps
291
+ twenty_nine_seven_fps = ConvertThirtyFps.from_thirty(thirty_fps_in_seconds)
292
+ human_twenty_nine_seven = EdlParser.translate_time_to_human_readable twenty_nine_seven_fps, true
293
+ show_copy_pastable_string("Sensible cinema usable value (29.97 fps) for #{thirty_fps} would be: ", human_twenty_nine_seven)
294
+ }
295
+
296
+ @create_dot_edl = new_jbutton( "Create a side-by-side moviefilename.edl file [XBMC etc.]")
297
+ @create_dot_edl.tool_tip = <<-EOL
298
+ Creates a moviefilename.edl file (corresponding to some moviefilename.some_ext file already existing)
299
+ XBMC/smplayer (smplayer can be used by WMC plugins, etc.) "automagically detect",
300
+ if it exists, and automatically use it .edl to show that file edited played back.
301
+ If you use smplayer, note that you'll need to download the "lord mulder mplayer"
302
+ version (which includes an updated version of mplayer that fixes some bugs in EDL playback)
303
+ EOL
304
+ @create_dot_edl.on_clicked {
305
+ show_blocking_message_dialog "Warning: With XBMC you'll need at least Eden v11.0 for mutes to work at all"
306
+ choose_file_and_edl_and_create_sxs_or_play true
307
+ }
308
+
309
+ if LocalStorage['have_zoom_button']
310
+ @create_zoomplayer = new_jbutton( "Create a ZoomPlayer MAX compatible EDL file") do
311
+ raise unless OS.doze?
312
+ @prompt ||= show_blocking_message_dialog <<-EOL
313
+ To work with ZoomPlayer MAX's scene cut functionality, first play the DVD you want to watch edited, and
314
+ create a dummy cut for it in it via the ZoomPlayer MAX cut scene editor. (right click -> open interface -> scene cut editor)
315
+ Once you create a cut, ZoomPlayer will create a file like this:
316
+ [windows 7]: c:\\Users\\All Users\\Zoom Player\\DVD-Bookmarks\\Sintel_NTSC.3D4D1DFBEB1A53FE\\disc.cut
317
+
318
+ After it has been created, come back to this. You will next be prompted to select the generated disc.cut file, and also a sensible cinema EDL file.
319
+ The generated file will then be overwritten with the sensible cinema EDL information.
320
+ DVD compatible only currently--ask if you want it for file based selection as well and I can add it.
321
+ EOL
322
+ zoom_path = new_existing_file_selector_and_select_file( "Pick Zoomplayer disc.cut File to override", ENV["ALLUSERSPROFILE"]+ '/Zoom Player/DVD-Bookmarks' )
323
+ edl_path = new_existing_file_selector_and_select_file( "Pick EDL", EdlParser::EDL_DIR)
324
+ specs = parse_edl(edl_path)
325
+ require_relative '../zoom_player_max_edl'
326
+ out = ZoomPlayerMaxEdl.convert_to_edl_string specs
327
+ File.write(zoom_path, out)
328
+ show_blocking_message_dialog "wrote #{zoom_path}"
329
+ end
330
+ end
331
+ end
332
+
333
+ def get_disk_info
334
+ drive, volume_name, dvd_id = choose_dvd_drive_or_file true # require a real DVD disk :)
335
+ # display it, allow them to copy and paste it out
336
+ out_hashes = {}
337
+ out_hashes['disk_unique_id'] = dvd_id
338
+ out_hashes['volume_name'] = volume_name
339
+ popup = show_non_blocking_message_dialog "calculating DVD title sizes..."
340
+ command = "mplayer -vo direct3d dvdnav:// -nocache -dvd-device #{drive} -identify -frames 0 2>&1"
341
+ puts command
342
+ title_lengths_output = `#{command}`
343
+ popup.close
344
+ edit_list_path = EdlParser.single_edit_list_matches_dvd(dvd_id)
345
+ if edit_list_path
346
+ parsed = parse_edl edit_list_path
347
+ title_to_get_offset_of = get_title_track_string(parsed)
348
+ else
349
+ title_to_get_offset_of = nil
350
+ end
351
+ title_lengths = title_lengths_output.split("\n").select{|line| line =~ /TITLE.*LENGTH/}
352
+ # ID_DVD_TITLE_4_LENGTH=365.000
353
+ titles_with_length = title_lengths.map{|name| name =~ /ID_DVD_TITLE_(\d+)_LENGTH=([\d\.]+)/; [$1, $2.to_f]}
354
+ if titles_with_length.length > 50
355
+ show_blocking_message_dialog "this DVD has > 50 titles, this may mean that our 'guess' for the main title will be off, please double check the right number\nby starting the main movie in VLC then Playback menu -> title to see which number it is on."
356
+ end
357
+ largest_title = titles_with_length.max_by{|title, length| length}
358
+ if !largest_title
359
+ display_and_raise "unable to parse title lengths? maybe need to clean disk first? #{title_lengths_output}"
360
+ end
361
+ largest_title = largest_title[0]
362
+ title_to_get_offset_of ||= largest_title
363
+ out_hashes['dvd_title_track'] = title_to_get_offset_of
364
+ out_hashes['dvd_title_track_length'] = titles_with_length.detect{|title, length| title == title_to_get_offset_of}[1]
365
+ offsets = calculate_dvd_start_offset(title_to_get_offset_of, drive)
366
+ start_offset = offsets[:mpeg_start_offset]
367
+ out_hashes['dvd_start_offset'] = start_offset
368
+ out_hashes['dvd_nav_packet_offset'] = offsets[:dvd_nav_packet_offset]
369
+ [out_hashes, title_lengths]
370
+ end
371
+
372
+ def watch_dvd_edited_realtime_mplayer show_subs
373
+ edl_out_command = ""
374
+ if LocalStorage['prompt_obscure_options']
375
+ answer = show_select_buttons_prompt <<-EOL, {}
376
+ Would you like to create an .edl outfile as it plays (hit button to capture timestamps)?
377
+ EOL
378
+ if answer == :yes
379
+ show_non_blocking_message_dialog <<-EOL
380
+ EDL outfile:
381
+ As mplayer goes through the video, when you see a scene you want to edit or skip,
382
+ hit 'i' and mplayer will write the start time in the file and set it to skip for 2 seconds,
383
+ hit 'i' again to end the edited/skipped scene, within that file.
384
+ EOL
385
+
386
+ edlout_filename = new_nonexisting_filechooser_and_go "pick edlout filename"
387
+ edl_out_command = "-edlout #{edlout_filename}"
388
+
389
+ else
390
+ @has_ever_rejected_edl_outfile = true
391
+ end
392
+ end
393
+ thred = play_smplayer_edl_non_blocking nil, [edl_out_command], true, false, add_end = 0.0, add_begin = 0.0, show_subs # more aggressive :)
394
+ if(edl_out_command.present?)
395
+ open_edl_file_when_done thred, edlout_filename
396
+ end
397
+ end
398
+
399
+ def calculate_dvd_start_offset title, drive
400
+ popup = show_non_blocking_message_dialog "calculating start info for title #{title}..." # must be non blocking so the command can run :P
401
+ command = "mplayer -benchmark -frames 35 -osd-verbose -osdlevel 2 -vo null -nosound dvdnav://#{title} -nocache -dvd-device #{drive} 2>&1"
402
+ puts command
403
+ out = `#{command}`
404
+ #search for V: 0.37
405
+ popup.close
406
+ outs = {}
407
+ old_mpeg = 0
408
+ out.each_line{|l|
409
+ if l =~ /V:\s+([\d\.]+)/
410
+ outs[:mpeg_start_offset] ||= $1.to_f
411
+ end
412
+ float = /\d+\.\d+/
413
+ if l =~ /last NAV packet was (#{float}), mpeg at (#{float})/
414
+ nav = $1.to_f
415
+ mpeg = $2.to_f
416
+ if !outs[:dvd_nav_packet_offset] && nav > 0.0 # like 0.4
417
+ if mpeg < nav
418
+ # case there is an MPEG split before the second NAV packet [ratatouille, hp]
419
+ p mpeg, nav, old_mpeg
420
+ assert old_mpeg > 0.3
421
+ mpeg = old_mpeg + mpeg - 0.033367 # assume 30 fps, and that this is the second frame since it occurred, since the first one we apparently display "weird suddenly we're not a dvd?"
422
+ show_blocking_message_dialog "this dvd has some weird timing stuff at the start, attempting to accomodate...please report..."
423
+ end
424
+ outs[:dvd_nav_packet_offset] = [nav, mpeg] # like [0.4, 0.6] or the like
425
+ else
426
+ old_mpeg = mpeg # ratatouile weirdness...
427
+ end
428
+ end
429
+ }
430
+ show_blocking_message_dialog "unable to calculate DVD start time from #{command}?" unless outs.length == 2
431
+ outs
432
+ end
433
+
434
+ def get_start_stop_times_strings
435
+ # only show this message once :)
436
+ @show_block ||= show_blocking_message_dialog(<<-EOL, "Preview")
437
+ Ok, let's preview just a portion of it.
438
+ Note that you'll want to preview a section that wholly includes an edit section within it.
439
+ 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.
440
+ 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.
441
+ 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.
442
+ 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.
443
+ EOL
444
+ old_start = LocalStorage['start_time']
445
+ 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'])
446
+ default_end = LocalStorage['end_time']
447
+ if start_time and start_time != old_start
448
+ default_end = EdlParser.translate_string_to_seconds(start_time) + 10
449
+ default_end = EdlParser.translate_time_to_human_readable(default_end)
450
+ end
451
+ 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)
452
+ unless start_time and end_time
453
+ # this one is raw showMessageDialog...
454
+ JOptionPane.showMessageDialog(nil, " Please choose start and end", "Failed", JOptionPane::ERROR_MESSAGE)
455
+ return
456
+ end
457
+ LocalStorage['start_time'] = start_time
458
+ LocalStorage['end_time'] = end_time
459
+ [start_time, end_time]
460
+ end
461
+
462
+ def create_brand_new_dvd_edl
463
+ hashes, title_lengths = get_disk_info # has a prompt
464
+ volume = hashes['volume_name']
465
+ default_english_name = volume.split('_').map{|word| word.downcase.capitalize}.join(' ') # A Court A Jester
466
+ english_name = get_user_input("Enter a human readable DVD description for #{volume}", default_english_name)
467
+
468
+ # EDL versions:
469
+ # nothing with disk_unique_id: probably dvd_start_offset 29.97
470
+ # nothing without disk_unque_id: probably start_zero 29.97
471
+ # 1.1: has timestamps_relative_to, I guess
472
+
473
+ input = <<-EOL
474
+ # edl_version_version 1.1, sensible cinema v#{VERSION}
475
+ # comments can go be created by placing text after a # on any line, for example this one.
476
+ "name" => "#{english_name}",
477
+
478
+ "mutes" => [
479
+ # an example line, uncomment the leading "#" to make it active
480
+ # "0:00:01.0", "0:00:02.0", "profanity", "da..",
481
+ ],
482
+
483
+ "blank_outs" => [
484
+ # an example line, uncomment the leading "#" to make it active
485
+ # "00:03:00.0" , "00:04:00.0", "violence", "of some sort",
486
+ ],
487
+
488
+ "source" => "dvd",
489
+ "volume_name" => "#{volume}",
490
+ "timestamps_relative_to" => ["dvd_start_offset","29.97"],
491
+ "disk_unique_id" => "#{hashes['disk_unique_id']}",
492
+ "dvd_title_track" => "#{hashes['dvd_title_track']}", # our guess for it
493
+ "dvd_title_track_length" => "#{hashes['dvd_title_track_length']}",
494
+ # "not edited out stuff" => "some...",
495
+ # "closing thoughts" => "only ...",
496
+ # "subtitles_to_display_relative_path" => "some_file.srt" # if you want to display some custom subtitles alongside your movie
497
+ "dvd_title_track_start_offset" => "#{hashes['dvd_start_offset']}",
498
+ "dvd_nav_packet_offset" => #{hashes['dvd_nav_packet_offset'].inspect},
499
+ EOL
500
+
501
+ filename = EdlParser::EDL_DIR + "/edls_being_edited/" + english_name.gsub(' ', '_') + '.txt'
502
+ if File.exist?(filename)
503
+ show_blocking_message_dialog 'don\'t want to overwrite a file in the edit dir that already has same name, opening it instead...'
504
+ else
505
+ File.write(filename, input)
506
+ end
507
+ open_file_to_edit_it filename
508
+ end
509
+
510
+ def show_mplayer_instructions
511
+ show_non_blocking_message_dialog <<-EOL
512
+ About to run mplayer. To control it (or smplayer), you can use these keyboard keys:
513
+ spacebar : pause,
514
+ double clicky/right click/'f' : toggle full screen,
515
+ enter : select DVD menu currently highlighted
516
+ arrow keys (left, right, up down, pg up, pg dn) : seek/scan
517
+ / and * : inc/dec volume.
518
+ 'o' key: turn on on-screen-display timestamps see wiki "understanding timestamps"
519
+ 'v' key: toggle display of subtitles.
520
+ '.' key: step forward one frame.
521
+ '#' key: change audio language track
522
+ 'j' : change subtitle track/language
523
+ [ and ] make playback faster or slower [like 2x]
524
+ EOL
525
+ end
526
+
527
+ def create_new_for_file_or_netflix
528
+ names = ['movie file', 'netflix instant']
529
+ dialog = DropDownSelector.new(self, names, "Select type")
530
+ type = dialog.go_selected_value
531
+ extra_options = {}
532
+ if type == 'movie file'
533
+ path = SwingHelpers.new_previously_existing_file_selector_and_go "Select file to create EDL for"
534
+ guess_name = File.basename(path).split('.')[0..-2].join('.') # like yo.something.720p.HDTV.X264-DIMENSION.m4v maybe?
535
+ extra_options['filename'] = File.basename path
536
+ require 'lib/movie_hasher'
537
+ extra_options['movie_hash'] = MovieHasher.compute_hash path
538
+ else
539
+ url = get_user_input "Please input the movies url (like http://www.netflix.com/Movie/Curious-George/70042686 )" #?
540
+ if url =~ /netflix/
541
+ guess_name = url.split('/')[-2]
542
+ else
543
+ show_blocking_message_dialog "non hulu/netflix? please report!"
544
+ type = 'unknown'
545
+ guess_name = url.split('/')[-1]
546
+ end
547
+ extra_options['url'] = url
548
+ end
549
+ english_name = get_user_input "Enter name of movie", guess_name.gsub(/[-._]/, ' ')
550
+ filename = new_nonexisting_filechooser_and_go 'Pick new EDL filename', EdlParser::EDL_DIR + '/..', english_name.gsub(' ', '_') + '.txt'
551
+ display_and_raise "needs .txt extension" unless filename =~ /\.txt$/i
552
+
553
+ output = <<-EOL
554
+ # edl_version_version 1.1, created by sensible cinema v#{VERSION}
555
+ # comments can go be created by placing text after a # on any line, for example this one.
556
+ "name" => "#{english_name}",
557
+
558
+ "source" => "#{type}",
559
+ #{extra_options.map{|k, v| %!\n"#{k}" => "#{v}",\n!}}
560
+ "mutes" => [
561
+ # an example line, uncomment the leading "#" to make it active
562
+ # "0:00:01.0", "0:00:02.0", "profanity", "da..",
563
+ ],
564
+
565
+ "blank_outs" => [
566
+ # an example line, uncomment the leading "#" to make it active
567
+ # "00:03:00.0" , "00:04:00.0", "violence", "of some sort",
568
+ ],
569
+
570
+ "timestamps_relative_to" => ["#{type}"],
571
+ # "not edited out stuff" => "some...",
572
+ # "closing thoughts" => "only ...",
573
+ # "subtitles_to_display_relative_path" => "some_file.srt" # if you want to display some custom subtitles alongside your movie
574
+ EOL
575
+ File.write filename, output
576
+ open_file_to_edit_it filename
577
+
578
+ end
579
+
580
+ end
581
+ end