Permalink
Browse files

Fix player

  • Loading branch information...
1 parent 2a1b1fd commit 94306b32f1b89f3f094286d1235d9e16fb9c2192 Antono Vasiljev committed Apr 23, 2012
Showing with 8 additions and 11 deletions.
  1. +7 −10 lib/shelr/player.rb
  2. +1 −1 lib/shelr/version.rb
View
@@ -58,30 +58,27 @@ def initialize(id)
def play
Shelr.terminal.puts_line
- system(scriptreplay_cmd)
+ self.class.scriptreplay record_file('typescript'), record_file('timing')
Shelr.terminal.puts_line
end
- private
-
- def scriptreplay(typescript_file, timing_file)
+ def self.scriptreplay(typescript_file, timing_file)
typescript = File.open(typescript_file)
timing = File.open(timing_file)
frames = timing.read.split("\n").map { |line| line.split(" ") }
+ frames.map! { |k,v| [k.to_f.abs, v.to_i] }
typescript.gets # skip first line
frames.each do |usec,length|
- sleep(usec.to_f)
- print typescript.read(length.to_i)
+ sleep(usec)
+ print typescript.read(length)
end
end
+ private
+
def record_file(name)
File.join(Shelr.data_dir(@record_id), name)
end
-
- def scriptreplay_cmd
- scriptreplay record_file('typescript'), record_file('timing')
- end
end
end
View
@@ -1,3 +1,3 @@
module Shelr
- VERSION = '0.15.0'
+ VERSION = '0.15.1'
end

0 comments on commit 94306b3

Please sign in to comment.