sensible-cinema 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +2 -5
- data/VERSION +1 -1
- data/bin/AboutDialog.class +0 -0
- data/bin/AboutDialog.java +38 -0
- data/bin/ComboBoxes$1.class +0 -0
- data/bin/ComboBoxes$2.class +0 -0
- data/bin/ComboBoxes.class +0 -0
- data/bin/ComboBoxes.java +67 -0
- data/bin/sensible-cinema +138 -85
- data/bin/sensible-cinema-cli +107 -0
- data/bin/sensible-cinema-hit-reload-twice-then-save-copy-of-for-death +105 -0
- data/bin/swing_helpers.rb +48 -0
- data/lib/vlc_programmer.rb +10 -6
- data/spec/vlc_programmer.spec.rb +5 -1
- data/zamples/scene_lists/dvds/all_dogs_go_to_heaven_dvd.yml +1 -1
- data/zamples/scene_lists/dvds/bobs_big_plan.yml +9 -0
- data/zamples/scene_lists/dvds/cars_disney.yml +1 -1
- metadata +23 -4
data/TODO
CHANGED
@@ -23,12 +23,9 @@
|
|
23
23
|
|
24
24
|
== random backlog ... note: just plow forward, to "grab" available ideas...except that for now, just what *I* plan on needing for myself (filters for what I need/want). ==
|
25
25
|
|
26
|
-
some real GUI...then I can have an 'edit preferences' button et al.
|
27
|
-
|
28
26
|
"sav-ize"
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
GUI to make that actually feasible
|
28
|
+
|
32
29
|
"ripperzy-ize"
|
33
30
|
can rip from DVD and then edit that
|
34
31
|
mplayer?
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.13.0
|
Binary file
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import java.awt.BorderLayout;
|
2
|
+
import java.awt.Dimension;
|
3
|
+
import java.awt.Point;
|
4
|
+
import java.awt.event.ActionEvent;
|
5
|
+
import java.awt.event.ActionListener;
|
6
|
+
import javax.swing.JButton;
|
7
|
+
import javax.swing.JDialog;
|
8
|
+
import javax.swing.JFrame;
|
9
|
+
import javax.swing.JLabel;
|
10
|
+
import javax.swing.JPanel;
|
11
|
+
public class AboutDialog extends JDialog implements ActionListener {
|
12
|
+
public AboutDialog(JFrame parent, String title, String message) {
|
13
|
+
super(parent, title, true);
|
14
|
+
if (parent != null) {
|
15
|
+
Dimension parentSize = parent.getSize();
|
16
|
+
Point p = parent.getLocation();
|
17
|
+
setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
|
18
|
+
}
|
19
|
+
JPanel messagePane = new JPanel();
|
20
|
+
messagePane.add(new JLabel(message));
|
21
|
+
getContentPane().add(messagePane);
|
22
|
+
JPanel buttonPane = new JPanel();
|
23
|
+
JButton button = new JButton("OK");
|
24
|
+
buttonPane.add(button);
|
25
|
+
button.addActionListener(this);
|
26
|
+
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
27
|
+
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
28
|
+
pack();
|
29
|
+
setVisible(true);
|
30
|
+
}
|
31
|
+
public void actionPerformed(ActionEvent e) {
|
32
|
+
setVisible(false);
|
33
|
+
dispose();
|
34
|
+
}
|
35
|
+
public static void main(String[] a) {
|
36
|
+
AboutDialog dlg = new AboutDialog(new JFrame(), "title", "message");
|
37
|
+
}
|
38
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
data/bin/ComboBoxes.java
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
|
2
|
+
// : c14:ComboBoxes.java
|
3
|
+
// Using drop-down lists.
|
4
|
+
// <applet code=ComboBoxes width=200 height=125></applet>
|
5
|
+
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
|
6
|
+
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
|
7
|
+
|
8
|
+
import java.awt.Container;
|
9
|
+
import java.awt.FlowLayout;
|
10
|
+
import java.awt.event.ActionEvent;
|
11
|
+
import java.awt.event.ActionListener;
|
12
|
+
|
13
|
+
import javax.swing.JApplet;
|
14
|
+
import javax.swing.JButton;
|
15
|
+
import javax.swing.JComboBox;
|
16
|
+
import javax.swing.JFrame;
|
17
|
+
import javax.swing.JTextField;
|
18
|
+
|
19
|
+
public class ComboBoxes extends JApplet {
|
20
|
+
private String[] description = { "Ebullient", "Obtuse", "Recalcitrant",
|
21
|
+
"Brilliant", "Somnescent", "Timorous", "Florid", "Putrescent" };
|
22
|
+
|
23
|
+
private JTextField t = new JTextField(15);
|
24
|
+
|
25
|
+
private JComboBox c = new JComboBox();
|
26
|
+
|
27
|
+
private JButton b = new JButton("Add items");
|
28
|
+
|
29
|
+
private int count = 0;
|
30
|
+
|
31
|
+
public void init() {
|
32
|
+
for (int i = 0; i < 4; i++)
|
33
|
+
c.addItem(description[count++]);
|
34
|
+
t.setEditable(false);
|
35
|
+
b.addActionListener(new ActionListener() {
|
36
|
+
public void actionPerformed(ActionEvent e) {
|
37
|
+
if (count < description.length)
|
38
|
+
c.addItem(description[count++]);
|
39
|
+
}
|
40
|
+
});
|
41
|
+
c.addActionListener(new ActionListener() {
|
42
|
+
public void actionPerformed(ActionEvent e) {
|
43
|
+
t.setText("index: " + c.getSelectedIndex() + " "
|
44
|
+
+ ((JComboBox) e.getSource()).getSelectedItem());
|
45
|
+
}
|
46
|
+
});
|
47
|
+
Container cp = getContentPane();
|
48
|
+
cp.setLayout(new FlowLayout());
|
49
|
+
cp.add(t);
|
50
|
+
cp.add(c);
|
51
|
+
cp.add(b);
|
52
|
+
}
|
53
|
+
|
54
|
+
public static void main(String[] args) {
|
55
|
+
run(new ComboBoxes(), 200, 125);
|
56
|
+
}
|
57
|
+
|
58
|
+
public static void run(JApplet applet, int width, int height) {
|
59
|
+
JFrame frame = new JFrame();
|
60
|
+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
61
|
+
frame.getContentPane().add(applet);
|
62
|
+
frame.setSize(width, height);
|
63
|
+
applet.init();
|
64
|
+
applet.start();
|
65
|
+
frame.setVisible(true);
|
66
|
+
}
|
67
|
+
} ///:~
|
data/bin/sensible-cinema
CHANGED
@@ -1,99 +1,152 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
3
2
|
puts 'Welcome to Sensible Cinema...'
|
3
|
+
|
4
4
|
require 'rubygems'
|
5
5
|
require 'sane'
|
6
|
+
require File.dirname(__FILE__) + '/swing_helpers'
|
7
|
+
load File.dirname(__FILE__) + '/sensible-cinema-cli'
|
8
|
+
require 'tmpdir'
|
9
|
+
require 'ruby-wmi'
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
11
|
+
module SensibleSwing
|
12
|
+
class MainWindow < JFrame
|
13
|
+
def initialize
|
14
|
+
super "Sensible-Cinema"
|
15
|
+
setDefaultCloseOperation JFrame::EXIT_ON_CLOSE
|
16
|
+
panel = JPanel.new
|
17
|
+
panel.set_layout nil
|
18
|
+
setSize 350,400
|
19
|
+
add panel # why can't I just slap these down?
|
20
|
+
|
21
|
+
jlabel = JLabel.new 'Welcome to Sensible Cinema'
|
22
|
+
happy = Font.new("Tahoma", Font::PLAIN, 11)
|
23
|
+
jlabel.setFont(happy)
|
24
|
+
jlabel.set_bounds(44,44,136,14)
|
25
|
+
panel.add jlabel
|
26
|
+
b = JButton.new( "Play Hulu, Youtube, or a DVD" ).on_clicked {
|
27
|
+
self.close
|
28
|
+
go_sc
|
29
|
+
}
|
30
|
+
b.set_bounds(44,120,200,23)
|
31
|
+
panel.add b
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
c=JButton.new( "Copy edited DVD to Hard Drive" )
|
34
|
+
c.on_clicked {
|
35
|
+
drive = choose_dvd_drive
|
36
|
+
fc = JFileChooser.new
|
37
|
+
fc.setFileSelectionMode(nil)
|
38
|
+
fc.set_dialog_title "Please pick a DVD descriptor file"
|
39
|
+
fc.set_current_directory(JFile.new( __dir__ + "/../zamples/scene_lists/dvds"))
|
40
|
+
descriptor_path = fc.go
|
41
|
+
descriptors = YAML.load_file descriptor_path
|
42
|
+
|
43
|
+
fc = JFileChooser.new
|
44
|
+
# LODO allow for spaces in save to file
|
45
|
+
fc.set_dialog_title "Pick a location to save it to (like 'my_dvd')"
|
46
|
+
save_to_file_name = ((descriptors["title"] || "my dvd") + ' edited').gsub(' ', '_').gsub( /\W/, '') # no punctuation for now...
|
47
|
+
fc.setSelectedFile(JFile.new(get_drive_with_most_space + save_to_file_name))
|
48
|
+
save_to = fc.go
|
49
|
+
# TODO don't pop up those annoying windows
|
50
|
+
dvd_title_track = descriptors["dvd_title_track"]
|
51
|
+
bat_file = VLCProgrammer.convert_to_full_xspf(descriptors, save_to, drive)
|
52
|
+
temp_dir = Dir.tmpdir
|
53
|
+
temp_file = temp_dir + '/' + 'convert_it.bat'
|
54
|
+
File.write(temp_file, bat_file)
|
55
|
+
p 'running', temp_file
|
56
|
+
# TODO change title to "running" or something, while it runs...
|
57
|
+
if !ARGV.find{|a| a == '--test'} && system(temp_file)
|
58
|
+
JOptionPane.showMessageDialog(nil, " Done--you may now watch file #{save_to}.ps in VLC player", "Done!", JOptionPane::ERROR_MESSAGE)
|
59
|
+
command = "explorer /e,/select,\"#{File.expand_path(save_to).gsub('/', '\\')}.ps\""
|
60
|
+
system command
|
61
|
+
File.delete temp_file
|
62
|
+
self.close
|
63
|
+
else
|
64
|
+
JOptionPane.showMessageDialog(nil, " Failed--please examine #{temp_file} and screen output and report back!", "Failed", JOptionPane::ERROR_MESSAGE)
|
65
|
+
end
|
66
|
+
# TODO warn if they don't have VLC installed...
|
67
|
+
# LODO warn if they will overwrite a file
|
68
|
+
}
|
69
|
+
|
70
|
+
c.set_bounds(44,180,200,23)
|
71
|
+
panel.add c
|
72
|
+
|
73
|
+
exit = JButton.new("Exit").on_clicked {
|
74
|
+
self.close
|
75
|
+
}
|
76
|
+
exit.set_bounds(44,320,200,23)
|
77
|
+
panel.add exit
|
78
|
+
|
79
|
+
reload = JButton.new( "reload code" ).on_clicked {
|
80
|
+
eval File.read(__FILE__), nil, __FILE__
|
81
|
+
p 're-evaled it'
|
82
|
+
}
|
83
|
+
reload.set_bounds(44,280,200,23)
|
84
|
+
panel.add reload if ARGV.find{|a| a == '--test'}
|
85
|
+
|
86
|
+
end
|
32
87
|
|
33
|
-
|
88
|
+
def exit_and_close
|
89
|
+
JOptionPane.showMessageDialog(nil, "exiting", "exiting", JOptionPane::ERROR_MESSAGE)
|
90
|
+
close
|
91
|
+
exit
|
92
|
+
end
|
34
93
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
player_description = ARGV.shift.to_s
|
40
|
-
if !File.exist?(player_description)
|
41
|
-
puts 'Please Select Computer Player'
|
42
|
-
player_description = FileChooser.choose_file(" SELECT COMPUTER PLAYER", __dir__ + "/../zamples/players")
|
43
|
-
end
|
44
|
-
|
45
|
-
scene_list = ARGV.shift.to_s
|
46
|
-
|
47
|
-
if scene_list == 'test'
|
48
|
-
overlay = nil
|
49
|
-
p 'got test...just doing screen dump'
|
50
|
-
$VERBOSE=true # adds some extra output
|
51
|
-
else
|
52
|
-
if !File.exist? scene_list
|
53
|
-
puts 'Select Scene Descriptions file'
|
54
|
-
scene_list = FileChooser.choose_file(" SELECT SCENE DESCRIPTIONS FILE", __dir__ + "/../zamples/scene_lists")
|
55
|
-
end
|
94
|
+
|
95
|
+
def choose_dvd_drive
|
96
|
+
opticals = get_dvd_drives
|
97
|
+
opticals.map!{|d| d.Name + "\\" + " (" + d.VolumeName + ")"}
|
56
98
|
|
57
|
-
if
|
58
|
-
|
59
|
-
|
99
|
+
if opticals.length != 1
|
100
|
+
dialog = GetDisk.new(self, opticals)
|
101
|
+
dialog.show
|
102
|
+
selected = dialog.selected
|
103
|
+
else
|
104
|
+
selected = opticals[0]
|
60
105
|
end
|
61
|
-
|
62
|
-
|
63
|
-
Blanker.startup
|
64
|
-
# todo start it late as it has an annoying startup blip
|
65
|
-
overlay = OverLayer.new(scene_list)
|
66
|
-
end
|
106
|
+
return selected[0..2]
|
107
|
+
end
|
67
108
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
109
|
+
def get_drive_with_most_space
|
110
|
+
disks = WMI::Win32_LogicalDisk.find(:all)
|
111
|
+
out = disks.sort_by{|d| d.FreeSpace}[-1].Name + "\\"
|
112
|
+
out
|
113
|
+
end
|
73
114
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
screen_tracker.dump_bmp
|
80
|
-
exit 1
|
81
|
-
end
|
82
|
-
screen_tracker.process_forever_in_thread
|
83
|
-
else
|
84
|
-
puts 'warning--not using any screen tracking...'
|
115
|
+
|
116
|
+
private
|
117
|
+
def get_dvd_drives
|
118
|
+
disks = WMI::Win32_LogicalDisk.find(:all)
|
119
|
+
disks.select{|d| d.Description =~ /CD-ROM/} # hope this works...
|
85
120
|
end
|
86
|
-
|
87
|
-
OCR.unserialize_cache_from_disk # do this every time so we don't delete it if they don't have one...
|
88
121
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
122
|
+
end
|
123
|
+
|
124
|
+
class GetDisk < JDialog
|
125
|
+
attr_reader :selected
|
126
|
+
def initialize parent, options_array
|
127
|
+
super parent, true
|
128
|
+
|
129
|
+
box = JComboBox.new
|
130
|
+
box.add_action_listener do |e|
|
131
|
+
idx = box.get_selected_index
|
132
|
+
if idx != 0
|
133
|
+
@selected = box.get_selected_item
|
134
|
+
dispose
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
box.add_item "Select DVD drive" # put something in index 0
|
139
|
+
options_array.each{|drive|
|
140
|
+
box.add_item drive
|
141
|
+
}
|
142
|
+
add box
|
143
|
+
pack
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
SensibleSwing::MainWindow.new.set_visible true
|
151
|
+
|
152
|
+
puts 'Please use the Sensible Cinema GUI window'
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'sane'
|
5
|
+
|
6
|
+
Thread.abort_on_exception=true #gah
|
7
|
+
|
8
|
+
for file in ['overlayer', 'keyboard_input', 'screen_tracker', 'mouse', 'file_chooser', 'ocr', 'vlc_programmer']
|
9
|
+
require_relative '../lib/' + file
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def go_sc(args=ARGV)
|
14
|
+
|
15
|
+
$VERBOSE = 1 if args.delete('-v')
|
16
|
+
$TEST = 1 if args.delete('-t')
|
17
|
+
if args.delete('--clear-cache')
|
18
|
+
OCR.clear_cache!
|
19
|
+
puts 'cleared cache'
|
20
|
+
end
|
21
|
+
|
22
|
+
$stderr.puts 'warning: currently windows only for certain parts currently' unless ENV['OS'] == 'Windows_NT'
|
23
|
+
|
24
|
+
if args.detect{|arg| arg == '-h' || arg == '--help'}
|
25
|
+
|
26
|
+
puts <<-END
|
27
|
+
|
28
|
+
syntax: player_description.yml|test scene_descriptions_list.yml [-t -v --clear-cache] (or nothing to prompt for files)
|
29
|
+
END
|
30
|
+
|
31
|
+
for file in Dir[__dir__ + '../zamples/mute*/*']
|
32
|
+
puts "\n", "Example file:", file + "\n\n", File.read(file)
|
33
|
+
end
|
34
|
+
|
35
|
+
exit 1
|
36
|
+
|
37
|
+
else
|
38
|
+
|
39
|
+
# allow for command line filenames
|
40
|
+
|
41
|
+
player_description = args.shift.to_s
|
42
|
+
if !File.exist?(player_description)
|
43
|
+
puts 'Please Select Computer Player'
|
44
|
+
player_description = FileChooser.choose_file(" SELECT COMPUTER PLAYER", __dir__ + "/../zamples/players")
|
45
|
+
end
|
46
|
+
|
47
|
+
scene_list = args.shift.to_s
|
48
|
+
|
49
|
+
if scene_list == 'test'
|
50
|
+
overlay = nil
|
51
|
+
p 'got test...just doing screen dump'
|
52
|
+
$VERBOSE=true # adds some extra output
|
53
|
+
else
|
54
|
+
if !File.exist? scene_list
|
55
|
+
puts 'Select Scene Descriptions file'
|
56
|
+
scene_list = FileChooser.choose_file(" SELECT SCENE DESCRIPTIONS FILE", __dir__ + "/../zamples/scene_lists")
|
57
|
+
end
|
58
|
+
|
59
|
+
if !scene_list
|
60
|
+
puts "error: have to specify a scene descriptions file\n or specify \"test\" on the command line if you just want to snapshot your player"
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
|
64
|
+
puts 'Selected scene descriptions file ' + File.basename(scene_list) + "\n\t(full path: #{scene_list})"
|
65
|
+
Blanker.startup
|
66
|
+
# todo start it late as it has an annoying startup blip
|
67
|
+
overlay = OverLayer.new(scene_list)
|
68
|
+
end
|
69
|
+
|
70
|
+
if File.exist? player_description.to_s
|
71
|
+
puts 'Selected player ' + File.basename(player_description) + "\n\t(full path: #{player_description})"
|
72
|
+
# this one doesn't use any updates, so just pass in file contents, not filename
|
73
|
+
screen_tracker = ScreenTracker.new_from_yaml File.binread(player_description), overlay
|
74
|
+
Mouse.jitter_forever_in_own_thread # when this ends you know a snapshot was taken...
|
75
|
+
|
76
|
+
# exit early if we just wanted a screen dump...a little kludgey...
|
77
|
+
unless overlay
|
78
|
+
puts 'warning--only doing screen dump in t-minus 4s...'
|
79
|
+
sleep 4
|
80
|
+
puts 'snap!'
|
81
|
+
screen_tracker.dump_bmp
|
82
|
+
exit 1
|
83
|
+
end
|
84
|
+
screen_tracker.process_forever_in_thread
|
85
|
+
else
|
86
|
+
puts 'warning--not using any screen tracking...'
|
87
|
+
end
|
88
|
+
|
89
|
+
OCR.unserialize_cache_from_disk # do this every time so we don't delete it if they don't have one...
|
90
|
+
|
91
|
+
puts "Opening the curtains... (please play in player now)"
|
92
|
+
overlay.start_thread true
|
93
|
+
key_input = KeyboardInput.new overlay
|
94
|
+
key_input.start_thread # status thread
|
95
|
+
at_exit {
|
96
|
+
Blanker.shutdown # lodo move this and the 'q' key to within overlayer
|
97
|
+
OCR.serialize_cache_to_disk
|
98
|
+
}
|
99
|
+
key_input.handle_keystrokes_forever # when this method exits, we want to exit fully...
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
if __FILE__ == $0
|
105
|
+
puts 'Welcome to Sensible Cinema...'
|
106
|
+
go_sc
|
107
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
puts 'Welcome to Sensible Cinema...'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ruby-wmi'
|
5
|
+
require 'swing_helpers'
|
6
|
+
|
7
|
+
module SensibleSwing
|
8
|
+
class MainWindow < JFrame
|
9
|
+
def initialize
|
10
|
+
super "Sensible-Cinema"
|
11
|
+
setDefaultCloseOperation JFrame::EXIT_ON_CLOSE
|
12
|
+
panel = JPanel.new
|
13
|
+
panel.set_layout nil
|
14
|
+
setSize 350,400
|
15
|
+
add panel # why can't I just slap these down?
|
16
|
+
|
17
|
+
jlabel = JLabel.new 'Welcome to Sensible Cinema'
|
18
|
+
happy = Font.new("Tahoma", Font::PLAIN, 11)
|
19
|
+
jlabel.setFont(happy)
|
20
|
+
jlabel.set_bounds(44,44,136,14)
|
21
|
+
panel.add jlabel
|
22
|
+
|
23
|
+
c=JButton.new( "Save local copy of an edited DVD" )
|
24
|
+
c.on_clicked {
|
25
|
+
drive = get_disk_name
|
26
|
+
=begin
|
27
|
+
fc = JFileChooser.new
|
28
|
+
fc.setFileSelectionMode(nil)
|
29
|
+
fc.set_dialog_title "Please pick a DVD descriptor file"
|
30
|
+
fc.set_current_directory(JFile.new( __dir__ + "/../zamples/scene_lists/dvds"))
|
31
|
+
descriptor = fc.execute
|
32
|
+
fc = JFileChooser.new
|
33
|
+
# TODO allow for spaces in save to file
|
34
|
+
fc.set_dialog_title "Pick a location to save it to (like 'my_dvd')"
|
35
|
+
fc.setCurrentDirectory(JFile.new("c:\\"))
|
36
|
+
save_to = fc.execute
|
37
|
+
p [drive, descriptor, save_to]
|
38
|
+
descriptors = YAML.load_file descriptor
|
39
|
+
bat_file = VLCProgrammer.convert_to_full_xspf(descriptors, save_to, drive)
|
40
|
+
temp_dir = Dir.tmpdir
|
41
|
+
temp_file = temp_dir + '/' + 'convert_it.bat'
|
42
|
+
File.write(temp_file, bat_file)
|
43
|
+
p 'running', temp_file
|
44
|
+
p 'got', system(temp_file)
|
45
|
+
JOptionPane.showMessageDialog(nil, " Done--you may now watch file #{save_to}.ps in VLC player", "Done!", JOptionPane::ERROR_MESSAGE)
|
46
|
+
self.close
|
47
|
+
=end
|
48
|
+
}
|
49
|
+
c.set_bounds(44,180,200,23)
|
50
|
+
panel.add c
|
51
|
+
|
52
|
+
reload = JButton.new( "reload code" ).on_clicked {
|
53
|
+
eval File.read(__FILE__), nil, __FILE__
|
54
|
+
p 're-evaled it'
|
55
|
+
}
|
56
|
+
reload.set_bounds(44,280,200,23)
|
57
|
+
panel.add reload # if ARGV.find{|a| a == '--test'}
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
def exit_and_close
|
62
|
+
JOptionPane.showMessageDialog(nil, "exiting", "exiting", JOptionPane::ERROR_MESSAGE)
|
63
|
+
close
|
64
|
+
exit
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_disk_name
|
68
|
+
disks = WMI::Win32_LogicalDisk.find(:all)
|
69
|
+
|
70
|
+
opticals = disks.select{|d| d.Description =~ /CD-ROM/}
|
71
|
+
|
72
|
+
opticals.map!{|d| [d.Name + "\\", d.VolumeName]}
|
73
|
+
p opticals
|
74
|
+
p 'showing dialog'
|
75
|
+
dialog = GetDisk.new(self, opticals)
|
76
|
+
p 'done showing dialog'
|
77
|
+
|
78
|
+
return opticals[0][0]
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
class GetDisk < JDialog
|
85
|
+
def initialize parent, options_array
|
86
|
+
super parent, true
|
87
|
+
|
88
|
+
box = JComboBox.new
|
89
|
+
box.add_action_listener do |e|
|
90
|
+
p 'chosen perhaps?', e, box.get_selected_index, e.get_source, get_selected_item
|
91
|
+
#dispose if
|
92
|
+
end
|
93
|
+
box.add_item "Select DVD drive"
|
94
|
+
box.add_item "halloo"
|
95
|
+
|
96
|
+
add box
|
97
|
+
pack
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
SensibleSwing::MainWindow.new.set_visible true
|
104
|
+
|
105
|
+
puts 'Please see the Sensible Cinema window'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'java'
|
2
|
+
module SensibleSwing
|
3
|
+
include_package 'javax.swing'
|
4
|
+
[JButton, JFrame, JLabel, JPanel, JOptionPane,
|
5
|
+
JFileChooser, JComboBox, JDialog] # grab these constants (http://jira.codehaus.org/browse/JRUBY-5107)
|
6
|
+
include_package 'java.awt'
|
7
|
+
[FlowLayout, Font]
|
8
|
+
include_class 'java.awt.event.ActionListener'
|
9
|
+
JFile = java.io.File
|
10
|
+
|
11
|
+
class JButton
|
12
|
+
def initialize *args
|
13
|
+
super *args
|
14
|
+
set_font Font.new("Tahoma", Font::PLAIN, 11)
|
15
|
+
end
|
16
|
+
|
17
|
+
def on_clicked &block
|
18
|
+
raise unless block
|
19
|
+
add_action_listener do |e|
|
20
|
+
block.call
|
21
|
+
end
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
class JFrame
|
28
|
+
def close
|
29
|
+
dispose # sigh
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class JFileChooser
|
34
|
+
# returns nil on failure...
|
35
|
+
def go
|
36
|
+
success = show_open_dialog nil
|
37
|
+
unless success == Java::javax::swing::JFileChooser::APPROVE_OPTION
|
38
|
+
puts "did not choose one"
|
39
|
+
java.lang.System.exit 1
|
40
|
+
end
|
41
|
+
get_selected_file.get_absolute_path
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
# code examples
|
48
|
+
# JOptionPane.showInputDialog(nil, "not implemented yet", "not implemented yet", JOptionPane::ERROR_MESSAGE)
|
data/lib/vlc_programmer.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require_relative 'overlayer'
|
2
2
|
|
3
|
+
# add some common locations for vlc.exe to the path...
|
4
|
+
ENV['PATH'] = ENV['PATH'] + ";C:\\Program Files\\VideoLAN\\VLC"+ ";D:\\Program Files\\VideoLAN\\VLC" + ";E:\\Program Files\\VideoLAN\\VLC"
|
5
|
+
|
3
6
|
class VLCProgrammer
|
4
7
|
|
5
8
|
def self.to_english s
|
@@ -7,8 +10,10 @@ class VLCProgrammer
|
|
7
10
|
@overlayer.translate_time_to_human_readable s
|
8
11
|
end
|
9
12
|
|
10
|
-
def self.convert_to_full_xspf incoming, filename = nil
|
13
|
+
def self.convert_to_full_xspf incoming, filename = nil, drive_with_slash = nil, dvd_title_track = nil
|
14
|
+
@drive = drive_with_slash || "e:\\"
|
11
15
|
@filename = filename
|
16
|
+
@dvd_title_track = dvd_title_track || "1"
|
12
17
|
mutes = incoming["mutes"] || {}
|
13
18
|
blanks = incoming["blank_outs"] || {}
|
14
19
|
mutes = mutes.map{|k, v| [OverLayer.translate_string_to_seconds(k), OverLayer.translate_string_to_seconds(v), :mute]}
|
@@ -93,7 +98,7 @@ class VLCProgrammer
|
|
93
98
|
end
|
94
99
|
|
95
100
|
def self.get_section title, start, stop, idx, no_audio = false
|
96
|
-
loc = "dvd
|
101
|
+
loc = "dvd://#{@drive}@#{@dvd_title_track}"
|
97
102
|
if !@filename
|
98
103
|
"<track>
|
99
104
|
<title>#{title}</title>
|
@@ -106,7 +111,7 @@ class VLCProgrammer
|
|
106
111
|
<location>#{loc}</location>
|
107
112
|
</track>"
|
108
113
|
else
|
109
|
-
"call vlc -I dummy #{loc} --start-time=#{start} --stop-time=#{stop} --sout
|
114
|
+
"call vlc -I dummy #{loc} --start-time=#{start} --stop-time=#{stop} --sout=\"file/ps:#{@filename}.ps.#{idx}\" #{"--no-sout-audio" if no_audio} vlc://quit\n" # +
|
110
115
|
#"call vlc #{@filename}.ps.#{idx}.tmp --sout=file/ps:go.ps
|
111
116
|
end
|
112
117
|
end
|
@@ -118,14 +123,13 @@ class VLCProgrammer
|
|
118
123
|
files = (1..idx).map{|n| "#{@filename}.ps.#{n}"}
|
119
124
|
# concat
|
120
125
|
line = 'type ' + files.join(' ')
|
121
|
-
line += " > #{@filename}.
|
126
|
+
line += " > #{@filename}.ps\n"
|
122
127
|
|
123
128
|
line += "rm " + files.join(' ') + "\n"
|
124
|
-
line += "echo Done--you may now watch file #{@filename}.
|
129
|
+
line += "echo Done--you may now watch file #{@filename}.ps in VLC player"
|
125
130
|
end
|
126
131
|
|
127
132
|
end
|
128
|
-
|
129
133
|
|
130
134
|
end
|
131
135
|
|
data/spec/vlc_programmer.spec.rb
CHANGED
@@ -95,7 +95,11 @@ describe 'VLC Programmer' do
|
|
95
95
|
File.write('mute5-10.bat', bat_file)
|
96
96
|
puts 'run it like $ mute5-10.bat'
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
|
+
it "should modify path to have VLC available" do
|
100
|
+
ENV['PATH'].should include("VideoLAN")
|
101
|
+
end
|
102
|
+
|
99
103
|
it "should produce a workable non VLC playable file"
|
100
104
|
|
101
105
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 13
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.13.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Roger Pack
|
@@ -14,8 +14,8 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
18
|
-
default_executable:
|
17
|
+
date: 2010-11-19 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: sane
|
@@ -116,7 +116,16 @@ dependencies:
|
|
116
116
|
description:
|
117
117
|
email: rogerdpack@gmail.com
|
118
118
|
executables:
|
119
|
+
- AboutDialog.class
|
120
|
+
- AboutDialog.java
|
121
|
+
- ComboBoxes$1.class
|
122
|
+
- ComboBoxes$2.class
|
123
|
+
- ComboBoxes.class
|
124
|
+
- ComboBoxes.java
|
119
125
|
- sensible-cinema
|
126
|
+
- sensible-cinema-cli
|
127
|
+
- sensible-cinema-hit-reload-twice-then-save-copy-of-for-death
|
128
|
+
- swing_helpers.rb
|
120
129
|
extensions:
|
121
130
|
- ext/mkrf_conf.rb
|
122
131
|
extra_rdoc_files:
|
@@ -130,6 +139,8 @@ files:
|
|
130
139
|
- TODO
|
131
140
|
- VERSION
|
132
141
|
- bin/sensible-cinema
|
142
|
+
- bin/sensible-cinema-cli
|
143
|
+
- bin/swing_helpers.rb
|
133
144
|
- ext/mkrf_conf.rb
|
134
145
|
- gplv3.txt
|
135
146
|
- lib/blanker.rb
|
@@ -238,6 +249,7 @@ files:
|
|
238
249
|
- zamples/scene_lists/category descriptions.yml
|
239
250
|
- zamples/scene_lists/dvds/White Christmas.yml
|
240
251
|
- zamples/scene_lists/dvds/all_dogs_go_to_heaven_dvd.yml
|
252
|
+
- zamples/scene_lists/dvds/bobs_big_plan.yml
|
241
253
|
- zamples/scene_lists/dvds/cars_disney.yml
|
242
254
|
- zamples/scene_lists/dvds/happy_feet_dvd.yml
|
243
255
|
- zamples/scene_lists/dvds/labyrinth.yml
|
@@ -246,6 +258,13 @@ files:
|
|
246
258
|
- zamples/scene_lists/star_trek_generations_hulu.yml
|
247
259
|
- zamples/scene_lists/youtube/gummy_bear_song_youtube.yml
|
248
260
|
- zamples/scene_lists/youtube/nuki_song_youtube.yml
|
261
|
+
- bin/AboutDialog.class
|
262
|
+
- bin/AboutDialog.java
|
263
|
+
- bin/ComboBoxes$1.class
|
264
|
+
- bin/ComboBoxes$2.class
|
265
|
+
- bin/ComboBoxes.class
|
266
|
+
- bin/ComboBoxes.java
|
267
|
+
- bin/sensible-cinema-hit-reload-twice-then-save-copy-of-for-death
|
249
268
|
has_rdoc: true
|
250
269
|
homepage: http://github.com/rdp
|
251
270
|
licenses: []
|