sensible-cinema 0.23.0 → 0.23.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 0.23.1 ==
2
+
3
+ It now *requires* outside files as file input, instead of just raw DVD's ever.
4
+ Also fixed up some unit tests.
5
+
1
6
  == 0.23.0 ==
2
7
 
3
8
  OS X compatibility. Though not heavily used it might work.
data/go.sh CHANGED
@@ -1 +1 @@
1
- jruby bin/sensible-cinema $1 $2 $3 $4 $5 # --create-mode
1
+ jruby bin/sensible-cinema $1 $2 $3 $4 $5 # --create-mode just realize that most buttons in create mode probably don't work yet in os x
@@ -0,0 +1,24 @@
1
+ Warning: before grabbing any video files from your DVD's,
2
+ please consult the is_it_legal_to_copy_dvds.txt file to
3
+ check for legal ramifications. Don't do anything illegal in
4
+ your country.
5
+
6
+ Basically, sensible cinema affords you 2 options.
7
+
8
+ Either stick the DVD in then click the "realtime play" button.
9
+ Or you can "grab" a video file off a DVD,
10
+ then Sensible Cinema will take it and slice and dice out the profanity et al,
11
+ creating for you an edited version of the video file (for an example,
12
+ you could download the Big Buck Bunny DVD ISO, and try
13
+ it out on that [1]).
14
+
15
+ Sensible Cinema only accepts raw "unencrypted" movie streams,
16
+ so you're going to have to get the movie file off the DVD somehow first.
17
+ There are a few options.
18
+ A couple of ways are to run something similar to that described here [2]
19
+ (mplayer, or makemkv + tsmuxer)
20
+
21
+ Good luck!
22
+
23
+ [1] http://www.archive.org/details/BigBuckBunny
24
+ [2] http://wiki.videolan.org/Rip_DVD#Related
@@ -15,33 +15,33 @@ and relies on you to use something else for that, on your own.
15
15
 
16
16
  It is controversial to use open source software to play/rip commercial DVD's.
17
17
  There are a few conflicting views.
18
- Sensible-cinema doesn't actually do any decryption or decoding, nor has any knowledge of it.
19
- It doesn't even have knowledge
20
- as to whether the DVD was originally encrypted or not, we chose a "you have to do the ripping through
21
- some other means" philosophy.
22
- You can ask the authors of the ripping programs if it is legal. Apparently
18
+ Sensible-cinema doesn't actually do any decryption or decoding, nor has any knowledge of how it occurred
19
+ originally.
20
+ It doesn't even have knowledge as to whether the DVD was originally encrypted or not, we choose a
21
+ "you have to do the ripping through some other means" philosophy, to avoid legal issues.
22
+ You can ask the authors of the ripping programs you use if their software is legal. Apparently
23
23
  libdvdcss (which the other programs that it calls out to use) has never been legally challenged in court (or so they say),
24
24
  and uses a slightly different algorithm than those that have, so the jury's still out. Possibly
25
- it has been challenged in French courts and found legal so it might vary from country to country [4].
25
+ it has been challenged in French courts and found legal so it might vary from country to country, as well [4].
26
26
 
27
27
  Using sensible-cinema also might not be more unethical than ripping your DVD collection to your hard
28
- drive so you can "keep your DVD's all in one place" or what not (which might even be termed fair use), since it
28
+ drive so you can "keep your DVD's all in one place" or what not (which might perhaps be termed fair use), since it
29
29
  basically only saves parts from the original concatenated. Only original content is saved. It just happens to be bits and
30
30
  pieces that don't have the profanity.
31
31
  Note also that fair use at times does allow one to "record" things for personal use/backup (for example off the TV).
32
- Note that sensible cinema does require the original DVD to be present when using it, also, to help enforce copy protection,
33
- at least for watching it/using from within sensible cinema. Certainly do not rip DVD's you don't own.
32
+ Note also that sensible cinema does require the original DVD to be present when using it, to help enforce legality,
33
+ at least for watching it/using from within sensible cinema. Certainly, do not rip DVD's you don't own.
34
34
 
35
35
  If general, if it's not legal in your country, then don't use it!
36
36
  You are responsible for your actions and use of the program.
37
37
  It is possible that the authors of sensible-cinema are not cupable of anything
38
38
  regarding its use themselves, since they re-distribute no edited media,
39
- nor distribute cracking codes. Check your country's rules first. Be warned.
39
+ nor distribute cracking codes. Check your country's rules first. You have been warned.
40
40
 
