bookbinder 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,9 +39,16 @@ class Bookbinder::Transform::MediaRipper_NavToc < Bookbinder::Transform
39
39
  # We should translate to 74*60+48.0 ==> 4488
40
40
  #
41
41
  def translate_time(time_str)
42
- match = time_str.match(/^(\d+):([\d\.]+)$/)
43
- minutes = match[1].to_i
44
- seconds = match[2].to_f
42
+ if match = time_str.match(/^(\d+):(\d+):([\d\.]+)$/)
43
+ minutes = match[1].to_i*60 + match[2].to_i
44
+ seconds = match[3].to_f
45
+ elsif match = time_str.match(/^(\d+):([\d\.]+)$/)
46
+ minutes = match[1].to_i
47
+ seconds = match[2].to_f
48
+ else
49
+ puts("Unknown time format: #{time_str}")
50
+ return nil
51
+ end
45
52
  seconds = seconds.round if seconds % 1 == 0
46
53
  out = minutes * 60 + seconds
47
54
  out > 0 ? out : nil
@@ -47,9 +47,16 @@ class Bookbinder::Transform::MP3Audiobook_NavToc < Bookbinder::Transform
47
47
  # We should translate to 74*60+48.0 ==> 4488
48
48
  #
49
49
  def translate_time(time_str)
50
- match = time_str.match(/^(\d+):([\d\.]+)$/)
51
- minutes = match[1].to_i
52
- seconds = match[2].to_f
50
+ if match = time_str.match(/^(\d+):(\d+):([\d\.]+)$/)
51
+ minutes = match[1].to_i*60 + match[2].to_i
52
+ seconds = match[3].to_f
53
+ elsif match = time_str.match(/^(\d+):([\d\.]+)$/)
54
+ minutes = match[1].to_i
55
+ seconds = match[2].to_f
56
+ else
57
+ puts("Unknown time format: #{time_str}")
58
+ return nil
59
+ end
53
60
  seconds = seconds.round if seconds % 1 == 0
54
61
  out = minutes * 60 + seconds
55
62
  out > 0 ? out : nil
@@ -1,5 +1,5 @@
1
1
  module Bookbinder
2
2
 
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookbinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.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: 2015-01-09 00:00:00.000000000 Z
12
+ date: 2015-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &13080360 !ruby/object:Gem::Requirement
16
+ requirement: &18059860 !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: *13080360
24
+ version_requirements: *18059860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rubyzip
27
- requirement: &13076700 !ruby/object:Gem::Requirement
27
+ requirement: &18059360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *13076700
35
+ version_requirements: *18059360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mime-types
38
- requirement: &13075540 !ruby/object:Gem::Requirement
38
+ requirement: &18058940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *13075540
46
+ version_requirements: *18058940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ruby-mp3info
49
- requirement: &13920580 !ruby/object:Gem::Requirement
49
+ requirement: &18058480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *13920580
57
+ version_requirements: *18058480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &13920160 !ruby/object:Gem::Requirement
60
+ requirement: &18058060 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *13920160
68
+ version_requirements: *18058060
69
69
  description: Convert easily between common ebook formats.
70
70
  email:
71
71
  - jpearson@overdrive.com
@@ -159,4 +159,3 @@ signing_key:
159
159
  specification_version: 3
160
160
  summary: Ebook format conversion.
161
161
  test_files: []
162
- has_rdoc: