lib/overlayer.rb in sensible-cinema-0.9.3 vs lib/overlayer.rb in sensible-cinema-0.9.4
- old
+ new
@@ -38,10 +38,11 @@
@am_blanked = true
Blanker.blank_full_screen! seconds
end
def unblank!
+ @just_unblanked = true
@am_blanked = false
Blanker.unblank_full_screen!
end
def check_reload_yaml
@@ -87,10 +88,11 @@
@am_blanked = false
@mutex = Mutex.new
@cv = ConditionVariable.new
@file_mtime = nil
check_reload_yaml
+ @just_unblanked = false
@start_time = Time.now_f # assume they want to start immediately...
end
def self.translate_yaml raw_yaml
begin
@@ -143,11 +145,18 @@
out << ":"
out << "%04.1f" % seconds
end
def timestamp_changed to_this_exact_string_might_be_nil, delta
- set_seconds OverLayer.translate_string_to_seconds(to_this_exact_string_might_be_nil) + delta if to_this_exact_string_might_be_nil
+ if @just_unblanked
+ # ignore it, since it was probably just caused by the screen blipping
+ # at worse this will put us 1s behind...hmm.
+ @just_unblanked = false
+ p 'ignoring timestamp update ' + to_this_exact_string_might_be_nil if $VERBOSE
+ else
+ set_seconds OverLayer.translate_string_to_seconds(to_this_exact_string_might_be_nil) + delta if to_this_exact_string_might_be_nil
+ end
end
def self.translate_string_to_seconds s
# might actually already be a float, or int, depending on the yaml
# int for 8 => 9 and also for 1:09 => 1:10
@@ -174,24 +183,24 @@
def cur_english_time
translate_time_to_human_readable(cur_time)
end
def status
- time = "Current time: " + cur_english_time
+ time = cur_english_time
begin
mute, blank, next_sig = get_current_state
if next_sig == :done
- state = " no more actions after this point..."
+ state = " no more after this point..."
else
- state = " next action will be at #{translate_time_to_human_readable next_sig}s "
+ state = " next will be at #{translate_time_to_human_readable next_sig}s "
end
if blank? or muted?
state += "(" + [muted? ? "muted" : nil, blank? ? "blanked" : nil ].compact.join(' ') + ") "
end
end
check_reload_yaml
- time + state + "(r,d,v, or q to quit): "
+ time + state + "(r [or q to quit]): "
end
def keyboard_input char
delta = case char
when 'h' then 60*60
@@ -199,9 +208,12 @@
when 'm' then 60
when 'M' then -60
when 's' then 1
when 'S' then -1
when 't' then 0.1
+ when 'q' then
+ puts '','quitting'
+ exit(1)
when 'T' then -0.1
when 'v' then
$VERBOSE = !$VERBOSE
p 'set verbose to ', $VERBOSE
return