41
- Note: do not redistribute or re-sell edited DVD's, certainly that is illegal.
41
+ Note: do not redistribute or re-sell edited DVD's, certainly that is illegal in the US.
42
42
  We have learned from clean flicks that redistributing
43
43
  (well at least renting/selling) edited commercial DVD's is illegal in the US.
44
- Please don't redistribute. Consult your lawyer.
44
+ Please don't redistribute. Consult your lawyer if you have any questions/concerns.
45
45
  DO NOT MAKE ILLEGAL COPIES.
46
46
  USE AT YOUR OWN RISK.
47
47
 
@@ -24,17 +24,18 @@ class DriveInfo
24
24
 
25
25
  def self.md5sum_disk(dir)
26
26
  if OS.mac?
27
- output = `#{__DIR__}/../vendor/mac_dvdid/bin/dvdid #{dir}`
27
+ command = "#{__DIR__}/../vendor/mac_dvdid/bin/dvdid #{dir}"
28
28
  else
29
- output = `#{__DIR__}/../vendor/dvdid.exe #{dir}`
29
+ command = "#{__DIR__}/../vendor/dvdid.exe #{dir}"
30
30
  end
31
- puts 'dvdid command failed?' unless $?.exitstatus == 0 # hope this accomodates for it barfing...
31
+ output = `#{command}`
32
+ puts 'dvdid command failed?' + command unless $?.exitstatus == 0 # hope this accomodates for it barfing...
32
33
  output.strip
33
34
  end
34
35
 
35
36
  def self.get_dvd_drives_as_openstruct
36
37
  disks = get_all_drives_as_ostructs
37
- disks.select{|d| d.Description =~ /CD-ROM/}
38
+ disks.select{|d| d.Description =~ /CD-ROM/ && File.exist?(d.Name + "/VIDEO_TS")}
38
39
  end
39
40
 
40
41
  def self.get_drive_with_most_space_with_slash
@@ -55,16 +56,19 @@ class DriveInfo
55
56
  d2.Description = parsed['OpticalDeviceType']
56
57
  d2.MountPoint = parsed['MountPoint']
57
58
  if d2.MountPoint == '/'
58
- d2.MountPoint = File.expand_path '~' # better ?
59
+ d2.MountPoint = File.expand_path '~' # better ? I guess?
59
60
  end
60
61
  d2
61
62
  }
62
63
  else
63
64
  require 'ruby-wmi'
64
65
  disks = WMI::Win32_LogicalDisk.find(:all)
65
- disks.map{|d| d2 = OpenStruct.new; d2.Description = d.Description; d2.VolumeName = d.VolumeName; d2.Name = d.Name;
66
+ disks.map{|d| d2 = OpenStruct.new
67
+ d2.Description = d.Description
68
+ d2.VolumeName = d.VolumeName
69
+ d2.Name = d.Name
66
70
  d2.FreeSpace = d.FreeSpace.to_i
67
- d2.MountPoint = d.Name[0..2]
71
+ d2.MountPoint = d.Name[0..2] # needed...
68
72
  d2
69
73
  }
70
74
  end
@@ -73,6 +77,5 @@ class DriveInfo
73
77
  end
74
78
 
75
79
  if $0 == __FILE__
76
- require 'pp'
77
80
  p DriveInfo.get_dvd_drives_as_openstruct
78
81
  end
@@ -15,7 +15,6 @@ This file is part of Sensible Cinema.
15
15
  You should have received a copy of the GNU General Public License
16
16
  along with Sensible Cinema. If not, see <http://www.gnu.org/licenses/>.
17
17
  =end
18
-
19
18
  class EdlParser
20
19
 
21
20
  def self.parse_file filename, ignore_settings = false
@@ -59,9 +58,9 @@ class EdlParser
59
58
  out
60
59
  end
61
60
 
62
- TimeStamp = /(^\d+:\d\d[\d:\.]*$|\d+)/
61
+ #TimeStamp = /(^\d+:\d\d[\d:\.]*$|\d+)/ # this one also allows for 4444 [?] and also weirdness like "don't kill the nice butterfly 2!" ...
62
+ TimeStamp = /^\d+:\d\d[\d:\.]*$/
63
63
  # starts with a digit, has at least one colon followed by two digits,then some combo of digits and colons and periods...
64
- # or just like 5057 s
65
64
 
66
65
  def self.extract_entry! from_this
67
66
  return nil if from_this.length == 0
@@ -112,7 +111,6 @@ class EdlParser
112
111
  end
113
112
  mutes = incoming["mutes"] || {}
114
113
  blanks = incoming["blank_outs"] || {}
115
- p 'incoming', incoming, splits
116
114
  mutes = mutes.map{|k, v| get_secs(k, v, -add_this_to_mutes_beginning, add_this_to_mutes_end, splits) + [:mute]}
117
115
  blanks = blanks.map{|k, v| get_secs(k, v, -add_this_to_mutes_beginning, add_this_to_mutes_end, splits) + [:blank]}
118
116
  combined = (mutes+blanks).sort
@@ -189,7 +187,7 @@ class EdlParser
189
187
 
190
188
  end
191
189
 
192
- # == 1.8.7 Symbol compat
190
+ # == 1.8.7 1.9 Symbol compat
193
191
 
194
192
  class Symbol
195
193
  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Symbol.html]
