sensible-cinema 0.20.5 → 0.21.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +29 -0
- data/LICENSE.TXT +18 -13
- data/README +84 -51
- data/Rakefile +10 -9
- data/TODO +135 -60
- data/VERSION +1 -1
- data/bin/monkey.png +0 -0
- data/bin/sensible-cinema-cli +8 -3
- data/bin/sensible-cinema.rb +169 -76
- data/development.txt +29 -0
- data/experimental_readme.txt +18 -56
- data/go.bat +5 -2
- data/how_to_create.txt +31 -35
- data/lib/edl_parser.rb +28 -6
- data/lib/mencoder_wrapper.rb +5 -5
- data/lib/ocr.rb +4 -4
- data/lib/overlayer.rb +14 -10
- data/lib/screen_tracker.rb +15 -5
- data/lib/swing_helpers.rb +1 -1
- data/sensible-cinema.gemspec +30 -13
- data/spec/edl_parser.spec.rb +1 -1
- data/spec/images/netflix_a0.bmp +0 -0
- data/spec/images/netflix_a1.bmp +0 -0
- data/spec/images/netflix_a2.bmp +0 -0
- data/spec/images/netflix_a3.bmp +0 -0
- data/spec/images/netflix_a4.bmp +0 -0
- data/spec/images/netflix_a5.bmp +0 -0
- data/spec/images/netflix_a6.bmp +0 -0
- data/spec/images/netflix_a7.bmp +0 -0
- data/spec/images/netflix_a8.bmp +0 -0
- data/spec/images/netflix_a9.bmp +0 -0
- data/spec/ocr.spec.rb +11 -9
- data/spec/screen_tracker.spec.rb +1 -1
- data/spec/sensible_cinema_gui.spec.rb +9 -8
- data/vendor/SetPriority.exe +0 -0
- data/vendor/readme.txt +120 -0
- data/zamples/edit_decision_lists/dvds/happiest baby on the block.txt +1 -1
- data/zamples/edit_decision_lists/dvds/legend_of_the_guardians_the_owls_of_gahoole.txt +18 -0
- data/zamples/edit_decision_lists/dvds/making_marriage_work.txt +17 -0
- data/zamples/edit_decision_lists/netflix/greatest_story_ever_told_netflix.txt +10 -0
- data/zamples/edit_decision_lists/{example_edit_decision_list.txt → old_not_yet_updated/example_edit_decision_list.txt} +0 -0
- data/zamples/edit_decision_lists/{old_not_yet_update → old_not_yet_updated}/youtube/gummy_bear_song_youtube.txt +0 -0
- data/zamples/edit_decision_lists/{old_not_yet_update → old_not_yet_updated}/youtube/nuki_song_youtube.txt +0 -0
- data/zamples/players/netflix/netflix_firefox_non_maximized.txt +25 -0
- metadata +39 -44
data/experimental_readme.txt
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
Currently
|
2
|
-
|
1
|
+
Currently the experimental screen tracker (bin\sensible-cinema-cli) prompts for a delete list
|
2
|
+
and a player description.
|
3
|
+
|
4
|
+
It then tracks whichever player you are using, by using OCR on its timestamps (
|
5
|
+
moves the mouse every so often to and mutes or blanks out the system appropriately,
|
3
6
|
during the scenes specified.
|
4
7
|
|
5
8
|
It works out of the box with the hulu and VLC players on windows. It isn't hard to
|
@@ -7,26 +10,19 @@ add new players, and probably wouldn't be too hard to add more operating systems
|
|
7
10
|
|
8
11
|
== How to Use ==
|
9
12
|
|
10
|
-
Start playing your movie in its
|
11
|
-
run_sensible_cinema.bat
|
13
|
+
Start playing your movie in its player, then start sensible-cinema-cli
|
12
14
|
|
13
15
|
It prompts you for an EDL (Edit decision List) file (ex: bambi.txt),
|
14
|
-
and also for a player file (ex: hulu_full_screen.txt).
|
16
|
+
and also for a player description file (ex: hulu_full_screen.txt).
|
15
17
|
|
16
|
-
Sensible-cinema will now run in
|
17
|
-
and react
|
18
|
+
Sensible-cinema will now run in its console window, screen tracking the player to monitor its position,
|
19
|
+
and react appropriately (mute system volume, or overlay screen with a black window to cover content playback).
|
18
20
|
|
19
|
-
It is presumed that you'll then minimize sensible-cinema and
|
21
|
+
It is presumed that you'll then minimize sensible-cinema and enjoy the movie.
|
20
22
|
|
21
23
|
You'll know that it's working if, when you change the time of your player (ex: dragging it to a new spot
|
22
|
-
in the playback), the screen output in sensible-cinema's console should change to match the new time.
|
23
|
-
|
24
|
-
== How to install ==
|
25
|
-
|
26
|
-
You'll need to install imagemagick first: http://www.imagemagick.org/script/binary-releases.php
|
24
|
+
in the playback), the screen output listed in sensible-cinema's console should also change to match the new time.
|
27
25
|
|
28
|
-
Next go and get the program: http://rogerdpack.t28.net
|
29
|
-
|
30
26
|
You can test that it's installed by running it (see above) and selecting the "example_edit_decision_list.txt", and
|
31
27
|
choosing the hulu player.
|
32
28
|
|
@@ -34,50 +30,16 @@ It will show you a few "demo" mutes and blank outs.
|
|
34
30
|
|
35
31
|
== FAQ ==
|
36
32
|
|
37
|
-
Q. Can I watch movies this way on my TV, not just on my computer?
|
38
|
-
|
39
|
-
A. Maybe. Or possible not yet, depending on your current hardware.
|
40
|
-
Currently you'll either need to attach your computer to your TV
|
41
|
-
(buy some long cables, or a new graphics card that matches your cables, etc.)
|
42
|
-
or get some computer that you can move closer to the TV to do the same
|
43
|
-
(ex: buy a used older laptop with s-video out, use that, or a laptop with DVI/HDMI would
|
44
|
-
work with an HDMI TV). If you're really aggressive you could run an ethernet cable from your computer, as well [1].
|
45
|
-
I'd be happy to do a linux port of sensible-cinema if anybody requests it, for use with
|
46
|
-
their dedicated TV computer.
|
47
|
-
There has also been some work toward getting ones computer to stream "live" to your existing wii/ps3/xbox.
|
48
|
-
Message me if you're interested in trying it out (testers wanted--plus I'll only work on it if there's demand)!
|
49
|
-
|
50
|
-
Q. What movies does this work with?
|
51
|
-
|
52
|
-
A. Any that you program it for :) (Assuming the computer player is compatible, which most probably are.)
|
53
|
-
|
54
33
|
Q. What movies are freely available to watch online?
|
55
34
|
|
56
|
-
A. Not many are available free (hulu, youtube have a few). Netflix has quite a few
|
57
|
-
You can of course use
|
35
|
+
A. Not many are available free (hulu, youtube have a few). Netflix has quite a few now for money.
|
36
|
+
You can of course use SC with DVD's, too, or rent or borrow DVD's.
|
37
|
+
(If they have a delete list (or you could create your own for them if not...).)
|
58
38
|
|
59
39
|
Q. Why does my mouse bounce up and down while sensible-cinema is going?
|
60
40
|
|
61
41
|
A. This enables your player to keep its on-screen time tracker, which in turn allows sensible-cinema to track where
|
62
|
-
you're at. Message me if this bugs you too much and we'll see what we can do
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
== Advanced Usage ==
|
67
|
-
|
68
|
-
You could specify the scene descriptions list and player list on the command-line, if you don't want to have
|
69
|
-
to pick them each time, like:
|
70
|
-
|
71
|
-
first install jruby, then
|
72
|
-
|
73
|
-
C:\> jruby -S gem install sensible-cinema (double check if that gives you the latest version)
|
74
|
-
|
75
|
-
C:\> jruby -S sensible-cinema edit_decision_list.yml player_description.yml
|
76
|
-
|
77
|
-
Also if you specify "test" for the scene descriptions file, it will pause 4s, take a snapshot of the player, then exit.
|
78
|
-
You can also specify -v or -t if you want to enable more verbose (chatty) output.
|
79
|
-
|
80
|
-
== Thanks ==
|
81
|
-
|
82
|
-
Thanks to Jarmo for the win32-screenshot gem, mini_magick gem authors, jruby guys, etc.
|
83
|
-
The combination made programming this actually something of a pleasure.
|
42
|
+
you're at time position. Message me if this bugs you too much and we'll see what we can do to alleviate it.
|
43
|
+
|
44
|
+
To create a new player, basically you have to create a new descriptor, then add unit tests for all of its digits, to make sure they OCR well :(
|
45
|
+
A bit convoluted, I agree. Ping me if you want one added.
|
data/go.bat
CHANGED
data/how_to_create.txt
CHANGED
@@ -1,41 +1,37 @@
|
|
1
|
-
You create a delete list for sensible cinema to use against whatever you want.
|
1
|
+
You can create a delete list for sensible cinema to use against whatever DVD you want.
|
2
2
|
|
3
|
-
|
3
|
+
A delete list looks something like this example:
|
4
4
|
|
5
5
|
https://github.com/rdp/sensible-cinema/blob/master/zamples/edit_decision_lists/example_edit_decision_list.txt
|
6
6
|
|
7
|
-
Basically your job is to create an appropriate file (like that one),
|
8
|
-
then start sensible-cinema and instruct it to use your new file.
|
9
|
-
|
10
7
|
For a DVD, the steps might look like this:
|
11
8
|
|
12
|
-
open Sensible cinema "create mode"
|
13
|
-
insert DVD, click "
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
After
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
so they'll only be approximate, but it might be close.
|
9
|
+
open Sensible cinema with "edit/create mode...bat"
|
10
|
+
insert your DVD, click "Create new delete list for DVD" button
|
11
|
+
|
12
|
+
Now you want to add timestamps and then test them to make sure they're accurate, using the various buttons.
|
13
|
+
|
14
|
+
Note that you can also add timestamps then click "Watch DVD on computer realtime" to avoid having
|
15
|
+
to rip it to your hard drive. This is slightly less accurate, though faster. See pointers.
|
16
|
+
|
17
|
+
If you want to edit it the accurate way, then you can use the "Watch DVD unedited" button
|
18
|
+
to save time, as it allows you to watch it while it "grabs" it to the hard drive (note: you'll
|
19
|
+
probably need at least a dual core processor for this button to work well).
|
20
|
+
|
21
|
+
After you're done, you can submit your newly created delete list back to the project
|
22
|
+
(so others can use it) by using the Upload button.
|
23
|
+
|
24
|
+
A few pointers:
|
25
|
+
|
26
|
+
You can make several different "delete lists" per DVD, just use different filenames.
|
27
|
+
For example one could take out all profanity, and the other take out profanity and also remove tense scenes.
|
28
|
+
You can just watch a DVD (using any DVD player), and get timestamps that way, before creating a delete list at all.
|
29
|
+
A good computer program for this is "smplayer" (the [ and ] keys control playback speed, and right and left,
|
30
|
+
page up and page down buttons control seeking), and you can also turn on subtitles to help locate profanity.
|
31
|
+
You can also do the same thing using VLC player, except that VLC's timestamps are always a bit off.
|
32
|
+
Also note that you should probably rewatch the whole thing when you're done, to double check and see
|
33
|
+
if you got the time signatures right (using "create DVD file on local hard drive" button).
|
34
|
+
Also note that you can add your timing information to IMDB's parental guide pages about movies.
|
35
|
+
This can help users of other than sensible cinema with editing their movies.
|
36
|
+
Also note that you don't need to "grab" the DVD to your hard drive to edit. You can just setup the
|
37
|
+
EDL to work right [ http://goo.gl/yMfqX ] then use math to setup the correct time signatures.
|
data/lib/edl_parser.rb
CHANGED
@@ -61,28 +61,40 @@ class EdlParser
|
|
61
61
|
out
|
62
62
|
end
|
63
63
|
|
64
|
-
TimeStamp =
|
64
|
+
TimeStamp = /(^\d+:\d\d[\d:\.]*$|\d+)/
|
65
65
|
# starts with a digit, has at least one colon followed by two digits,then some combo of digits and colons and periods...
|
66
|
+
# or just like 5057 s
|
66
67
|
|
67
68
|
def self.extract_entry! from_this
|
68
69
|
return nil if from_this.length == 0
|
69
70
|
# two digits, then whatever else you see, that's not a digit...
|
70
71
|
out = from_this.shift(2)
|
71
72
|
out.each{|d|
|
72
|
-
|
73
|
+
unless d =~ TimeStamp
|
74
|
+
raise SyntaxError.new('non timestamp? ' + d)
|
75
|
+
end
|
73
76
|
}
|
74
77
|
while(from_this[0] && from_this[0] !~ TimeStamp)
|
75
|
-
|
78
|
+
out << from_this.shift
|
76
79
|
end
|
77
80
|
out
|
78
81
|
end
|
79
82
|
|
80
83
|
def self.get_secs timestamp_string_begin, timestamp_string_end, add_begin, add_end, splits
|
81
84
|
answers = []
|
85
|
+
unless timestamp_string_begin
|
86
|
+
p 'BAD'
|
87
|
+
raise 'non begin'
|
88
|
+
end
|
89
|
+
unless timestamp_string_end
|
90
|
+
p 'BAD2', '', ''
|
91
|
+
raise 'non end'
|
92
|
+
end
|
82
93
|
for type, offset, multiplier in [[timestamp_string_begin, add_begin, -1], [timestamp_string_end, add_end, 1]]
|
83
94
|
original_secs = translate_string_to_seconds(type) + offset
|
84
95
|
# now if splits is 900 and we'are at 909, then we're just 9
|
85
96
|
closest_split_idx = splits.reverse.index{|t| t < original_secs}
|
97
|
+
p 'got idx', closest_split_idx
|
86
98
|
if closest_split_idx
|
87
99
|
closest_split = splits.reverse[closest_split_idx]
|
88
100
|
# add some extra seconds onto these if they're "past" a split, too
|
@@ -103,9 +115,9 @@ class EdlParser
|
|
103
115
|
end
|
104
116
|
mutes = incoming["mutes"] || {}
|
105
117
|
blanks = incoming["blank_outs"] || {}
|
118
|
+
p 'incoming', incoming, splits
|
106
119
|
mutes = mutes.map{|k, v| get_secs(k, v, -add_this_to_mutes_beginning, add_this_to_mutes_end, splits) + [:mute]}
|
107
120
|
blanks = blanks.map{|k, v| get_secs(k, v, -add_this_to_mutes_beginning, add_this_to_mutes_end, splits) + [:blank]}
|
108
|
-
p mutes, blanks
|
109
121
|
combined = (mutes+blanks).sort
|
110
122
|
|
111
123
|
previous = nil
|
@@ -140,7 +152,13 @@ class EdlParser
|
|
140
152
|
|
141
153
|
# s is like 1:01:02.0
|
142
154
|
total = 0.0
|
143
|
-
seconds =
|
155
|
+
seconds = nil
|
156
|
+
begin
|
157
|
+
seconds = s.split(":")[-1]
|
158
|
+
rescue Exception => e
|
159
|
+
p 'failed!', s
|
160
|
+
raise e
|
161
|
+
end
|
144
162
|
total += seconds.to_f
|
145
163
|
minutes = s.split(":")[-2] || "0"
|
146
164
|
total += 60 * minutes.to_i
|
@@ -174,7 +192,7 @@ class EdlParser
|
|
174
192
|
|
175
193
|
end
|
176
194
|
|
177
|
-
#
|
195
|
+
# == 1.8.7 Symbol compat
|
178
196
|
|
179
197
|
class Symbol
|
180
198
|
# Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Symbol.html]
|
@@ -182,4 +200,8 @@ class Symbol
|
|
182
200
|
return nil unless with.is_a? Symbol
|
183
201
|
to_s <=> with.to_s
|
184
202
|
end unless method_defined? :"<=>"
|
203
|
+
end
|
204
|
+
|
205
|
+
if RUBY_VERSION < '1.8.7'
|
206
|
+
raise 'needs ruby 1.8.7 at least'
|
185
207
|
end
|
data/lib/mencoder_wrapper.rb
CHANGED
@@ -29,8 +29,8 @@ class MencoderWrapper
|
|
29
29
|
out = '@rem '
|
30
30
|
end
|
31
31
|
audio_codec = these_settings['audio_codec'] || 'lavc' # not copy...sniff...or you can't hear cars...
|
32
|
-
video_opts = "-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"
|
33
|
-
out + "
|
32
|
+
video_opts = "-vf scale=720:480,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"
|
33
|
+
out + "mencoder dvdnav://#{@dvd_title_track} -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"
|
34
34
|
end
|
35
35
|
|
36
36
|
def calculate_final_filename to_here_final_file
|
@@ -77,9 +77,9 @@ class MencoderWrapper
|
|
77
77
|
out += "call mencoder #{partials.join(' ')} -o #{to_here_final_file} -ovc copy -oac copy\n"
|
78
78
|
# LODO only do this if they want to watch it on their computer, with something other than smplayer, or want to make it smaller, as it takes *forever* longer to run...
|
79
79
|
# or is ffdshow enough without this?
|
80
|
-
out += "@rem call mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:vstrict=0:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 #{partials.join(' ')} -o #{to_here_final_file}\n"
|
80
|
+
out += "@rem old way... call mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:vstrict=0:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 #{partials.join(' ')} -o #{to_here_final_file}\n"
|
81
81
|
|
82
|
-
delete_prefix = delete_partials ? "" : "@rem "
|
82
|
+
delete_prefix = ""#delete_partials ? "" : "@rem "
|
83
83
|
|
84
84
|
out += "@rem del #{@big_temp}\n" # LODO no @rem
|
85
85
|
out += "#{delete_prefix} del " + partials.join(' ') + "\n"
|
@@ -98,7 +98,7 @@ class MencoderWrapper
|
|
98
98
|
if File.exist? partial_filename
|
99
99
|
FileUtils.rm partial_filename
|
100
100
|
end
|
101
|
-
"
|
101
|
+
"ffmpeg -i #{@big_temp} #{codecs} -ss #{start} -t #{endy} #{partial_filename}\n"
|
102
102
|
end
|
103
103
|
|
104
104
|
end
|
data/lib/ocr.rb
CHANGED
@@ -17,12 +17,12 @@ This file is part of Sensible Cinema.
|
|
17
17
|
=end
|
18
18
|
require 'sane' # gem
|
19
19
|
require 'whichr' # gem
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
|
21
|
+
# not a dependency yet, so I don't have to bundle it...
|
22
|
+
# im_path = File.expand_path(File.dirname(__FILE__) + "/../vendor/cache/imagemagick") # convert.exe wants to only be chosen from here...
|
23
|
+
# ENV['PATH'] = im_path.gsub('/', "\\") + ';' + ENV['PATH']
|
23
24
|
|
24
25
|
if RubyWhich.new.which('identify').length == 0 || RubyWhich.new.which('convert').length == 0
|
25
|
-
# for gem users, so I don't have to bundle it :P
|
26
26
|
puts 'appears you do not have imagemagick installed (or not in your path) -- please install it first! http://www.imagemagick.org/script/binary-releases.php'
|
27
27
|
sleep 100
|
28
28
|
end
|
data/lib/overlayer.rb
CHANGED
@@ -15,12 +15,15 @@ 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
|
+
|
18
19
|
require 'sane'
|
19
20
|
require 'thread'
|
20
21
|
require 'timeout'
|
21
22
|
require 'yaml'
|
22
23
|
require_relative 'muter'
|
23
24
|
require_relative 'blanker'
|
25
|
+
require_relative 'edl_parser'
|
26
|
+
|
24
27
|
require 'pp' # for pretty_inspect
|
25
28
|
|
26
29
|
class OverLayer
|
@@ -69,7 +72,7 @@ class OverLayer
|
|
69
72
|
attr_accessor :all_sequences
|
70
73
|
|
71
74
|
def reload_yaml!
|
72
|
-
@all_sequences = OverLayer.
|
75
|
+
@all_sequences = OverLayer.translate_file(@filename)
|
73
76
|
puts '(re) loaded mute sequences from ' + File.basename(@filename) + ' as', pretty_sequences.pretty_inspect, "" unless defined?($AM_IN_UNIT_TEST)
|
74
77
|
signal_change
|
75
78
|
end
|
@@ -79,7 +82,7 @@ class OverLayer
|
|
79
82
|
@all_sequences.each{|type, values|
|
80
83
|
if values.is_a? Array
|
81
84
|
new_sequences[type] = values.map{|s, f|
|
82
|
-
[translate_time_to_human_readable(s), translate_time_to_human_readable(f)]
|
85
|
+
[EdlParser.translate_time_to_human_readable(s), EdlParser.translate_time_to_human_readable(f)]
|
83
86
|
}
|
84
87
|
else
|
85
88
|
new_sequences[type] = values
|
@@ -106,17 +109,18 @@ class OverLayer
|
|
106
109
|
end
|
107
110
|
|
108
111
|
# note this is actually deprecated and won't work anymore <sigh> and needs to be updated.
|
109
|
-
def self.
|
112
|
+
def self.translate_file filename
|
110
113
|
begin
|
111
|
-
all =
|
112
|
-
rescue NoMethodError, ArgumentError
|
113
|
-
p 'appears your file has a syntax error in it--perhaps missing quotation marks?'
|
114
|
-
|
114
|
+
all = EdlParser.parse_file(filename)
|
115
|
+
rescue NoMethodError, ArgumentError => e
|
116
|
+
p 'appears your file has a syntax error in it--perhaps missing quotation marks?', e.to_s
|
117
|
+
raise e # hope this is ok...
|
115
118
|
end
|
119
|
+
|
116
120
|
# now it's like {:mutes => {"1:02.0" => "1:3.0"}}
|
117
121
|
# translate to floats like 62.0 => 63.0
|
118
122
|
|
119
|
-
for type in [:mutes, :blank_outs]
|
123
|
+
for type in [:mutes, :blank_outs] # LODO standardize these :mutes and :blank_outs somewhere...scary to have them repeated *everywhere*
|
120
124
|
maps = all[type] || all[type.to_s] || {}
|
121
125
|
new = {}
|
122
126
|
maps.each{|start,endy|
|
@@ -162,7 +166,7 @@ class OverLayer
|
|
162
166
|
end
|
163
167
|
|
164
168
|
def cur_english_time
|
165
|
-
translate_time_to_human_readable(cur_time)
|
169
|
+
EdlParser.translate_time_to_human_readable(cur_time)
|
166
170
|
end
|
167
171
|
|
168
172
|
def status
|
@@ -172,7 +176,7 @@ class OverLayer
|
|
172
176
|
if next_sig == :done
|
173
177
|
state = " no more after this point..."
|
174
178
|
else
|
175
|
-
state = " next will be at #{translate_time_to_human_readable next_sig}s "
|
179
|
+
state = " next will be at #{EdlParser.translate_time_to_human_readable next_sig}s "
|
176
180
|
end
|
177
181
|
if blank? or muted?
|
178
182
|
state += "(" + [muted? ? "muted" : nil, blank? ? "blanked" : nil ].compact.join(' ') + ") "
|
data/lib/screen_tracker.rb
CHANGED
@@ -52,13 +52,17 @@ class ScreenTracker
|
|
52
52
|
@x = x; @y = y; @x2 = x+width; @y2 = y+height; @callback = callback
|
53
53
|
@max_x = max_x
|
54
54
|
raise "poor width or wrong window #{@x2} #{max_x} #{x}" if @x2 > max_x || @x2 == x
|
55
|
-
if @y2 > max_y || @y2 == y
|
56
|
-
raise
|
55
|
+
if @y2 > max_y || @y2 == y || @y2 <= 0
|
56
|
+
raise "poor height or wrong window selected #{@y2} > #{max_y} || #{@y2} == #{y} || #{@y2} <= 0"
|
57
|
+
end
|
58
|
+
if max_x == 0 || max_y == 0
|
59
|
+
# I don't think we can ever get here, because of the checks above
|
60
|
+
raise 'window invisible?'
|
57
61
|
end
|
58
62
|
@digits = digits
|
59
63
|
@previously_displayed_warning = false
|
60
64
|
@dump_digit_count = 1
|
61
|
-
pps 'using x',@x, 'from x', x, 'y', @y, 'from y', y,'x2',@x2,'y2',@y2,'digits', @digits if $VERBOSE
|
65
|
+
pps 'using x',@x, 'from x', x, 'y', @y, 'from y', y,'x2',@x2,'y2',@y2,'digits', @digits.inspect if $VERBOSE
|
62
66
|
end
|
63
67
|
|
64
68
|
def get_hwnd
|
@@ -124,7 +128,13 @@ class ScreenTracker
|
|
124
128
|
if(x < 0)
|
125
129
|
x = @max_x + x
|
126
130
|
end
|
127
|
-
|
131
|
+
x2 = x + w
|
132
|
+
raise 'a digit width can never be negative #{w}' if w <= 0
|
133
|
+
y2 = @y2
|
134
|
+
width = x2 - x
|
135
|
+
height = y2 - @y
|
136
|
+
# lodo calculate these only once...
|
137
|
+
out[type] = Win32::Screenshot::BitmapMaker.capture_area(@hwnd, x, @y, x2, y2) {|h,w,bmp| bmp}
|
128
138
|
end
|
129
139
|
end
|
130
140
|
out
|
@@ -165,7 +175,7 @@ class ScreenTracker
|
|
165
175
|
sleep 0.02
|
166
176
|
if(Time.now - time_since_last_screen_change > 2.0)
|
167
177
|
# display a warning
|
168
|
-
p 'warning--unable to track screen time for some reason [perhaps screen obscured or it\'s not playing yet?]'
|
178
|
+
p 'warning--unable to track screen time for some reason [perhaps screen obscured or it\'s not playing yet, or paused?]'
|
169
179
|
@previously_displayed_warning = true
|
170
180
|
time_since_last_screen_change = Time.now
|
171
181
|
# also reget window hwnd, just in case that's the problem...(can be with VLC moving from title to title)
|
data/lib/swing_helpers.rb
CHANGED
@@ -42,7 +42,7 @@ module SensibleSwing
|
|
42
42
|
rescue Exception => e
|
43
43
|
puts 'got fatal exception in button', e, e.class
|
44
44
|
puts e.backtrace.join("\n"), e
|
45
|
-
System.exit(1) # LODO no exit [?]
|
45
|
+
System.exit(1) # LODO no exit [?] once jruby cleans up their act...
|
46
46
|
end
|
47
47
|
end
|
48
48
|
self
|