sensible-cinema 0.10.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/TODO +16 -4
- data/VERSION +1 -1
- data/lib/overlayer.rb +7 -7
- data/lib/vlc_programmer.rb +110 -0
- data/spec/common.rb +1 -0
- data/spec/vlc_pre_programmed.spec.rb +113 -0
- metadata +7 -4
data/README
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Sensible-cinema is a program that allows you to do pre-programmed scene selection (i.e. "mute out"
|
|
2
|
-
or "bleep out" scenes) on arbitrary media players like netflix online, vlc, etc.
|
|
2
|
+
or "bleep out" scenes) on arbitrary media players like netflix online, vlc (for DVD's), etc.
|
|
3
3
|
|
|
4
4
|
Currently it takes as input a list of "skippable" scenes, and a player description.
|
|
5
5
|
It then tracks whichever player you are using, and mutes or blanks out the system appropriately,
|
data/TODO
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
== medium ==
|
|
2
2
|
|
|
3
|
+
amazon player
|
|
3
4
|
|
|
4
5
|
== probably next up/low prio ==
|
|
5
6
|
|
|
@@ -22,10 +23,15 @@
|
|
|
22
23
|
|
|
23
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). ==
|
|
24
25
|
|
|
26
|
+
some real GUI...then I can have an 'edit preferences' button et al.
|
|
27
|
+
|
|
28
|
+
"sav-ize"
|
|
29
|
+
VLC can play from a playlist or batch file or multiples on command line or what not.
|
|
30
|
+
VLC can save from said playlist to a single edited file.
|
|
31
|
+
|
|
25
32
|
"ripperzy-ize"
|
|
26
|
-
can rip from DVD
|
|
27
|
-
|
|
28
|
-
mplayer?
|
|
33
|
+
can rip from DVD and then edit that
|
|
34
|
+
mplayer?
|
|
29
35
|
can rip from screen
|
|
30
36
|
windows 7 only for now (?)
|
|
31
37
|
VLC to rip?
|
|
@@ -36,12 +42,18 @@
|
|
|
36
42
|
and then able to edit that...
|
|
37
43
|
remove commercials?
|
|
38
44
|
|
|
45
|
+
dvd-rip:
|
|
46
|
+
VobBlanker for DVD's?
|
|
47
|
+
|
|
48
|
+
blanker: allow for one side of the screen or another...
|
|
49
|
+
|
|
39
50
|
PISH
|
|
40
51
|
release it with both until scared (?)
|
|
41
52
|
split projects when scared (editor versus normal)/make projects work with direct editing, et al...
|
|
42
53
|
split online from DVD, et al
|
|
54
|
+
Note: get the whole thing working then release it all :P
|
|
43
55
|
|
|
44
|
-
check that youtube is working well again for all...
|
|
56
|
+
check that youtube is working well again for all screen resolutions...
|
|
45
57
|
|
|
46
58
|
run it off a normal person (hulu, DVD). rinse and repeat
|
|
47
59
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.11.0
|
data/lib/overlayer.rb
CHANGED
|
@@ -6,12 +6,6 @@ require_relative 'muter'
|
|
|
6
6
|
require_relative 'blanker'
|
|
7
7
|
require 'pp' # for pretty_inspect
|
|
8
8
|
|
|
9
|
-
class Time
|
|
10
|
-
def self.now_f
|
|
11
|
-
now.to_f
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
9
|
class OverLayer
|
|
16
10
|
|
|
17
11
|
def muted?
|
|
@@ -136,7 +130,7 @@ class OverLayer
|
|
|
136
130
|
# 3600 => "1:00:00"
|
|
137
131
|
out = ''
|
|
138
132
|
hours = seconds.to_i / 3600
|
|
139
|
-
out << "%d" % hours
|
|
133
|
+
out << "%d" % hours
|
|
140
134
|
out << ":"
|
|
141
135
|
seconds = seconds - hours*3600
|
|
142
136
|
minutes = seconds.to_i / 60
|
|
@@ -379,3 +373,9 @@ class OverLayer
|
|
|
379
373
|
end
|
|
380
374
|
|
|
381
375
|
end
|
|
376
|
+
|
|
377
|
+
class Time
|
|
378
|
+
def self.now_f
|
|
379
|
+
now.to_f
|
|
380
|
+
end
|
|
381
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
require_relative 'overlayer'
|
|
2
|
+
|
|
3
|
+
class VLCProgrammer
|
|
4
|
+
|
|
5
|
+
def self.to_english s
|
|
6
|
+
@overlayer ||= OverLayer.allocate
|
|
7
|
+
@overlayer.translate_time_to_human_readable s
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.convert_to_full_xspf incoming
|
|
11
|
+
|
|
12
|
+
mutes = incoming["mutes"] || {}
|
|
13
|
+
blanks = incoming["blank_outs"] || {}
|
|
14
|
+
mutes = mutes.map{|k, v| [OverLayer.translate_string_to_seconds(k), OverLayer.translate_string_to_seconds(v), :mute]}
|
|
15
|
+
blanks = blanks.map{|k, v| [OverLayer.translate_string_to_seconds(k), OverLayer.translate_string_to_seconds(v), :blank]}
|
|
16
|
+
|
|
17
|
+
combined = (mutes+blanks).sort
|
|
18
|
+
|
|
19
|
+
combined.each{|s, e, t|
|
|
20
|
+
puts 'warning--detected an end before a start' if e < s
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {5=> 7}, "blank_outs" => {6=>7} } )
|
|
24
|
+
# should mute 5-6, skip 6-7
|
|
25
|
+
combined.each_with_index{|(start, endy, type), index|
|
|
26
|
+
next if index == 0 # nothing to do there..
|
|
27
|
+
previous = combined[index-1]
|
|
28
|
+
previous_end = previous[1]
|
|
29
|
+
previous_type = previous[2]
|
|
30
|
+
previous_start = previous[0]
|
|
31
|
+
if type == :blank
|
|
32
|
+
raise 'no overlap like that allowed as of yet' unless previous_end <= endy
|
|
33
|
+
if previous_type == :mute && previous_end > start
|
|
34
|
+
previous[1] = start # make it end when we start...
|
|
35
|
+
end
|
|
36
|
+
elsif type == :mute
|
|
37
|
+
if previous_end > start
|
|
38
|
+
|
|
39
|
+
if previous_end >= endy
|
|
40
|
+
combined[index] = [nil] # null it out...it's a mute subsumed by a blank apparently...
|
|
41
|
+
if previous_type == :mute
|
|
42
|
+
raise 'overlapping mute?'
|
|
43
|
+
end
|
|
44
|
+
else
|
|
45
|
+
# start mine when the last one ended...
|
|
46
|
+
combined[index] = [previous_end, endy, type]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
else
|
|
52
|
+
raise 'unexpected'
|
|
53
|
+
end
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
|
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>"
|
|
61
|
+
|
|
62
|
+
previous_end = 0
|
|
63
|
+
idx = 0
|
|
64
|
+
|
|
65
|
+
combined.each{|start, endy, type|
|
|
66
|
+
next unless start
|
|
67
|
+
next if endy <= start # ignore mutes wholly contained within blanks
|
|
68
|
+
|
|
69
|
+
if previous_end != start
|
|
70
|
+
# play up to next "questionable section"
|
|
71
|
+
out += get_section("#{to_english previous_end} to #{to_english start} (clean)", previous_end, start, idx += 1)
|
|
72
|
+
end
|
|
73
|
+
# now play through the muted section...
|
|
74
|
+
if type == :mute
|
|
75
|
+
out += get_section "#{to_english start}s to #{to_english endy}s muted", start, endy, idx += 1, "no-audio"
|
|
76
|
+
end
|
|
77
|
+
previous_end = endy
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# now play the rest of the movie...
|
|
81
|
+
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
|
+
# and close the xml...
|
|
84
|
+
out += "</trackList></playlist>"
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.get_section title, start, stop, idx, extra_setting = "", location = nil
|
|
89
|
+
"<track>
|
|
90
|
+
<title>#{title}</title>
|
|
91
|
+
<extension application=\"http://www.videolan.org/vlc/playlist/0\">
|
|
92
|
+
<vlc:id>#{idx}</vlc:id>
|
|
93
|
+
<vlc:option>start-time=#{start}</vlc:option>
|
|
94
|
+
<vlc:option>#{extra_setting}</vlc:option>
|
|
95
|
+
<vlc:option>stop-time=#{stop}</vlc:option>
|
|
96
|
+
</extension>
|
|
97
|
+
<location>#{location ? location : "dvd://e:\@1"}</location>
|
|
98
|
+
</track>"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# 1.8.7 compat...
|
|
103
|
+
|
|
104
|
+
class Symbol
|
|
105
|
+
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Symbol.html]
|
|
106
|
+
def <=>(with)
|
|
107
|
+
return nil unless with.is_a? Symbol
|
|
108
|
+
to_s <=> with.to_s
|
|
109
|
+
end unless method_defined? :"<=>"
|
|
110
|
+
end
|
data/spec/common.rb
CHANGED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + "/common"
|
|
2
|
+
require_relative '../lib/vlc_programmer'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe 'VLC Programmer' do
|
|
6
|
+
|
|
7
|
+
it "should be able to convert" do
|
|
8
|
+
|
|
9
|
+
a = YAML.load_file "../zamples/scene_lists/dvds/happy_feet_dvd.yml"
|
|
10
|
+
out = VLCProgrammer.convert_to_full_xspf(a)
|
|
11
|
+
out.length.should_not == 0
|
|
12
|
+
out.should include("playlist")
|
|
13
|
+
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
|
+
end
|
|
36
|
+
|
|
37
|
+
before do
|
|
38
|
+
@a = VLCProgrammer.convert_to_full_xspf({ "mutes"=>{105=>145, "46:33.5"=>2801} } )
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should convert mutes and blanks apropo" do
|
|
42
|
+
@a.scan(/<vlc:id>/).length.should == 5 # should mute and play each time...
|
|
43
|
+
@a.scan(/start-time=0/).length.should == 1 # should start
|
|
44
|
+
@a.scan(/stop-time=1000000/).length.should == 1 # should have one to "finish" the DVD
|
|
45
|
+
@a.scan(/<\/playlist/).length.should == 1
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should have pretty english titles" do
|
|
49
|
+
@a.scan(/ to /).length.should == 2*2+1
|
|
50
|
+
@a.scan(/clean/).length.should be > 0
|
|
51
|
+
@a.scan(/2:25/).length.should == 2
|
|
52
|
+
@a.scan(/no-audio/).length.should be > 0
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "should handle blank outs, too" do
|
|
56
|
+
# shouldn't have as many in the case of blanks...
|
|
57
|
+
a = VLCProgrammer.convert_to_full_xspf({ "blank_outs" => {63=>64} } )
|
|
58
|
+
a.should include("63")
|
|
59
|
+
a.should include("64")
|
|
60
|
+
a.scan(/ to /).length.should == 2
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "should handle combined blank and audio well" do
|
|
64
|
+
# currently it handles blanks as skips...
|
|
65
|
+
# possibly someday we should allow for blanks as...blanks? blank-time somehow, with the right audio?
|
|
66
|
+
# for now, skip for blanks, mute for mutes...
|
|
67
|
+
|
|
68
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {5=> 7}, "blank_outs" => {6=>7} } )
|
|
69
|
+
# should mute 5-6, skip 6-7
|
|
70
|
+
a.scan(/no-audio/).length.should == 1
|
|
71
|
+
a.scan(/ to /).length.should == 3 # 0->5, 5->6, 7-> end
|
|
72
|
+
a.scan(/=5/).length.should == 2
|
|
73
|
+
a.scan(/=6/).length.should == 1
|
|
74
|
+
a.scan(/=7/).length.should == 1
|
|
75
|
+
|
|
76
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6=> 7}, "blank_outs" => {5=>7} } )
|
|
77
|
+
a.scan(/=6/).length.should == 0
|
|
78
|
+
a.scan(/no-audio/).length.should == 0
|
|
79
|
+
a.scan(/ to /).length.should == 2 # 0->5, 7-> end
|
|
80
|
+
|
|
81
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6=> 7}, "blank_outs" => {5=>6.5} } )
|
|
82
|
+
# should skip 5 => 6.5, mute 6.5 => 7
|
|
83
|
+
|
|
84
|
+
a.scan(/no-audio/).length.should == 1
|
|
85
|
+
a.scan(/ to /).length.should == 3 # 0->5, 6.5 => 7, 7 -> end
|
|
86
|
+
a.scan(/=5/).length.should == 1
|
|
87
|
+
a.scan(/=6.5/).length.should == 1
|
|
88
|
+
a.scan(/=7/).length.should == 2
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6=> 7}, "blank_outs" => {6=>7} } )
|
|
92
|
+
# should ignore mutes here
|
|
93
|
+
a.scan(/ to /).length.should == 2 # 0->6, 7 -> end
|
|
94
|
+
|
|
95
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6.5=> 7}, "blank_outs" => {6=>7} } )
|
|
96
|
+
# should ignore mutes here
|
|
97
|
+
a.scan(/ to /).length.should == 2 # 0->6, 7 -> end
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it "should not try to save it to a file from within the xml" do
|
|
102
|
+
a = VLCProgrammer.convert_to_full_xspf({ "mutes" => {6=> 7} } )
|
|
103
|
+
a.scan(/sout=.*/).length.should == 0
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "should have a workable usable VLC file" do
|
|
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
|
|
112
|
+
|
|
113
|
+
end
|
metadata
CHANGED
|
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
|
4
4
|
prerelease: false
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
version: 0.
|
|
7
|
+
- 11
|
|
8
|
+
- 0
|
|
9
|
+
version: 0.11.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-15 00:00:00 -07:00
|
|
18
18
|
default_executable: sensible-cinema
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -141,6 +141,7 @@ files:
|
|
|
141
141
|
- lib/ocr.rb
|
|
142
142
|
- lib/overlayer.rb
|
|
143
143
|
- lib/screen_tracker.rb
|
|
144
|
+
- lib/vlc_programmer.rb
|
|
144
145
|
- never_do
|
|
145
146
|
- spec/blanker.spec.rb
|
|
146
147
|
- spec/common.rb
|
|
@@ -200,6 +201,7 @@ files:
|
|
|
200
201
|
- spec/screen_tracker.spec.rb
|
|
201
202
|
- spec/silence.wav
|
|
202
203
|
- spec/test_yaml.yml
|
|
204
|
+
- spec/vlc_pre_programmed.spec.rb
|
|
203
205
|
- vendor/gocr048.exe
|
|
204
206
|
- vendor/imagemagick/CORE_RL_Magick++_.dll
|
|
205
207
|
- vendor/imagemagick/CORE_RL_bzlib_.dll
|
|
@@ -287,3 +289,4 @@ test_files:
|
|
|
287
289
|
- spec/ocr.spec.rb
|
|
288
290
|
- spec/overlayer.spec.rb
|
|
289
291
|
- spec/screen_tracker.spec.rb
|
|
292
|
+
- spec/vlc_pre_programmed.spec.rb
|