@@ -199,6 +197,9 @@ class Symbol
199
197
  end unless method_defined? :"<=>"
200
198
  end
201
199
 
202
- if RUBY_VERSION < '1.8.7'
203
- raise 'needs ruby 1.8.7 at least'
204
- end
200
+ if $0 == __FILE__
201
+ p 'syntax: filename'
202
+ require 'rubygems'
203
+ require 'sane'
204
+ p EdlParser.parse_file *ARGV
205
+ end
@@ -17,10 +17,8 @@ This file is part of Sensible Cinema.
17
17
  =end
18
18
  require 'java'
19
19
 
20
- module FileChooser
20
+ module FileChooser # used in the cli only...
21
21
 
22
- # show a popup dialog prompting for them to select a file
23
- # pretty ugly
24
22
  def choose_file(title, use_this_dir = nil)
25
23
 
26
24
  fc = java.awt.FileDialog.new(nil, title)
@@ -35,16 +35,16 @@ class MencoderWrapper
35
35
  # "This will result in a slightly bigger file, but will not cause problems when demuxing or remuxing into other container formats." LODO no harddup ok ???
36
36
  # lodo: can I use ffmpeg to unmux-ify/GOP'ify perhaps?
37
37
  # LODO 24000/1001 ?
38
- video_opts = "-vf scale=pullup,softskip,harddup -ovc lavc -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=1:vstrict=0:acodec=ac3:abitrate=192:autoaspect -ofps 30000/1001"
39
- out += "mencoder \"#{this_file.gsub('"', '\\"')}\" -of mpeg -mpegopts format=dvd:tsaf -alang en -nocache -sid 1000 -oac #{audio_codec} #{video_opts} -o #{@big_temp} -dvd-device #{this_drive} && echo done_grabbing > #{@big_temp}.done\n"
38
+ video_opts = "-vf scale=720:480,pullup,softskip,harddup -ovc lavc -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=1:vstrict=0:acodec=ac3:abitrate=192:autoaspect -ofps 30000/1001"
39
+ out += "mencoder \"#{this_file.gsub('"', '\\"')}\" -of mpeg -mpegopts format=dvd:tsaf -alang en -nocache -sid 1000 -oac #{audio_codec} #{video_opts} -o #{@big_temp} -dvd-device #{this_file} && echo done_grabbing > #{@big_temp}.done\n"
40
40
  end
41
41
 
42
- def calculate_final_filename to_here_final_file
42
+ def calculate_fulli_filename to_here_final_file
43
43
  @big_temp = to_here_final_file + ".fulli_unedited.tmp.mpg"
44
44
  end
45
45
 
46
46
  # called from the UI...
47
- def get_bat_commands these_settings, this_drive, to_here_final_file, start_here = nil, end_here = nil, dvd_title_track = "1", delete_partials = false, require_deletion_entry = false
47
+ def get_bat_commands these_settings, this_from_file, to_here_final_file, start_here = nil, end_here = nil, dvd_title_track = "1", delete_partials = false, require_deletion_entry = false
48
48
  combined = EdlParser.convert_incoming_to_split_sectors these_settings
49
49
  @dvd_title_track = dvd_title_track
50
50
  assert dvd_title_track
@@ -59,8 +59,8 @@ class MencoderWrapper
59
59
  else
60
60
  previous_end = 0
61
61
  end
62
- calculate_final_filename to_here_final_file
63
- out = get_header this_drive, these_settings
62
+ calculate_fulli_filename to_here_final_file
63
+ out = get_header this_from_file, these_settings
64
64
  @idx = 0
