sensible-cinema 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/vlc_programmer.rb +53 -24
- data/spec/{vlc_pre_programmed.spec.rb → vlc_programmer.spec.rb} +23 -35
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.12.0
|
data/lib/vlc_programmer.rb
CHANGED
@@ -7,8 +7,8 @@ class VLCProgrammer
|
|
7
7
|
@overlayer.translate_time_to_human_readable s
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.convert_to_full_xspf incoming
|
11
|
-
|
10
|
+
def self.convert_to_full_xspf incoming, filename = nil
|
11
|
+
@filename = filename
|
12
12
|
mutes = incoming["mutes"] || {}
|
13
13
|
blanks = incoming["blank_outs"] || {}
|
14
14
|
mutes = mutes.map{|k, v| [OverLayer.translate_string_to_seconds(k), OverLayer.translate_string_to_seconds(v), :mute]}
|
@@ -53,11 +53,7 @@ class VLCProgrammer
|
|
53
53
|
end
|
54
54
|
}
|
55
55
|
|
56
|
-
out =
|
57
|
-
<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\">
|
58
|
-
<title>Playlist</title>
|
59
|
-
<!--location>c:\\installs\\test.xspf</location-->
|
60
|
-
<trackList>"
|
56
|
+
out = get_header
|
61
57
|
|
62
58
|
previous_end = 0
|
63
59
|
idx = 0
|
@@ -72,35 +68,68 @@ class VLCProgrammer
|
|
72
68
|
end
|
73
69
|
# now play through the muted section...
|
74
70
|
if type == :mute
|
75
|
-
out += get_section "#{to_english start}s to #{to_english endy}s muted", start, endy, idx += 1,
|
71
|
+
out += get_section "#{to_english start}s to #{to_english endy}s muted", start, endy, idx += 1, true
|
76
72
|
end
|
77
73
|
previous_end = endy
|
78
74
|
}
|
79
75
|
|
80
76
|
# now play the rest of the movie...
|
81
77
|
out += get_section to_english(previous_end) + " to end of film", previous_end, 1_000_000, idx += 1
|
82
|
-
out += get_section("Done", 0, 0, idx += 1, "", "vlc://quit")
|
83
78
|
# and close the xml...
|
84
|
-
out +=
|
79
|
+
out += get_footer idx
|
85
80
|
|
86
81
|
end
|
87
|
-
|
88
|
-
def self.
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
</track>"
|
82
|
+
|
83
|
+
def self.get_header
|
84
|
+
if !@filename
|
85
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
86
|
+
<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\">
|
87
|
+
<title>Playlist</title>
|
88
|
+
<!--location>c:\\installs\\test.xspf</location-->
|
89
|
+
<trackList>"
|
90
|
+
else
|
91
|
+
""
|
92
|
+
end
|
99
93
|
end
|
100
|
-
|
94
|
+
|
95
|
+
def self.get_section title, start, stop, idx, no_audio = false
|
96
|
+
loc = "dvd://e:\@1"
|
97
|
+
if !@filename
|
98
|
+
"<track>
|
99
|
+
<title>#{title}</title>
|
100
|
+
<extension application=\"http://www.videolan.org/vlc/playlist/0\">
|
101
|
+
<vlc:id>#{idx}</vlc:id>
|
102
|
+
<vlc:option>start-time=#{start}</vlc:option>
|
103
|
+
#{"<vlc:option>noaudio</vlc:option>" if no_audio}
|
104
|
+
<vlc:option>stop-time=#{stop}</vlc:option>
|
105
|
+
</extension>
|
106
|
+
<location>#{loc}</location>
|
107
|
+
</track>"
|
108
|
+
else
|
109
|
+
"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
|
+
#"call vlc #{@filename}.ps.#{idx}.tmp --sout=file/ps:go.ps
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.get_footer idx
|
115
|
+
if !@filename
|
116
|
+
"</trackList></playlist>"
|
117
|
+
else
|
118
|
+
files = (1..idx).map{|n| "#{@filename}.ps.#{n}"}
|
119
|
+
# concat
|
120
|
+
line = 'type ' + files.join(' ')
|
121
|
+
line += " > #{@filename}.all.ps\n"
|
122
|
+
|
123
|
+
line += "rm " + files.join(' ') + "\n"
|
124
|
+
line += "echo Done--you may now watch file #{@filename}.all.ps in VLC player"
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
101
129
|
|
102
|
-
|
130
|
+
end
|
103
131
|
|
132
|
+
# <= 1.8.7 compat...
|
104
133
|
class Symbol
|
105
134
|
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Symbol.html]
|
106
135
|
def <=>(with)
|
@@ -4,34 +4,12 @@ require_relative '../lib/vlc_programmer'
|
|
4
4
|
|
5
5
|
describe 'VLC Programmer' do
|
6
6
|
|
7
|
-
it "should be able to convert" do
|
8
|
-
|
7
|
+
it "should be able to convert" do
|
9
8
|
a = YAML.load_file "../zamples/scene_lists/dvds/happy_feet_dvd.yml"
|
10
9
|
out = VLCProgrammer.convert_to_full_xspf(a)
|
11
10
|
out.length.should_not == 0
|
12
|
-
out.should include("
|
11
|
+
out.should include("<title>Playlist</title>")
|
13
12
|
out.scan(/vlc:id/).length.should be > 0
|
14
|
-
|
15
|
-
=begin
|
16
|
-
<?xml version=”1.0″ encoding=”UTF-8″?>
|
17
|
-
<playlist version=”1″ xmlns=”http://xspf.org/ns/0/” xmlns:vlc=”http://www.videolan.org/vlc/playlist/ns/0/”>
|
18
|
-
<title>Playlist</title>
|
19
|
-
<location>c:\installs\test.xspf</location>
|
20
|
-
<trackList>
|
21
|
-
<track>
|
22
|
-
<title>Track 1</title>
|
23
|
-
…
|
24
|
-
<extension application=”http://www.videolan.org/vlc/playlist/0″>
|
25
|
-
<vlc:id>0</vlc:id>
|
26
|
-
<vlc:option>start-time=42</vlc:option>
|
27
|
-
<vlc:option>stop-time=45</vlc:option>
|
28
|
-
</extension>
|
29
|
-
<location>dvd://e:\@1</location>
|
30
|
-
</track>
|
31
|
-
<track>
|
32
|
-
<title>Track 2</title>
|
33
|
-
=end
|
34
|
-
|
35
13
|
end
|
36
14
|
|
37
15
|
before do
|
@@ -49,7 +27,7 @@ describe 'VLC Programmer' do
|
|
49
27
|
@a.scan(/ to /).length.should == 2*2+1
|
50
28
|
@a.scan(/clean/).length.should be > 0
|
51
29
|
@a.scan(/2:25/).length.should == 2
|
52
|
-
@a.scan(/
|
30
|
+
@a.scan(/noaudio/).length.should be > 0
|
53
31
|
end
|
54
32
|
|
55
33
|
it "should handle blank outs, too" do
|
@@ -67,7 +45,7 @@ describe 'VLC Programmer' do
|
|
67
45
|
|
68
46
|
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {5=> 7}, "blank_outs" => {6=>7} } )
|
69
47
|
# should mute 5-6, skip 6-7
|
70
|
-
a.scan(/
|
48
|
+
a.scan(/noaudio/).length.should == 1
|
71
49
|
a.scan(/ to /).length.should == 3 # 0->5, 5->6, 7-> end
|
72
50
|
a.scan(/=5/).length.should == 2
|
73
51
|
a.scan(/=6/).length.should == 1
|
@@ -75,13 +53,13 @@ describe 'VLC Programmer' do
|
|
75
53
|
|
76
54
|
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6=> 7}, "blank_outs" => {5=>7} } )
|
77
55
|
a.scan(/=6/).length.should == 0
|
78
|
-
a.scan(/
|
56
|
+
a.scan(/noaudio/).length.should == 0
|
79
57
|
a.scan(/ to /).length.should == 2 # 0->5, 7-> end
|
80
58
|
|
81
59
|
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6=> 7}, "blank_outs" => {5=>6.5} } )
|
82
60
|
# should skip 5 => 6.5, mute 6.5 => 7
|
83
61
|
|
84
|
-
a.scan(/
|
62
|
+
a.scan(/noaudio/).length.should == 1
|
85
63
|
a.scan(/ to /).length.should == 3 # 0->5, 6.5 => 7, 7 -> end
|
86
64
|
a.scan(/=5/).length.should == 1
|
87
65
|
a.scan(/=6.5/).length.should == 1
|
@@ -99,15 +77,25 @@ describe 'VLC Programmer' do
|
|
99
77
|
end
|
100
78
|
|
101
79
|
it "should not try to save it to a file from within the xml" do
|
102
|
-
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {
|
80
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {5=>10} } )
|
103
81
|
a.scan(/sout=.*/).length.should == 0
|
82
|
+
bat_file = VLCProgrammer.convert_to_full_xspf({ "mutes" => {5=>10} }, 'go' )
|
83
|
+
bat_file.scan(/sout=.*/).length.should be > 0
|
84
|
+
bat_file.scan(/playlist/i).length.should == 0
|
85
|
+
bat_file.scan(/--no-sout-audio/).length.should == 1
|
86
|
+
bat_file.scan(/\n/).length.should be > 2
|
87
|
+
bat_file.scan(/go.ps.1.* go.ps.2/).length.should == 2
|
88
|
+
bat_file.scan(/go.ps.4/).length.should == 0
|
89
|
+
bat_file.scan(/--start-time/).length.should == 3
|
90
|
+
bat_file.scan(/quit/).length.should == 3
|
91
|
+
bat_file.scan(/type/).length.should == 1
|
92
|
+
bat_file.scan(/rm go.ps.1/).length.should == 1
|
93
|
+
bat_file.scan(/echo/).length.should == 1
|
94
|
+
bat_file.scan(/dummy/i).length.should == 3
|
95
|
+
File.write('mute5-10.bat', bat_file)
|
96
|
+
puts 'run it like $ mute5-10.bat'
|
104
97
|
end
|
105
98
|
|
106
|
-
it "should
|
107
|
-
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {5=> 10} } )
|
108
|
-
a.scan(/vlc:\/\/quit/).length.should == 1
|
109
|
-
File.write('mute5-10.xspf', a)
|
110
|
-
puts 'run it like $ vlc mute5-10.xspf --sout=file/ps:go.mpg --sout-file-append vlc://quit'
|
111
|
-
end
|
99
|
+
it "should produce a workable non VLC playable file"
|
112
100
|
|
113
101
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 12
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.12.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Roger Pack
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-17 00:00:00 -07:00
|
18
18
|
default_executable: sensible-cinema
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -201,7 +201,7 @@ files:
|
|
201
201
|
- spec/screen_tracker.spec.rb
|
202
202
|
- spec/silence.wav
|
203
203
|
- spec/test_yaml.yml
|
204
|
-
- spec/
|
204
|
+
- spec/vlc_programmer.spec.rb
|
205
205
|
- vendor/gocr048.exe
|
206
206
|
- vendor/imagemagick/CORE_RL_Magick++_.dll
|
207
207
|
- vendor/imagemagick/CORE_RL_bzlib_.dll
|
@@ -289,4 +289,4 @@ test_files:
|
|
289
289
|
- spec/ocr.spec.rb
|
290
290
|
- spec/overlayer.spec.rb
|
291
291
|
- spec/screen_tracker.spec.rb
|
292
|
-
- spec/
|
292
|
+
- spec/vlc_programmer.spec.rb
|