keynote_driver 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/keynote_driver CHANGED
@@ -20,6 +20,11 @@ optparser = OptionParser.new do |opts|
20
20
  options[:tc_path] = tc_path
21
21
  end
22
22
 
23
+ options[:delay] = 0.0
24
+ opts.on('-d', '--delay DELAY', 'Add delay on each time code (float, default: 0.0)') do |delay|
25
+ options[:delay] = delay.to_f
26
+ end
27
+
23
28
  opts.on('-h', '--help', 'Show this message') do |v|
24
29
  puts opts; exit
25
30
  end
@@ -36,4 +41,4 @@ unless options[:pres] || options[:tc_path]
36
41
  exit
37
42
  end
38
43
 
39
- KeynoteDriver.launch!(options[:pres], options[:tc_path])
44
+ KeynoteDriver.launch!(options[:pres], options[:tc_path], options[:delay])
@@ -7,9 +7,9 @@ require "keynote_driver/time_code"
7
7
  module KeynoteDriver
8
8
  extend self
9
9
 
10
- def launch!(pres_path, timecode_path)
10
+ def launch!(pres_path, timecode_path, delay)
11
11
  begin
12
- delays = TimeCode.new(timecode_path).deltas
12
+ delays = TimeCode.new(timecode_path, delay).deltas
13
13
  pres = Presentation.new(pres_path)
14
14
  pres.exec(delays)
15
15
  rescue TimeCodeException => ex
@@ -4,11 +4,12 @@ module KeynoteDriver
4
4
  class TimeCode
5
5
  attr_reader :timecodes
6
6
 
7
- def initialize(timecode_path)
7
+ def initialize(timecode_path, delay = 0.0)
8
8
  if not File.exists?(timecode_path)
9
9
  raise TimeCodeException.new "#{timecode_path} doesn't exists."
10
10
  end
11
11
 
12
+ @delay = delay
12
13
  @timecodes = process(File.read(timecode_path))
13
14
  end
14
15
 
@@ -16,7 +17,7 @@ module KeynoteDriver
16
17
  lines = timecode.split("\r")
17
18
  codes = lines.map{ |l| l.split("\t")[1] }
18
19
 
19
- out = codes.map{ |c| c.to_f.round(3) }
20
+ out = codes.map{ |c| c.to_f.round(3) + @delay }
20
21
 
21
22
  # Check if are not incremental
22
23
  if out.sort != out
@@ -1,3 +1,3 @@
1
1
  module KeynoteDriver
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keynote_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-20 00:00:00.000000000 Z
12
+ date: 2012-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-appscript
16
- requirement: &70354397137160 !ruby/object:Gem::Requirement
16
+ requirement: &70322063452440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70354397137160
24
+ version_requirements: *70322063452440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70354397136740 !ruby/object:Gem::Requirement
27
+ requirement: &70322063452020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70354397136740
35
+ version_requirements: *70322063452020
36
36
  description: bbbb
37
37
  email:
38
38
  - ravasio.federico@gmail.com