65
65
  combined.each {|start, endy, type|
66
66
  if start > previous_end
@@ -141,10 +141,6 @@ module SubtitleProfanityFinder
141
141
 
142
142
  # sanitize
143
143
  for (prof2, (sanitized2, whole_word2)) in all_profanity_combinations
144
- if sanitized_glop =~ prof2
145
- require 'ruby-debug'
146
- #debugger
147
- end
148
144
  if sanitized_glop =~ prof2
149
145
  sanitized_glop.gsub!(prof2, sanitized2)
150
146
  end
@@ -48,12 +48,22 @@ module SensibleSwing
48
48
  self
49
49
  end
50
50
 
51
- def simulate_click
52
- @block.call
53
- end
51
+ def simulate_click
52
+ @block.call
53
+ end
54
+
55
+ def tool_tip= text
56
+ if text
57
+ text = "<html>" + text + "</html>"
58
+ text = text.gsub("\n", "<br/>")
59
+ end
60
+ self.set_tool_tip_text text
61
+ end
54
62
 
55
63
  end
56
64
 
65
+ ToolTipManager.sharedInstance().setDismissDelay(java.lang.Integer::MAX_VALUE) # don't timeout tooltips...
66
+
57
67
  class JFrame
58
68
  def close
59
69
  dispose # sigh
@@ -61,6 +71,8 @@ module SensibleSwing
61
71
  end
62
72
 
63
73
  class JFileChooser
74
+ # also set_current_directory et al...
75
+
64
76
  # raises on failure...
65
77
  def go
66
78
  success = show_open_dialog nil
@@ -79,8 +91,10 @@ module SensibleSwing
79
91
  set_selected_file JFile.new(f)
80
92
  end
81
93
  alias setFile set_file
94
+
82
95
  end
83
96
 
97
+ # awt...
84
98
  class FileDialog
85
99
  def go
86
100
  show
@@ -123,6 +137,3 @@ class String
123
137
  end
124
138
  end
125
139
  end
126
-
127
- # code examples
128
- # JOptionPane.showInputDialog(nil, "not implemented yet", "not implemented yet", JOptionPane::ERROR_MESSAGE)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sensible-cinema}
8
- s.version = "0.23.0"
8
+ s.version = "0.23.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roger Pack"]
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
36
36
  "goc.bat",
37
37
  "gplv3.txt",
38
38
  "how_to_create_your_own_delete_lists.txt",
39
+ "how_to_get_files_from_dvd.txt",
39
40
  "is_it_legal_to_copy_dvds.txt",
40
41
  "legal/md5s.txt",
41
42
  "legal/transcript_mute_vlc.txt",
@@ -46,7 +47,6 @@ Gem::Specification.new do |s|
46
47
  "lib/check_installed_mac.rb",
47
48
  "lib/count_down_timer_jruby_swing.rb",
48
49
  "lib/drive_info.rb",
49
- "lib/edl_converter.rb",
50
50
  "lib/edl_parser.rb",
51
51
  "lib/fake_blanker.rb",
52
52
  "lib/file_chooser.rb",
@@ -114,12 +114,13 @@ Gem::Specification.new do |s|
114
114
  "vendor/readme.txt",
115
115
  "www/index.html",
116
116
  "zamples/edit_decision_lists/category descriptions.txt",
117
- "zamples/edit_decision_lists/dvds/COOL_RUNNINGS.txt",
118
117
  "zamples/edit_decision_lists/dvds/Harry Potter 2.txt",
119
118
  "zamples/edit_decision_lists/dvds/bambi.txt",
120
119
  "zamples/edit_decision_lists/dvds/big_buck_bunny_dvd.txt",
121
120
  "zamples/edit_decision_lists/dvds/bob the builder pets in a pickle.txt",
122
121
  "zamples/edit_decision_lists/dvds/bobs_big_plan.txt",
122
+ "zamples/edit_decision_lists/dvds/cool runnings.txt",
123
+ "zamples/edit_decision_lists/dvds/edl_for_unit_tests.txt",
123
124
  "zamples/edit_decision_lists/dvds/example_delete_list.txt",
124
125
  "zamples/edit_decision_lists/dvds/happiest baby on the block.txt",
125
126
  "zamples/edit_decision_lists/dvds/how_to_train_your_dragon.txt",
@@ -139,7 +140,7 @@ Gem::Specification.new do |s|
139
140
  "zamples/edit_decision_lists/dvds/tron_legacy.txt",
