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
data/conclusions
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
"commercial" players, like windows media player, will "seek" based on 30 fps, even if
|
2
|
-
the underlying is 29.97
|
3
|
-
however if you allow them to just continue playing, they use wall time, which is 29.97 fps
|
4
|
-
|
5
|
-
makemkv can give you streams that are up to like 2s out of whack with the DVD. tsmuxer
|
6
|
-
seems to fix those though, if you unmux them.
|
@@ -1,69 +0,0 @@
|
|
1
|
-
You can create an edit list for sensible cinema to use against whatever DVD you want
|
2
|
-
|
3
|
-
An edit list (currently) lists sections you want muted or skipped. Here is an example
|
4
|
-
|
5
|
-
"mutes" => [
|
6
|
-
"02:02:15.0" , "02:02:25", "a muted demo section",
|
7
|
-
],
|
8
|
-
|
9
|
-
"blank_outs" => [
|
10
|
-
"02:02:00.0" , "02:02:10", "blanked out demo section",
|
11
|
-
],
|
12
|
-
|
13
|
-
"name" => "Greatest Story Ever Told",
|
14
|
-
|
15
|
-
You can see more examples in the "edit decision list/dvds" folder: https://github.com/rdp/sensible-cinema/tree/master/zamples
|
16
|
-
There are a few more specs not mentioned above, that you can have in there.
|
17
|
-
|
18
|
-
To create a new one, for a DVD, the steps typically look like this:
|
19
|
-
|
20
|
-
open Sensible cinema (with "advanced--edit create mode...bat")
|
21
|
-
|
22
|
-
insert your DVD, click "Create new edit list for DVD" button
|
23
|
-
|
24
|
-
Now detect timestamps for questionable content (some buttons may help you here),
|
25
|
-
add timestamps to this file, save it, and then test them to make sure they're accurate, using the various buttons.
|
26
|
-
|
27
|
-
Note that you can also add timestamps then click "Watch DVD on computer realtime" to avoid having
|
28
|
-
to rip it to your hard drive ever. This is slightly less accurate, but can be reasonably accurate.
|
29
|
-
See also the "pointers" section, below.
|
30
|
-
|
31
|
-
A big helper is the "parse subtitle" button.
|
32
|
-
Basically download a subtitle file for your DVD from opensubtitles.org
|
33
|
-
Then check that its timestamp matches (Watch full DVD unedited mplayer button, compare with "V: 3600" type output with your .srt file)
|
34
|
-
Then parse it for known profanities (parse a subtitle... button) and copy and paste the appropriate entries to your EDL.
|
35
|
-
You can also generate your own (super accurate) subtitle .srt file by using the SubtitleEdit to parse them from (unencrypted) DVD or file,
|
36
|
-
or avisynth can also extract subtitles.
|
37
|
-
|
38
|
-
For the rest of the buttons, just "mouse over"/"hover over" them for full descriptions of their potential uses.
|
39
|
-
|
40
|
-
After you're done, you can submit your new edit list to the project
|
41
|
-
(so others can use it later) by using the Upload button and sending it as an attachment.
|
42
|
-
Note also that if you know how, you could fork the code from github, commit changes, and
|
43
|
-
submit a pull request, as well (for example more edit lists, code changes, etc.)
|
44
|
-
Email is probably easier though :)
|
45
|
-
|
46
|
-
A few pointers:
|
47
|
-
|
48
|
-
You can make several different "edit lists" per DVD, using different filenames.
|
49
|
-
For example one might take out all profanity, and a second take out profanity and also remove all violence, or whatever.
|
50
|
-
Basically different levels :)
|
51
|
-
You can also just watch a DVD (using any DVD player), and get timestamps that way, before creating an edit list.
|
52
|
-
You'll have to convert them using the "convert timestamp" button.
|
53
|
-
A good computer program for this is "smplayer" (the [ and ] keys control playback speed, and right and left,
|
54
|
-
page up and page down buttons control seeking), and you can also turn on subtitles to help locate profanity.
|
55
|
-
See also the "tooltip" for the "convert timestamp" button.
|
56
|
-
Also note that you can rewatch the whole thing when you're done, just to double check and see
|
57
|
-
if you got all time signatures right (using "create DVD file on local hard drive" button).
|
58
|
-
Also note that you could also add your timing information to IMDB's parental guide wiki pages about movies.
|
59
|
-
This can help users of other than sensible cinema with editing their movies, or at least knowing the content.
|
60
|
-
You can even add timestamps there.
|
61
|
-
Also note that you don't need to "grab" the DVD to your hard drive to edit. You can just
|
62
|
-
watch it in smplayer with 'on-screen-display' enabled (o key), then convert the timestamps to 29.97 with the "convert timestamp"
|
63
|
-
button (or watch it in a hardware DVD player with the same effect).
|
64
|
-
You could also get a similar effect by setting up your EDL with its mplayer_dvd_splits http://goo.gl/yMfqX ,
|
65
|
-
then use math and smplayer's timestamps to get the right timestamps. See also the tooltip to the "convert timestamp" button.
|
66
|
-
You could also edit the "video file" in basically any professional editor--they are usually pretty accurate to 29.97 fps, to get the edit timestamps.
|
67
|
-
Microsoft's editor actually doesn't work. PowerProducer (part of the powerdvd suite) does. AVS Editor does.
|
68
|
-
You could use avidemux (set frame settings manually to "video" 24 fps if necessary) though video will be off, audio will be on.
|
69
|
-
You could ask on the mailing list if somebody else could do the EDL for you, or offer to pay somebody there, I guess.
|
@@ -1,620 +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
|
-
|
21
|
-
alias system_original system
|
22
|
-
require 'fileutils'
|
23
|
-
|
24
|
-
class String
|
25
|
-
def snake_case
|
26
|
-
self.gsub(/::/, '/').
|
27
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
28
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
29
|
-
tr("-", "_").
|
30
|
-
downcase
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
# shared
|
35
|
-
require_relative '../jruby-swing-helpers/swing_helpers'
|
36
|
-
require_relative '../jruby-swing-helpers/drive_info'
|
37
|
-
require_relative '../jruby-swing-helpers/ruby_clip'
|
38
|
-
|
39
|
-
# attempt to load on demand...i.e. faster...
|
40
|
-
for kls in [:MencoderWrapper, :MplayerEdl, :PlayAudio, :SubtitleProfanityFinder, :ConvertThirtyFps]
|
41
|
-
autoload kls, "./lib/#{kls.to_s.snake_case}"
|
42
|
-
end
|
43
|
-
|
44
|
-
# a few I'll always need eventually...
|
45
|
-
require_relative '../storage'
|
46
|
-
require_relative '../edl_parser'
|
47
|
-
require 'tmpdir'
|
48
|
-
require 'whichr'
|
49
|
-
require 'os'
|
50
|
-
if OS.doze?
|
51
|
-
autoload :WMI, 'ruby-wmi'
|
52
|
-
autoload :EightThree, './lib/eight_three'
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
if OS.windows?
|
57
|
-
vendor_cache = File.expand_path(File.dirname(__FILE__)) + '/../../vendor/cache'
|
58
|
-
for name in ['.', 'mencoder', 'ffmpeg']
|
59
|
-
# put them all before the old path
|
60
|
-
ENV['PATH'] = (vendor_cache + '/' + name).to_filename + ';' + ENV['PATH']
|
61
|
-
end
|
62
|
-
|
63
|
-
installed_smplayer_folders = Dir['{c,d,e,f,g}:/program files*/MPlayer for Windows*'] # sometimes ends with UI? huh?
|
64
|
-
|
65
|
-
for folder in installed_smplayer_folders
|
66
|
-
ENV['PATH'] = ENV['PATH'] + ";#{folder.gsub('/', "\\")}"
|
67
|
-
end
|
68
|
-
|
69
|
-
else
|
70
|
-
ENV['PATH'] = ENV['PATH'] + ':' + '/opt/local/bin' # add macports' bin in, just in case...
|
71
|
-
end
|
72
|
-
|
73
|
-
import 'javax.swing.ImageIcon'
|
74
|
-
require_relative './sensible-cinema-dependencies'
|
75
|
-
|
76
|
-
module SensibleSwing
|
77
|
-
include SwingHelpers # various swing classes
|
78
|
-
JFrame
|
79
|
-
VERSION = File.read(File.dirname(__FILE__) + "/../../VERSION").strip
|
80
|
-
puts "v. " + VERSION
|
81
|
-
|
82
|
-
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) # <sigh>
|
83
|
-
|
84
|
-
class MainWindow < JFrame
|
85
|
-
include SwingHelpers # work-around?
|
86
|
-
|
87
|
-
def initialize be_visible = true
|
88
|
-
super "Sensible-Cinema #{VERSION} (GPL)"
|
89
|
-
force_accept_license_first
|
90
|
-
setDefaultCloseOperation JFrame::EXIT_ON_CLOSE # default is exit on close
|
91
|
-
@panel = JPanel.new
|
92
|
-
@buttons = []
|
93
|
-
@panel.set_layout nil
|
94
|
-
add @panel # why can't I just slap these down? panel? huh?
|
95
|
-
@starting_button_y = 40
|
96
|
-
@button_width = 400
|
97
|
-
|
98
|
-
add_text_line "Welcome to Sensible Cinema!"
|
99
|
-
@starting_button_y += 10 # kinder ugly...
|
100
|
-
add_text_line " Rest mouse over buttons for \"help\" type descriptions (tooltips)."
|
101
|
-
add_text_line ""
|
102
|
-
|
103
|
-
setIconImage(ImageIcon.new(__DIR__ + "/../vendor/profs.png").getImage())
|
104
|
-
check_for_various_dependencies
|
105
|
-
set_visible be_visible
|
106
|
-
end
|
107
|
-
|
108
|
-
def we_are_in_create_mode
|
109
|
-
ARGV.index("--create-mode")
|
110
|
-
end
|
111
|
-
|
112
|
-
def new_jbutton title, tooltip = nil
|
113
|
-
button = JButton.new title
|
114
|
-
button.tool_tip = tooltip
|
115
|
-
button.set_bounds(44, @starting_button_y, @button_width, 23)
|
116
|
-
@panel.add button
|
117
|
-
@buttons << button
|
118
|
-
if block_given? # allow for new_jbutton("xx") do ... end [this is possible through some miraculous means LOL]
|
119
|
-
button.on_clicked { yield }
|
120
|
-
end
|
121
|
-
increment_button_location
|
122
|
-
button
|
123
|
-
end
|
124
|
-
|
125
|
-
def add_text_line line
|
126
|
-
jlabel = JLabel.new line
|
127
|
-
happy = Font.new("Tahoma", Font::PLAIN, 11)
|
128
|
-
jlabel.setFont(happy)
|
129
|
-
jlabel.set_bounds(44,@starting_button_y ,460,14)
|
130
|
-
@panel.add jlabel
|
131
|
-
increment_button_location 18
|
132
|
-
jlabel
|
133
|
-
end
|
134
|
-
|
135
|
-
def increment_button_location how_much = 30
|
136
|
-
@starting_button_y += how_much
|
137
|
-
setSize @button_width+80, @starting_button_y + 50
|
138
|
-
end
|
139
|
-
|
140
|
-
def force_accept_license_first
|
141
|
-
if !(LocalStorage['main_license_accepted'] == VERSION)
|
142
|
-
require_blocking_license_accept_dialog 'Sensible Cinema', 'gplv3', 'http://www.gnu.org/licenses/gpl.html', 'Sensible Cinema license agreement',
|
143
|
-
"Sensible Cinema is distributed under the gplv3 (http://www.gnu.org/licenses/gpl.html).\nBY CLICKING \"accept\" YOU SIGNIFY THAT YOU HAVE READ, UNDERSTOOD AND AGREED TO ABIDE BY THE TERMS OF THIS AGREEMENT"
|
144
|
-
require_blocking_license_accept_dialog 'Sensible Cinema', 'is_it_legal_to_copy_dvds.txt file', File.expand_path(File.dirname(__FILE__) + "/../documentation/is_it_legal_to_copy_dvds.txt"),
|
145
|
-
'is_it_legal_to_copy_dvds.txt file', 'I acknowledge that I have read, understand, accept and agree to abide by the implications noted in the documentation/is_it_legal_to_copy_dvds.txt file'
|
146
|
-
LocalStorage['main_license_accepted'] = VERSION
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
LocalStorage = Storage.new("sensible_cinema_storage")
|
151
|
-
|
152
|
-
def when_thread_done(thread)
|
153
|
-
Thread.new {thread.join; yield }
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
# a window that when closed doesn't bring the whole app down
|
158
|
-
def new_child_window
|
159
|
-
child = MainWindow.new
|
160
|
-
child.setDefaultCloseOperation(JFrame::DISPOSE_ON_CLOSE)
|
161
|
-
child.parent=self # this should have failed in the PPL
|
162
|
-
# make both windows visible z-wise
|
163
|
-
x, y = self.get_location.x, self.get_location.y
|
164
|
-
child.set_location(x + 100, y + 100)
|
165
|
-
child
|
166
|
-
end
|
167
|
-
|
168
|
-
def run_smplayer_non_blocking *args
|
169
|
-
pp caller
|
170
|
-
@background_thread = Thread.new {
|
171
|
-
run_smplayer_blocking *args
|
172
|
-
}
|
173
|
-
end
|
174
|
-
|
175
|
-
def run_smplayer_blocking play_this, title_track_maybe_nil, passed_in_extra_options, force_use_mplayer, show_subs, start_full_screen
|
176
|
-
unless File.exist?(File.expand_path(play_this))
|
177
|
-
raise play_this + ' non existing?' # till these go away in mac :)
|
178
|
-
end
|
179
|
-
|
180
|
-
extra_options = ""
|
181
|
-
# -framedrop is for slow CPU's
|
182
|
-
# same with -autosync to try and help it stay in sync... -mc 0.03 is to A/V correct 1s audio per 2s video
|
183
|
-
# -hardframedrop might help but hurts just too much
|
184
|
-
extra_options << " -framedrop "
|
185
|
-
# ?? extra_mplayer_commands << "-mc 0.016" ??
|
186
|
-
extra_options << " -autosync 15 "
|
187
|
-
|
188
|
-
unless show_subs
|
189
|
-
# disable subtitles
|
190
|
-
extra_options << " -nosub -noautosub -forcedsubsonly -sid 1000 "
|
191
|
-
end
|
192
|
-
extra_options << " -alang en "
|
193
|
-
extra_options += " -slang en "
|
194
|
-
|
195
|
-
parent_parent = File.basename(File.dirname(play_this))
|
196
|
-
force_use_mplayer ||= OS.mac?
|
197
|
-
if parent_parent == 'VIDEO_TS'
|
198
|
-
# case d:\yo\VIDEO_TS\title0.vob
|
199
|
-
dvd_device_dir = normalize_path(File.dirname(play_this))
|
200
|
-
if force_use_mplayer
|
201
|
-
extra_options += " -dvd-device \"#{dvd_device_dir}/..\""
|
202
|
-
else
|
203
|
-
# smplayer
|
204
|
-
raise if dvd_device_dir =~ / / && OS.mac? # not accomodated <sniff>
|
205
|
-
extra_options += " -dvd-device #{dvd_device_dir}/.."
|
206
|
-
end
|
207
|
-
play_this = "dvdnav://#{title_track_maybe_nil}"
|
208
|
-
elsif File.exist?(play_this + '/VIDEO_TS')
|
209
|
-
# case d:\ where d:\VIDEO_TS exists [DVD mounted in drive] or mac's /Volumes/YO
|
210
|
-
raise if play_this =~ / / # unexpected
|
211
|
-
extra_options += " -nocache -dvd-device #{play_this}"
|
212
|
-
play_this = "dvdnav://#{title_track_maybe_nil}"
|
213
|
-
else
|
214
|
-
# case g:\video\filename.mpg
|
215
|
-
# leave it the same...
|
216
|
-
end
|
217
|
-
if play_this =~ /dvdnav/ && title_track_maybe_nil
|
218
|
-
extra_options << " -msglevel identify=4 " # prevent smplayer from using *forever* to look up info on DVD's with -identify ...
|
219
|
-
end
|
220
|
-
|
221
|
-
extra_options += " -mouse-movements #{get_upconvert_secondary_settings} " # just in case smplayer also needs -mouse-movements... :) LODO
|
222
|
-
extra_options += " -lavdopts threads=#{OS.cpu_count} " # just in case this helps [supposed to with h.264] # fast *crashes* doze...
|
223
|
-
if force_use_mplayer
|
224
|
-
show_mplayer_instructions_once
|
225
|
-
conf_file = File.expand_path './mplayer_input_conf'
|
226
|
-
File.write conf_file, "ENTER {dvdnav} dvdnav select\nMOUSE_BTN0 {dvdnav} dvdnav select\nMOUSE_BTN0_DBL vo_fullscreen\nMOUSE_BTN2 vo_fullscreen\nKP_ENTER dvdnav select\n" # that KP_ENTER doesn't actually work. Nor the MOUSE_BTN0 on windows. Weird.
|
227
|
-
extra_options += " -font #{File.expand_path('vendor/subfont.ttf')} "
|
228
|
-
extra_options += " -volume 100 " # why start low? mplayer why oh why LODO
|
229
|
-
if OS.windows?
|
230
|
-
# direct3d for windows 7 old nvidia cards' sake [yipes] and also dvdnav sake
|
231
|
-
extra_options += " -vo direct3d "
|
232
|
-
conf_file = conf_file[2..-1] # strip off drive letter, which it doesn't seem to like no sir
|
233
|
-
end
|
234
|
-
if start_full_screen
|
235
|
-
extra_options += " -fs "
|
236
|
-
upconv = get_upconvert_vf_settings
|
237
|
-
upconv = "-vf #{upconv}" if upconv.present?
|
238
|
-
else
|
239
|
-
upconv = ""
|
240
|
-
end
|
241
|
-
c = "mplayer #{extra_options} #{upconv} -input conf=\"#{conf_file}\" #{passed_in_extra_options} \"#{play_this}\" "
|
242
|
-
else
|
243
|
-
if OS.windows?
|
244
|
-
extra_options += " -vo direct3d " # more light nvidia...should be ok...
|
245
|
-
end
|
246
|
-
set_smplayer_opts extra_options + " " + passed_in_extra_options, get_upconvert_vf_settings, show_subs
|
247
|
-
c = "smplayer_portable \"#{play_this}\" -config-path \"#{File.dirname SMPlayerIniFile}\" "
|
248
|
-
c += " -fullscreen " if start_full_screen
|
249
|
-
if !we_are_in_create_mode
|
250
|
-
#c += " -close-at-end " # we're still too unstable, mate...
|
251
|
-
end
|
252
|
-
end
|
253
|
-
puts c
|
254
|
-
system_blocking c
|
255
|
-
end
|
256
|
-
|
257
|
-
SMPlayerIniFile = File.expand_path("~/.smplayer/smplayer.ini")
|
258
|
-
|
259
|
-
def set_smplayer_opts to_this, video_, show_subs = false
|
260
|
-
p 'set smplayer extra opts to this:' + to_this
|
261
|
-
old_prefs = File.read(SMPlayerIniFile) rescue ''
|
262
|
-
unless old_prefs.length > 0
|
263
|
-
# LODO double check the rest here...
|
264
|
-
old_prefs = "[advanced]\nmplayer_additional_options=\nmplayer_additional_video_filters=\n[subtitles]\nautoload_sub=false\n[performance]\npriority=3"
|
265
|
-
end
|
266
|
-
raise to_this if to_this =~ /"/ # unexpected, unfortunately... <smplayer bug>
|
267
|
-
assert new_prefs = old_prefs.gsub(/mplayer_additional_options=.*/, "mplayer_additional_options=#{to_this}")
|
268
|
-
assert new_prefs.gsub!(/autoload_sub=.*$/, "autoload_sub=#{show_subs.to_s}")
|
269
|
-
raise if get_upconvert_vf_settings =~ /"/
|
270
|
-
assert new_prefs.gsub!(/mplayer_additional_video_filters=.*$/, "mplayer_additional_video_filters=\"#{get_upconvert_vf_settings}\"")
|
271
|
-
new_prefs.gsub!(/priority=.*$/, "priority=3") # normal priority...scary otherwise! lodo tell smplayer...
|
272
|
-
# enable dvdnav navigation, just for kicks I guess.
|
273
|
-
new_prefs.gsub!(/use_dvdnav=.*$/, "use_dvdnav=true")
|
274
|
-
|
275
|
-
FileUtils.mkdir_p File.dirname(SMPlayerIniFile) # case it doesn't yet exist
|
276
|
-
File.write(SMPlayerIniFile, new_prefs)
|
277
|
-
new_prefs.each_line{|l| print l if l =~ /additional_video/} # debug
|
278
|
-
end
|
279
|
-
def system_blocking command, low_prio = false
|
280
|
-
return true if command =~ /^@rem/ # JRUBY-5890 bug
|
281
|
-
if low_prio
|
282
|
-
out = IO.popen(command) # + " 2>&1"
|
283
|
-
low_prio = 64 # from msdn
|
284
|
-
|
285
|
-
if command =~ /(ffmpeg|mencoder)/
|
286
|
-
# XXXX not sure if there's a better way...because some *are* complex and have ampersands...
|
287
|
-
# unfortunately have to check for nil because it could exit too early [?]
|
288
|
-
exe_name = $1 + '.exe'
|
289
|
-
begin
|
290
|
-
p = proc{ ole = WMI::Win32_Process.find(:first, :conditions => {'Name' => exe_name}); sleep 1 unless ole; ole }
|
291
|
-
piddy = p.call || p.call || p.call # we actually do need this to loop...guess we're too quick
|
292
|
-
# but the first time through this still inexplicably fails all 3...odd
|
293
|
-
piddys = WMI::Win32_Process.find(:all, :conditions => {'Name' => exe_name})
|
294
|
-
for piddy in piddys
|
295
|
-
# piddy.SetPriority low_prio # this call can seg fault at times...JRUBY-5422
|
296
|
-
pid = piddy.ProcessId # this doesn't seg fault, tho
|
297
|
-
system_original("vendor\\setpriority -lowest #{pid}") # uses PID for the command line
|
298
|
-
end
|
299
|
-
rescue Exception => e
|
300
|
-
p 'warning, got exception trying to set priority [jruby prob? ...]', e
|
301
|
-
end
|
302
|
-
end
|
303
|
-
print out.read # let it finish
|
304
|
-
out.close
|
305
|
-
$?.exitstatus == 0 # 0 means success
|
306
|
-
else
|
307
|
-
raise command + " failed env #{ENV['PATH']}" unless system_original command
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
def system_non_blocking command
|
312
|
-
@background_thread = Thread.new { system_original command }
|
313
|
-
end
|
314
|
-
|
315
|
-
# make them choose which system call to use explicitly
|
316
|
-
undef system
|
317
|
-
|
318
|
-
def play_dvd_smplayer_unedited use_mplayer_instead, show_instructions, show_subs
|
319
|
-
drive_or_file, dvd_volume_name, dvd_id, edl_path_maybe_nil, descriptors_maybe_nil = choose_dvd_or_file_and_edl_for_it false
|
320
|
-
if descriptors_maybe_nil
|
321
|
-
title_track_maybe_nil = get_title_track(descriptors_maybe_nil, false)
|
322
|
-
end
|
323
|
-
if show_instructions
|
324
|
-
# want these even with smplayer sometimes I guess, if in power user mode anyway
|
325
|
-
show_mplayer_instructions_once
|
326
|
-
end
|
327
|
-
run_smplayer_non_blocking drive_or_file, title_track_maybe_nil, "-osd-fractions 2", use_mplayer_instead, show_subs, false
|
328
|
-
end
|
329
|
-
|
330
|
-
if OS.doze? # avoids spaces in filenames :)
|
331
|
-
EdlTempFile = EightThree.convert_path_to_8_3(Dir.tmpdir) + '\\mplayer.temp.edl'
|
332
|
-
else
|
333
|
-
raise if Dir.tmpdir =~ / / # that would be unexpected, and probably cause problems...
|
334
|
-
EdlTempFile = Dir.tmpdir + '/mplayer.temp.edl'
|
335
|
-
end
|
336
|
-
|
337
|
-
def show_mplayer_instructions_once
|
338
|
-
@_show_mplayer_instructions_once ||= show_non_blocking_message_dialog <<-EOL
|
339
|
-
About to run mplayer. To control it, use
|
340
|
-
spacebar : pause,
|
341
|
-
double clicky/right click : toggle full screen,
|
342
|
-
arrow keys (left, right, up down, pg up, pg dn) to seek/scan
|
343
|
-
/ and * : inc/dec volume.
|
344
|
-
'o' key: turn on on-screen-display timestamps (note: the OSD timestamps [upper left] are 30 fps so will need to be converted to use).
|
345
|
-
'v' key: turn off subtitles.
|
346
|
-
'.' key: step one frame.
|
347
|
-
# key: change audio language track
|
348
|
-
[ and ] make playback faster
|
349
|
-
EOL
|
350
|
-
end
|
351
|
-
|
352
|
-
|
353
|
-
def choose_dvd_or_file_and_edl_for_it force_choose_edl_file_if_no_easy_match = true
|
354
|
-
drive_or_file, dvd_volume_name, dvd_id = choose_dvd_drive_or_file false
|
355
|
-
|
356
|
-
unless @_edit_list_path # cache file selection...
|
357
|
-
edit_list_path = EdlParser.single_edit_list_matches_dvd(dvd_id)
|
358
|
-
if !edit_list_path && force_choose_edl_file_if_no_easy_match
|
359
|
-
edit_list_path = new_existing_file_selector_and_select_file("Please pick a DVD Edit List File (none or more than one were found that seem to match #{dvd_volume_name})--may need to create one for it", EdlParser::EDL_DIR)
|
360
|
-
raise 'cancelled choosing an EDL' unless edit_list_path
|
361
|
-
end
|
362
|
-
@_edit_list_path = edit_list_path
|
363
|
-
end
|
364
|
-
p 'reloading'
|
365
|
-
if @_edit_list_path
|
366
|
-
# reload it every time just in case it has changed on disk
|
367
|
-
descriptors = nil
|
368
|
-
begin
|
369
|
-
descriptors = parse_edl @_edit_list_path
|
370
|
-
rescue SyntaxError => e
|
371
|
-
show_non_blocking_message_dialog("this file has an error--please fix then hit ok: \n" + @_edit_list_path + "\n " + e)
|
372
|
-
raise e
|
373
|
-
end
|
374
|
-
end
|
375
|
-
[drive_or_file, dvd_volume_name, dvd_id, @_edit_list_path, descriptors]
|
376
|
-
end
|
377
|
-
|
378
|
-
MplayerBeginingBuffer = 1.0
|
379
|
-
MplayerEndBuffer = 0.0
|
380
|
-
|
381
|
-
def play_mplayer_edl_non_blocking optional_file_with_edl_path = nil, extra_mplayer_commands_array = [], force_mplayer = false, start_full_screen = true
|
382
|
-
if optional_file_with_edl_path
|
383
|
-
drive_or_file, edl_path = optional_file_with_edl_path
|
384
|
-
dvd_id = NonDvd # fake it out...LODO a bit smelly
|
385
|
-
else
|
386
|
-
drive_or_file, dvd_volume_name, dvd_id, edl_path, descriptors = choose_dvd_or_file_and_edl_for_it
|
387
|
-
end
|
388
|
-
start_add_this_to_all_ts = 0
|
389
|
-
if edl_path # some don't care...
|
390
|
-
descriptors = EdlParser.parse_file edl_path
|
391
|
-
title_track = get_title_track(descriptors)
|
392
|
-
splits = descriptors['mplayer_dvd_splits']
|
393
|
-
end
|
394
|
-
|
395
|
-
if dvd_id == NonDvd && !(File.basename(File.dirname(drive_or_file)) == 'VIDEO_TS') # VOB's...always start at 0
|
396
|
-
# check if starts offset...
|
397
|
-
all = `ffmpeg -i "#{drive_or_file}" 2>&1`
|
398
|
-
# Duration: 01:35:49.59, start: 600.000000
|
399
|
-
all =~ /Duration.*start: ([\d\.]+)/
|
400
|
-
start = $1.to_f
|
401
|
-
if start > 1 # LODO huh? dvd's themselves start at 0.3 [sintel]?
|
402
|
-
show_non_blocking_message_dialog "Warning: file seems to start at an extra offset, adding it to the timestamps... #{start}
|
403
|
-
maybe not compatible with XBMC, if that's what you use, and you probably don't" # TODO test it XBMC...
|
404
|
-
start_add_this_to_all_ts = start
|
405
|
-
end
|
406
|
-
splits = []
|
407
|
-
else
|
408
|
-
if splits == nil
|
409
|
-
show_blocking_message_dialog("warning: edit list does not contain mplayer replay information [mplayer_dvd_splits] so edits past a certain time period might not won't work ( http://goo.gl/yMfqX ).")
|
410
|
-
splits = []
|
411
|
-
end
|
412
|
-
end
|
413
|
-
|
414
|
-
if edl_path
|
415
|
-
splits.map!{|s| EdlParser.translate_string_to_seconds(s) }
|
416
|
-
edl_contents = MplayerEdl.convert_to_edl descriptors, add_secs_end = MplayerEndBuffer, add_secs_begin = MplayerBeginingBuffer, splits, start_add_this_to_all_ts # add a sec to mutes to accomodate for mplayer's oddness..
|
417
|
-
File.write(EdlTempFile, edl_contents)
|
418
|
-
extra_mplayer_commands_array << "-edl #{File.expand_path EdlTempFile}"
|
419
|
-
end
|
420
|
-
|
421
|
-
run_smplayer_non_blocking drive_or_file, title_track, extra_mplayer_commands_array.join(' '), force_mplayer, false, start_full_screen
|
422
|
-
end
|
423
|
-
|
424
|
-
def assert_ownership_dialog
|
425
|
-
message = "Do you certify you own the DVD this came of and have it in your possession?"
|
426
|
-
title = "Verify ownership"
|
427
|
-
returned = JOptionPane.show_select_buttons_prompt(message, {})
|
428
|
-
assert_confirmed_dialog returned, nil
|
429
|
-
end
|
430
|
-
|
431
|
-
def require_blocking_license_accept_dialog program, license_name, license_url_should_also_be_embedded_by_you_in_message,
|
432
|
-
title = 'Confirm Acceptance of License Agreement', message = nil
|
433
|
-
puts 'Please confirm license agreement in open window.'
|
434
|
-
|
435
|
-
message ||= "Sensible Cinema requires a separately installed program (#{program}), not yet installed.
|
436
|
-
You can install this program manually to the vendor/cache subdirectory, or Sensible Cinema can download it for you.
|
437
|
-
By clicking accept, below, you are confirming that you have read and agree to be bound by the
|
438
|
-
terms of its license (the #{license_name}), located at #{license_url_should_also_be_embedded_by_you_in_message}.
|
439
|
-
Click 'View License' to view it. If you do not agree to these terms, click 'Cancel'. You also agree that this is a
|
440
|
-
separate program, with its own distribution, license, ownership and copyright.
|
441
|
-
You agree that you are responsible for the download and use of this program, within sensible cinema or otherwise."
|
442
|
-
answer = JOptionPane.show_select_buttons_prompt message, :yes => 'Accept', :no => "View #{license_name}"
|
443
|
-
assert_confirmed_dialog answer, license_url_should_also_be_embedded_by_you_in_message
|
444
|
-
p 'confirmation of sensible cinema related license noted of: ' + license_name # LODO require all licenses together :P
|
445
|
-
throw unless answer == :yes
|
446
|
-
end
|
447
|
-
|
448
|
-
def assert_confirmed_dialog returned, license_url_should_also_be_embedded_by_you_in_message
|
449
|
-
# :yes, :no, :cancel
|
450
|
-
# 1 is view button was clicked
|
451
|
-
# 0 is accept
|
452
|
-
# 2 is cancel
|
453
|
-
if returned == :no
|
454
|
-
if license_url_should_also_be_embedded_by_you_in_message
|
455
|
-
system_non_blocking("start #{license_url_should_also_be_embedded_by_you_in_message}") # guess this is url's too, eh?
|
456
|
-
puts "Please restart after reading license agreement, to be able to then accept it."
|
457
|
-
end
|
458
|
-
System.exit 0
|
459
|
-
elsif returned == :cancel
|
460
|
-
p 'license not accepted...exiting'
|
461
|
-
System.exit 1
|
462
|
-
elsif returned == :exited
|
463
|
-
p 'license exited early...exiting'
|
464
|
-
System.exit 1
|
465
|
-
elsif returned == :yes
|
466
|
-
# ok
|
467
|
-
else
|
468
|
-
raise 'unknown'
|
469
|
-
end
|
470
|
-
end
|
471
|
-
|
472
|
-
def print *args
|
473
|
-
Kernel.print *args # avoid bin\sensible-cinema.rb:83:in `system_blocking': cannot convert instance of class org.jruby.RubyString to class java.awt.Graphics (TypeError)
|
474
|
-
end
|
475
|
-
|
476
|
-
def download_7zip
|
477
|
-
Dir.mkdir('./vendor/cache') unless File.directory? 'vendor/cache' # development may not have it created yet... [?]
|
478
|
-
unless File.exist? 'vendor/cache/7za.exe'
|
479
|
-
Dir.chdir('vendor/cache') do
|
480
|
-
print 'downloading unzipper (7zip--400K) ...'
|
481
|
-
MainWindow.download("http://downloads.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip", "7za920.zip")
|
482
|
-
system_blocking("../unzip.exe -o 7za920.zip") # -o means "overwrite" without prompting
|
483
|
-
end
|
484
|
-
end
|
485
|
-
end
|
486
|
-
|
487
|
-
def download_zip_file_and_extract english_name, url, to_this
|
488
|
-
download_7zip
|
489
|
-
Dir.chdir('vendor/cache') do
|
490
|
-
file_name = url.split('/')[-1]
|
491
|
-
print "downloading #{english_name} ..."
|
492
|
-
MainWindow.download(url, file_name)
|
493
|
-
system_blocking("7za e #{file_name} -y -o#{to_this}")
|
494
|
-
puts 'done ' + english_name
|
495
|
-
# creates vendor/cache/mencoder/mencoder.exe...
|
496
|
-
end
|
497
|
-
end
|
498
|
-
|
499
|
-
def check_for_exe windows_full_loc, unix_name
|
500
|
-
# in windows, that exe *at that location* must exist...
|
501
|
-
if OS.windows?
|
502
|
-
File.exist?(windows_full_loc)
|
503
|
-
else
|
504
|
-
require 'lib/check_installed_mac.rb'
|
505
|
-
if !CheckInstalledMac.check_for_installed(unix_name)
|
506
|
-
exit 1 # it'll have already displayed a message...
|
507
|
-
else
|
508
|
-
true
|
509
|
-
end
|
510
|
-
end
|
511
|
-
end
|
512
|
-
|
513
|
-
def check_for_various_dependencies
|
514
|
-
if we_are_in_create_mode
|
515
|
-
if !check_for_exe('vendor/cache/mencoder/mencoder.exe', 'mencoder')
|
516
|
-
require_blocking_license_accept_dialog 'mplayer', 'gplv2', 'http://www.gnu.org/licenses/gpl-2.0.html', "Appears that you need to install a dependency: mplayer with mencoder."
|
517
|
-
download_zip_file_and_extract "Mplayer/mencoder (6MB)", "http://sourceforge.net/projects/mplayer-win32/files/MPlayer%20and%20MEncoder/revision%2033883/MPlayer-rtm-svn-33883.7z", "mencoder"
|
518
|
-
end
|
519
|
-
end
|
520
|
-
|
521
|
-
# runtime dependencies, at least as of today...
|
522
|
-
ffmpeg_exe_loc = File.expand_path('vendor/cache/ffmpeg/ffmpeg.exe')
|
523
|
-
if !check_for_exe(ffmpeg_exe_loc, 'ffmpeg')
|
524
|
-
require_blocking_license_accept_dialog 'ffmpeg', 'gplv2', 'http://www.gnu.org/licenses/gpl-2.0.html', "Appears that you need to install a dependency: ffmpeg."
|
525
|
-
download_zip_file_and_extract "ffmpeg (5MB)", "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-git-335bbe4-win32-static.7z", "ffmpeg"
|
526
|
-
end
|
527
|
-
if OS.mac?
|
528
|
-
check_for_exe("mplayer", "mplayer") # mencoder and mplayer are separate for mac... [this checks for mac's mplayerx, too]
|
529
|
-
else
|
530
|
-
path = RubyWhich.new.which('smplayer_portable')
|
531
|
-
if(path.length == 0)
|
532
|
-
# this one has its own installer...
|
533
|
-
show_blocking_message_dialog("It appears that you need to install a pre-requisite dependency: MPlayer for Windows (MPUI).
|
534
|
-
Click ok to be directed to its download website, where you can download and install it (recommend: MPUI....Full-Package.exe),
|
535
|
-
then restart sensible cinema. NB that it takes awhile to install. Sorry about that.",
|
536
|
-
"Lacking dependency", JOptionPane::ERROR_MESSAGE)
|
537
|
-
SwingHelpers.open_url_to_view_it_non_blocking "http://code.google.com/p/mulder/downloads/list?can=2&q=MPlayer&sort=-uploaded&colspec=Filename%20Summary%20Type%20Uploaded%20Size%20DownloadCount"
|
538
|
-
System.exit 0
|
539
|
-
end
|
540
|
-
end
|
541
|
-
end
|
542
|
-
|
543
|
-
def open_file_to_edit_it filename, options = {} # :start_minimized
|
544
|
-
if OS.windows?
|
545
|
-
if options[:start_minimized]
|
546
|
-
system_non_blocking "start /min notepad \"#{filename}\""
|
547
|
-
else
|
548
|
-
system_non_blocking "notepad \"#{filename}\""
|
549
|
-
end
|
550
|
-
else
|
551
|
-
# ignore minimized :P
|
552
|
-
system_non_blocking "open -a TextEdit \"#{filename}\""
|
553
|
-
end
|
554
|
-
end
|
555
|
-
|
556
|
-
def new_nonexisting_filechooser_and_go title = nil, default_dir = nil, default_file = nil
|
557
|
-
bring_to_front # LODO not need...
|
558
|
-
JFileChooser.new_nonexisting_filechooser_and_go title, default_dir, default_file
|
559
|
-
end
|
560
|
-
|
561
|
-
def show_blocking_message_dialog(message, title = message.split("\n")[0], style= JOptionPane::INFORMATION_MESSAGE)
|
562
|
-
bring_to_front
|
563
|
-
SwingHelpers.show_blocking_message_dialog message, title, style
|
564
|
-
end
|
565
|
-
|
566
|
-
# call dispose on this to close it if it hasn't been canceled yet...
|
567
|
-
def show_non_blocking_message_dialog message, close_button_text = 'Close'
|
568
|
-
bring_to_front
|
569
|
-
# lodo NonBlockingDialog it can get to the top instead of being so buried...
|
570
|
-
SwingHelpers.show_non_blocking_message_dialog message, close_button_text
|
571
|
-
end
|
572
|
-
|
573
|
-
include_class javax.swing.UIManager
|
574
|
-
|
575
|
-
def get_user_input(message, default = '', cancel_ok = false)
|
576
|
-
bring_to_front
|
577
|
-
SwingHelpers.get_user_input message, default, cancel_ok
|
578
|
-
end
|
579
|
-
|
580
|
-
def show_copy_pastable_string(message, value)
|
581
|
-
bring_to_front
|
582
|
-
RubyClip.set_clipboard value
|
583
|
-
get_user_input message + " (has been copied to clipboard)", value, true
|
584
|
-
end
|
585
|
-
|
586
|
-
# also caches directory previously selected ...
|
587
|
-
def new_existing_file_selector_and_select_file title, dir = nil
|
588
|
-
bring_to_front
|
589
|
-
dir ||= LocalStorage[caller.inspect]
|
590
|
-
got = FileDialog.new_previously_existing_file_selector_and_go title, dir
|
591
|
-
LocalStorage[caller.inspect] = File.dirname(got)
|
592
|
-
got
|
593
|
-
end
|
594
|
-
|
595
|
-
def show_in_explorer filename
|
596
|
-
SwingHelpers.show_in_explorer filename
|
597
|
-
end
|
598
|
-
|
599
|
-
end
|
600
|
-
|
601
|
-
end
|
602
|
-
|
603
|
-
class File
|
604
|
-
def self.get_root_dir this_path
|
605
|
-
this_path = File.expand_path this_path
|
606
|
-
if OS.doze?
|
607
|
-
this_path[0..2]
|
608
|
-
else
|
609
|
-
this_path.split('/')[0]
|
610
|
-
end
|
611
|
-
end
|
612
|
-
|
613
|
-
def self.strip_drive_windows this_complete_path
|
614
|
-
if OS.doze?
|
615
|
-
this_complete_path[2..-1]
|
616
|
-
else
|
617
|
-
this_complete_path
|
618
|
-
end
|
619
|
-
end
|
620
|
-
end
|