handbrake 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,11 @@
1
+ 0.1.0
2
+ =====
3
+
4
+ - Change {HandBrake::Title#chapters} from an Array to a Hash. This is
5
+ consistent with {HandBrake::Titles} and obviates the need for index
6
+ to chapter number conversions. {HandBrake::Title#all_chapters} is
7
+ the equivalent of the old {HandBrake::Title#chapters} method.
8
+
1
9
  0.0.2
2
10
  =====
3
11
 
data/README.md CHANGED
@@ -45,7 +45,7 @@ A brief sample:
45
45
  titles[1].duration # => "01:21:18"
46
46
  titles[1].seconds # => 4878
47
47
  titles[1].chapters.size # => 23
48
- titles[1].chapters[2].seconds # => 208
48
+ titles[1].chapters[3].seconds # => 208
49
49
 
50
50
  project.title(1).
51
51
  preset('Normal').
@@ -129,7 +129,8 @@ configuration chain.
129
129
  Additional resources
130
130
  --------------------
131
131
 
132
- * [API docs](http://rubydoc.info/gems/handbrake.rb)
132
+ * API docs: [last release](http://rubydoc.info/gems/handbrake) or
133
+ [in development](http://rubydoc.info/github/rsutphin/handbrake.rb/master/frames)
133
134
  * [Continuous integration](http://travis-ci.org/#!/rsutphin/handbrake.rb)
134
135
  (note that right now this link only works when there has been a
135
136
  recent build)
@@ -136,7 +136,8 @@ module HandBrake
136
136
  detect { |c| c.name =~ /duration/ }.name.
137
137
  scan(/duration: (\d\d:\d\d:\d\d)/).first.first
138
138
  title.chapters = title_node['chapters:'].children.
139
- collect { |ch_node| Chapter.from_tree(ch_node) }
139
+ collect { |ch_node| Chapter.from_tree(ch_node) }.
140
+ inject({}) { |h, ch| h[ch.number] = ch; h }
140
141
  title.main_feature = title_node.children.detect { |c| c.name =~ /Main Feature/ }
141
142
  end
142
143
  end
@@ -149,10 +150,17 @@ module HandBrake
149
150
  end
150
151
 
151
152
  ##
152
- # @return [Array<Chapter>] The chapters into which the title is
153
- # divided.
153
+ # @return [Hash<Fixnum,Chapter>] The chapters into which the title is
154
+ # divided, indexed by chapter number (a positive integer).
154
155
  def chapters
155
- @chapters ||= []
156
+ @chapters ||= {}
157
+ end
158
+
159
+ ##
160
+ # @return [Array<Chapter>] The chapters of the title, sorted by
161
+ # chapter number.
162
+ def all_chapters
163
+ chapters.keys.sort.collect { |k| chapters[k] }
156
164
  end
157
165
  end
158
166
 
@@ -1,5 +1,5 @@
1
1
  module HandBrake
2
2
  ##
3
3
  # The current version
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0"
5
5
  end
@@ -69,12 +69,23 @@ module HandBrake
69
69
  title_3.seconds.should == 6234
70
70
  end
71
71
 
72
- it 'has all the chapters' do
72
+ it 'has the right number of chapters' do
73
73
  title_3.should have(13).chapters
74
74
  end
75
75
 
76
+ it 'has chapters indexed by chapter number' do
77
+ title_3.chapters[2].tap do |c|
78
+ c.duration.should == '00:00:52'
79
+ c.number.should == 2
80
+ end
81
+ end
82
+
83
+ it 'has an array of the chapters in order' do
84
+ title_3.all_chapters.collect { |ch| ch.number }.should == (1..13).to_a
85
+ end
86
+
76
87
  describe 'a chapter' do
77
- let(:chapter) { title_3.chapters[4] }
88
+ let(:chapter) { title_3.chapters[5] }
78
89
 
79
90
  it 'has the duration' do
80
91
  chapter.duration.should == '00:03:23'
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handbrake
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.2
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - Rhett Sutphin
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-06-14 00:00:00 -05:00
18
+ date: 2011-06-15 00:00:00 -05:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,11 @@ dependencies:
21
26
  requirements:
22
27
  - - ~>
23
28
  - !ruby/object:Gem::Version
29
+ hash: 61
30
+ segments:
31
+ - 0
32
+ - 8
33
+ - 1
24
34
  version: 0.8.1
25
35
  type: :runtime
26
36
  version_requirements: *id001
@@ -32,6 +42,10 @@ dependencies:
32
42
  requirements:
33
43
  - - ~>
34
44
  - !ruby/object:Gem::Version
45
+ hash: 9
46
+ segments:
47
+ - 2
48
+ - 5
35
49
  version: "2.5"
36
50
  type: :development
37
51
  version_requirements: *id002
@@ -43,6 +57,11 @@ dependencies:
43
57
  requirements:
44
58
  - - ~>
45
59
  - !ruby/object:Gem::Version
60
+ hash: 59
61
+ segments:
62
+ - 0
63
+ - 9
64
+ - 0
46
65
  version: 0.9.0
47
66
  type: :development
48
67
  version_requirements: *id003
@@ -54,6 +73,11 @@ dependencies:
54
73
  requirements:
55
74
  - - ~>
56
75
  - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ - 7
80
+ - 0
57
81
  version: 0.7.0
58
82
  type: :development
59
83
  version_requirements: *id004
@@ -102,17 +126,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
126
  requirements:
103
127
  - - ">="
104
128
  - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
105
132
  version: "0"
106
133
  required_rubygems_version: !ruby/object:Gem::Requirement
107
134
  none: false
108
135
  requirements:
109
136
  - - ">="
110
137
  - !ruby/object:Gem::Version
138
+ hash: 3
139
+ segments:
140
+ - 0
111
141
  version: "0"
112
142
  requirements: []
113
143
 
114
144
  rubyforge_project:
115
- rubygems_version: 1.6.2
145
+ rubygems_version: 1.3.7
116
146
  signing_key:
117
147
  specification_version: 3
118
148
  summary: A ruby wrapper for HandBrakeCLI