140
141
  "zamples/edit_decision_lists/dvds/turn_around_alma_younger.txt",
141
142
  "zamples/edit_decision_lists/dvds/zz_example_delete_list_that_has_no_cuts_in_it.txt",
142
- "zamples/edit_decision_lists/netflix/greatest_story_ever_told_netflix.txt",
143
+ "zamples/edit_decision_lists/netflix_instant/greatest_story_ever_told_netflix.txt",
143
144
  "zamples/edit_decision_lists/old_not_yet_updated/example_edit_decision_list.txt",
144
145
  "zamples/edit_decision_lists/old_not_yet_updated/youtube/gummy_bear_song_youtube.txt",
145
146
  "zamples/edit_decision_lists/youtube/demo_mutes.txt",
@@ -165,6 +166,7 @@ Gem::Specification.new do |s|
165
166
  s.specification_version = 3
166
167
 
167
168
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
169
+ s.add_runtime_dependency(%q<os>, [">= 0.9.3"])
168
170
  s.add_runtime_dependency(%q<sane>, [">= 0.22.0"])
169
171
  s.add_runtime_dependency(%q<rdp-win32screenshot>, [">= 0.0.7.3"])
170
172
  s.add_runtime_dependency(%q<mini_magick>, [">= 3.1"])
@@ -182,6 +184,7 @@ Gem::Specification.new do |s|
182
184
  s.add_runtime_dependency(%q<jeweler>, [">= 0"])
183
185
  s.add_runtime_dependency(%q<rake>, [">= 0"])
184
186
  else
187
+ s.add_dependency(%q<os>, [">= 0.9.3"])
185
188
  s.add_dependency(%q<sane>, [">= 0.22.0"])
186
189
  s.add_dependency(%q<rdp-win32screenshot>, [">= 0.0.7.3"])
187
190
  s.add_dependency(%q<mini_magick>, [">= 3.1"])
@@ -200,6 +203,7 @@ Gem::Specification.new do |s|
200
203
  s.add_dependency(%q<rake>, [">= 0"])
201
204
  end
202
205
  else
206
+ s.add_dependency(%q<os>, [">= 0.9.3"])
203
207
  s.add_dependency(%q<sane>, [">= 0.22.0"])
204
208
  s.add_dependency(%q<rdp-win32screenshot>, [">= 0.0.7.3"])
205
209
  s.add_dependency(%q<mini_magick>, [">= 3.1"])
@@ -37,7 +37,7 @@ describe EdlParser do
37
37
  "missing_content"=>"this doesn't list some mild name calling",
38
38
  "title"=>"Forever Strong", "source"=>"Hulu", "url"=>"http://www.byutv.org/watch/1790-100",
39
39
  "whatever_else_you_want"=>"this is the old version of the film",
40
- "disk_unique_id"=>"19d131ae8dc40cdd70b57ab7e8c74f76"
40
+ "disk_unique_id"=>"1234|4678"
41
41
  }
42
42
  E.parse_string(string, nil).should == expected
43
43
  end
@@ -60,17 +60,16 @@ describe EdlParser do
60
60
 
61
61
  it "should detect timestamps well" do
62
62
  t = EdlParser::TimeStamp
63
- "2:01".should match(t)
64
- "1:01.5".should match(t)
65
- "00:00:00.5".should match(t)
66
- "00:00:00".should match(t)
63
+ for ts in ["2:01", "1:01.5", "00:00:00.5","00:00:00", "1:23", "01:23"]
64
+ raise ts unless t =~ ts
65
+ end
67
66
  "5".should_not match(t)
68
67
  "category".should_not match(t)
69
68
  end
70
69
 
71
70
  it "should parse a real file" do
72
71
  E.parse_file(File.expand_path(__dir__) + "/../zamples/edit_decision_lists/dvds/bobs_big_plan.txt").should ==
73
- {"title"=>"Bob's Big Plan", "dvd_title_track"=>1, "other notes"=>"could use more nit-picking of the song, as some parts seem all right in the end", "disk_unique_id"=>"259961ce38971cac3e28214ec4ec278b", "mutes"=>[["00:03.8", "01:03", "theme song is a bit raucous at times"], ["28:13.5", "29:40", "theme song again"], ["48:46", "49:08", "theme song again"]], "blank_outs"=>[]}
72
+ {"title"=>"Bob's Big Plan", "dvd_title_track"=>1, "other notes"=>"could use more nit-picking of the song, as some parts seem all right in the end", "mutes"=>[["00:03.8", "01:03", "theme song is a bit raucous at times"], ["28:13.5", "29:40", "theme song again"], ["48:46", "49:08", "theme song again"]], "blank_outs"=>[]}
74
73
  end
75
74
 
76
75
  it "should be able to use personal preferences to decide which edits to make" do
@@ -43,17 +43,18 @@ describe MencoderWrapper do
43
43
  end
44
44
 
45
45
  it "should have what looks like a working mencoder grab command" do
46
- @out.should match(/mencoder dvdnav:/)
47
- @out.should match(/dvdnav.*lavcopt.*keyint=1/)
46
+ @out.should_not match(/dvd:\//)
47
+ @out.should_not match(/dvdnav:\//)
48
+ @out.should match(/mencoder.*lavcopt.*keyint=1/)
48
49
  use_mpg2_fulli_unedited = true
49
50
  if use_mpg2_fulli_unedited
50
- @out.should match(/dvdnav.*lavcopt.*mpeg2video/)
51
+ @out.should match(/mencoder.*lavcopt.*mpeg2video/)
51
52
  @out.should match(/autoaspect/) # try to preserve aspect
52
53
  else
53
- @out.should match(/dvdnav.*-ovc copy/)
54
+ @out.should match(/mencoder.*-ovc copy/)
54
55
  end
55
56
  # "poor" audio for certain DVD's <sigh>
56
- @out.should match(/dvdnav.*-oac lavc/)
57
+ @out.should match(/mencoder.*-oac lavc/)
57
58
  end
58
59
 
59
60
  it "should not double setting params" do
data/spec/notes CHANGED
@@ -1,11 +1,17 @@
1
1
  up next:
2
2
  lighning exact frame to compare the two fulli's...
3
3
 
4
+ == XBMC not need a plugin? ==
5
+
6
+ http://forum.xbmc.org/showthread.php?t=28795 XBMC doesn't support real-time DVD EDL playback at all <sniff>
7
+ ps3ms edl maybe though...
8
+
4
9
  == subtitle accuracy ==
10
+
5
11
  narnia dawn treader had 1 subtitle that was "hand crafted", had the wrong timestamps, but was more accurate.
6
12
  The several others were accurate though.
7
13
 
8
- == ? ==
14
+ == auto subtitle download for a DVD ==
9
15
 
10
16
  opensubtitles' viewer gets "nothing" for subtitles of DVD's...smplayer requires you to manually search, too...
11
17
  splayer doesn't seem to attempt auto-download either of subs for DVD's. Feels so nice tho :P
@@ -28,10 +28,10 @@ module SensibleSwing
28
28
  MainWindow.new.dispose# doesn't crash :)
29
29
  end
30
30
 
31
- Sintel_ID = '79df7b12|8b27d001'
31
+ Test_DVD_ID = 'deadbeef|8b27d001'
32
32
 
33
33
  it "should auto-select a EDL if it matches a DVD's title" do
34
- MainWindow.new.single_edit_list_matches_dvd(Sintel_ID).should_not be nil
34
+ MainWindow.new.single_edit_list_matches_dvd(Test_DVD_ID).should_not be nil
35
35
  end
36
36
 
37
37
  it "should not auto-select if you pass it nil" do
@@ -116,11 +116,11 @@ module SensibleSwing
116
116
  before do
117
117
  @subject = MainWindow.new
118
118
  @subject.stub!(:choose_dvd_drive) {
119
- ["mock_dvd_drive", "Volume", Sintel_ID] # happiest baby on the block
119
+ ["mock_dvd_drive", "Volume", Test_DVD_ID] # happiest baby on the block
120
120
  }
121
121
  @subject.stub!(:get_mencoder_commands) { |*args|
122
122
  args[-5].should match(/abc/)
123
- @args = args
123
+ @get_mencoder_commands_args = args
124
124
  'fake get_mencoder_commands'
125
125
  }
126
126
  @subject.stub!(:new_filechooser) {
@@ -165,6 +165,8 @@ module SensibleSwing
165
165
  class FakeFileChooser
166
166
  def set_title x; end
167
167
  def set_file y; end
168
+ def set_current_directory x; end
169
+ def get_current_directory ; 'a great dir!'; end
168
170
  def go
169
171
  'abc'
170
172
  end
@@ -174,13 +176,26 @@ module SensibleSwing
174
176
  def click_button(name)
175
177
  @subject.instance_variable_get(name).simulate_click
176
178
  end
179
+
180
+ it "should be able to run system" do
181
+ @subject.system_non_blocking "ls"
182
+ end
177
183
 
178
184
  it "should be able to do a normal copy to hard drive, edited" do
179
- @subject.system_non_blocking "ls"
180
185
  @subject.do_copy_dvd_to_hard_drive(false).should == [false, "abc.fulli_unedited.tmp.mpg"]
181
186
  File.exist?('test_file_to_see_if_we_have_permission_to_write_to_this_folder').should be false
182
187
  end
183
188
 
189
+ it "should prompt twice for filenames--once for the 'to' filename, once for the 'from' filename" do
190
+ count = 0
191
+ @subject.stub!(:new_filechooser) {
192
+ count += 1
193
+ FakeFileChooser.new
194
+ }
195
+ @subject.do_copy_dvd_to_hard_drive(false).should == [false, "abc.fulli_unedited.tmp.mpg"]
196
+ count.should == 2
197
+ end
198
+
184
199
  it "should have a good default title of 1" do
185
200
  @subject.get_title_track({}).should == "1"
186
201
  descriptors = {"dvd_title_track" => "3"}
@@ -193,7 +208,7 @@ module SensibleSwing
193
208
  }
194
209
  @subject.do_copy_dvd_to_hard_drive(false)
195
210
  @subject.background_thread.join
196
- @args[-4].should == nil
211
+ @get_mencoder_commands_args[-4].should == nil
197
212
  @system_blocking_command.should match /explorer/
198
213
  @system_blocking_command.should_not match /fulli/
199
214
  @played.should == true
@@ -208,22 +223,22 @@ module SensibleSwing
208
223
  it "should call explorer eventually, if it has to create the fulli file" do
209
224
  @subject.do_copy_dvd_to_hard_drive(true).should == [false, "abc.fulli_unedited.tmp.mpg"]
210
225
  join_background_thread
211
- @args[-2].should == 1
212
- @args[-3].should == "01:00"
226
+ @get_mencoder_commands_args[-2].should == "2"
227
+ @get_mencoder_commands_args[-3].should == "01:00"
213
228
  @system_non_blocking_command.should match /smplayer/
214
229
  @system_non_blocking_command.should_not match /fulli/
215
230
  end
216
231
 
217
- def prompt_for_start_and_end_times
232
+ def run_preview_section_button_successfully
218
233
  click_button(:@preview_section)
219
234
  join_background_thread
220
- @args[-2].should == 1
221
- @args[-3].should == "01:00"
235
+ @get_mencoder_commands_args[-2].should == "2"
236
+ @get_mencoder_commands_args[-3].should == "01:00"
222
237
  @system_non_blocking_command.should match /smplayer/
223
238
  end
224
239
 
225
240
  it "should prompt for start and end times" do
226
- prompt_for_start_and_end_times
241
+ run_preview_section_button_successfully
227
242
  end
228
243
 
229
244
  temp_dir = Dir.tmpdir
@@ -250,12 +265,12 @@ module SensibleSwing
250
265
  end
251
266
 
252
267
  it "should be able to rerun the latest start and end times with the rerun button" do
253
- prompt_for_start_and_end_times
254
- old_args = @args
268
+ run_preview_section_button_successfully
269
+ old_args = @get_mencoder_commands_args
255
270
  old_args.should_not == nil
256
- @args = nil
271
+ @get_mencoder_commands_args = nil
257
272
  click_button(:@rerun_preview).join
258
- @args.should == old_args
273
+ @get_mencoder_commands_args.should == old_args
259
274
  @system_non_blocking_command.should match(/smplayer/)
260
275
  end
261
276
 
@@ -276,11 +291,10 @@ module SensibleSwing
276
291
  end
277
292
 
278
293
  it "should warn if you watch an edited time frame with no edits in it" do
279
- @subject.unstub!(:get_mencoder_commands)
294
+ @subject.unstub!(:get_mencoder_commands) # this time through, let it check for existence of edits...
280
295
  click_button(:@preview_section)
281
296
  @show_blocking_message_dialog_last_arg.should =~ /unable to/
282
297
  @subject.stub!(:get_user_input).and_return('06:00', '07:00')
283
- # rspec bug: wrong'ish backtrace: proc { prompt_for_start_and_end_times #}.should_not raise_error LODO
284
298
  click_button(:@preview_section)
285
299
  join_background_thread
286
300
  @system_blocking_command.should == "echo wrote (probably successfully) to abc.avi"
@@ -289,7 +303,7 @@ module SensibleSwing
289
303
  it "if the .done files exists, watch unedited should call smplayer ja" do
290
304
  FileUtils.touch "abc.fulli_unedited.tmp.mpg.done"
291
305
  @subject.instance_variable_get(:@watch_unedited).simulate_click
292
- @system_non_blocking_command.should == "smplayer abc.fulli_unedited.tmp.mpg"
306
+ @system_non_blocking_command.should == "smplayer_portable abc.fulli_unedited.tmp.mpg"
293
307
  FileUtils.rm "abc.fulli_unedited.tmp.mpg.done"
294
308
  end
295
309
 
@@ -332,7 +346,7 @@ module SensibleSwing
332
346
  @system_blocking_command.should match(/-dvd-device /)
333
347
  end
334
348
 
335
- it "should play edl with elongated mutes" do
349
+ it "should play edl with extra time for the mutes because of the EDL aspect" do
336
350
  click_button(:@mplayer_edl).join
337
351
  wrote = File.read(MainWindow::EdlTempFile)
338
352
  # normally "378.0 379.1 1"
@@ -374,17 +388,16 @@ module SensibleSwing
374
388
  count += 1
375
389
  FakeFileChooser.new
376
390
  }
377
- @subject.get_save_to_filename 'yo'
378
- @subject.get_save_to_filename 'yo'
379
- count.should == 1
391
+ 3.times { @subject.do_copy_dvd_to_hard_drive(false) }
392
+ count.should == 2 # else would have been 6...
380
393
  end
381
394
 
382
395
  describe 'with unstubbed choose_dvd_drive' do
383
396
  before do
384
397
  DriveInfo.stub!(:get_dvd_drives_as_openstruct) {
385
398
  a = OpenStruct.new
386
- # NB no VolumeName set
387
- a.Name = 'a name'
399
+ a.VolumeName = 'a dvd name'
400
+ a.Name = 'a path location'
388
401
  [a]
389
402
  }
390
403
  @subject.unstub!(:choose_dvd_drive)
@@ -394,7 +407,7 @@ module SensibleSwing
394
407
  count = 0
395
408
  DriveInfo.stub!(:md5sum_disk) {
396
409
  count += 1
397
- Sintel_ID
410
+ Test_DVD_ID
398
411
  }
399
412
  @subject.choose_dvd_and_edl_for_it
400
413
  @subject.choose_dvd_and_edl_for_it
@@ -402,15 +415,21 @@ module SensibleSwing
402
415
  end
403
416
 
404
417
  it "should prompt you if you need to insert a dvd" do
405
- proc {@subject.choose_dvd_drive}.should raise_error(/might not yet have.*in it/)
418
+ DriveInfo.stub!(:get_dvd_drives_as_openstruct) {
419
+ a = OpenStruct.new
420
+ #a.VolumeName = 'a dvd name' # we "don't have one" for this test...
421
+ a.Name = 'a path location'
422
+ [a]
423
+ }
424
+ proc {@subject.choose_dvd_drive}.should raise_error(SystemExit)
406
425
  @show_blocking_message_dialog_last_arg.should_not be nil
407
426
  end
408
427
  end
409
428
 
410
429
  it "should not show the normal buttons in create mode" do
411
- MainWindow.new.buttons.length.should == 3 # exit button, two normal buttons
430
+ MainWindow.new.buttons.length.should == 3 # exit button plus two normal buttons
412
431
  ARGV << "--create-mode"
413
- MainWindow.new.buttons.length.should == 12
432
+ MainWindow.new.buttons.length.should == 15 # all of them :P
414
433
  ARGV.pop # test cleanup--why not :)
415
434
  end
416
435
 
@@ -434,6 +453,20 @@ module SensibleSwing
434
453
  end
435
454
  end
436
455
 
456
+ it "should be able to parse an srt for ya" do
457
+ @subject.stub!(:new_filechooser) {
458
+ fc = FakeFileChooser.new
459
+ fc.stub!(:go) {
460
+ 'spec/dragon.srt'
461
+ }
462
+ fc
463
+ }
464
+ file = SensibleSwing::MainWindow::EdlTempFile
465
+ FileUtils.rm_rf file
466
+ click_button(:@parse_srt)
467
+ assert File.read(file).contain? "deitys"
468
+ end
469
+
437
470
  end # describe MainWindow
438
471
 
439
472
  end