handbrake 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ 0.2.1
2
+ =====
3
+
4
+ - Include parent references in {HandBrake::Title} and
5
+ {HandBrake::Chapter}.
6
+ - When parsing a title scan, do not keep references to the parsed tree
7
+ in the {HandBrake::Title} objects.
8
+
1
9
  0.2.0
2
10
  =====
3
11
 
@@ -206,7 +206,7 @@ module HandBrake
206
206
  @runner.run(arguments.push(*more_args)).tap do |result|
207
207
  unless result.status == 0
208
208
  unless trace?
209
- $stderr.puts result.output
209
+ $stderr.write result.output
210
210
  end
211
211
  raise "HandBrakeCLI execution failed (#{result.status.inspect})"
212
212
  end
@@ -266,7 +266,7 @@ module HandBrake
266
266
  IO.popen(cmd) do |io|
267
267
  while line = io.gets
268
268
  output << line
269
- $stderr.puts(line.chomp) if @cli.trace?
269
+ $stderr.write(line) if @cli.trace?
270
270
  end
271
271
  end
272
272
  RunnerResult.new(output, $?)
@@ -36,6 +36,7 @@ module HandBrake
36
36
  titles.raw_output = output
37
37
  titles.raw_tree.children.
38
38
  collect { |title_node| Title.from_tree(title_node) }.
39
+ each { |title| title.collection = titles }.
39
40
  each { |title| titles[title.number] = title }
40
41
  end
41
42
  end
@@ -123,6 +124,10 @@ module HandBrake
123
124
  # "main feature".
124
125
  attr_writer :main_feature
125
126
 
127
+ ##
128
+ # @return [Titles] The collection this title belongs to.
129
+ attr_accessor :collection
130
+
126
131
  ##
127
132
  # Creates a new instance from the given scan subtree.
128
133
  #
@@ -137,8 +142,11 @@ module HandBrake
137
142
  scan(/duration: (\d\d:\d\d:\d\d)/).first.first
138
143
  title.chapters = title_node['chapters:'].children.
139
144
  collect { |ch_node| Chapter.from_tree(ch_node) }.
145
+ tap { |chapters| chapters.each { |c| c.title = title } }.
140
146
  inject({}) { |h, ch| h[ch.number] = ch; h }
141
- title.main_feature = title_node.children.detect { |c| c.name =~ /Main Feature/ }
147
+ # !! is so that there's no reference to the node in the
148
+ # resulting object
149
+ title.main_feature = !!title_node.children.detect { |c| c.name =~ /Main Feature/ }
142
150
  end
143
151
  end
144
152
 
@@ -179,6 +187,10 @@ module HandBrake
179
187
  # integer)
180
188
  attr_accessor :number
181
189
 
190
+ ##
191
+ # @return [Title] The title that contains this chapter
192
+ attr_accessor :title
193
+
182
194
  ##
183
195
  # Creates a new instance from the given title subtree.
184
196
  #
@@ -1,5 +1,5 @@
1
1
  module HandBrake
2
2
  ##
3
3
  # The current version
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -47,6 +47,10 @@ module HandBrake
47
47
  let(:title_1) { titles[1] }
48
48
  let(:title_3) { titles[3] }
49
49
 
50
+ it 'has a reference to its parent collection' do
51
+ title_1.collection.should eql(titles)
52
+ end
53
+
50
54
  describe '#main_feature?' do
51
55
  it 'is true when it is' do
52
56
  title_1.should be_main_feature
@@ -55,6 +59,10 @@ module HandBrake
55
59
  it 'is false when it is' do
56
60
  title_3.should_not be_main_feature
57
61
  end
62
+
63
+ it 'is not a complex value when true, so that serializations are simpler' do
64
+ title_1.main_feature?.should == true
65
+ end
58
66
  end
59
67
 
60
68
  it 'has the number' do
@@ -98,6 +106,10 @@ module HandBrake
98
106
  it 'has the number' do
99
107
  chapter.number.should == 5
100
108
  end
109
+
110
+ it 'has a reference to its parent' do
111
+ chapter.title.should eql title_3
112
+ end
101
113
  end
102
114
  end
103
115
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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: 2011-08-07 00:00:00.000000000Z
12
+ date: 2011-08-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubytree
16
- requirement: &2153799900 !ruby/object:Gem::Requirement
16
+ requirement: &2153698700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153799900
24
+ version_requirements: *2153698700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2153799400 !ruby/object:Gem::Requirement
27
+ requirement: &2153698200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.5'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153799400
35
+ version_requirements: *2153698200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2153798940 !ruby/object:Gem::Requirement
38
+ requirement: &2153697740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153798940
46
+ version_requirements: *2153697740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &2153798480 !ruby/object:Gem::Requirement
49
+ requirement: &2153697280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.7.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153798480
57
+ version_requirements: *2153697280
58
58
  description: A lightweight literate ruby wrapper for HandBrakeCLI, the command-line
59
59
  interface for the HandBrake video transcoder.
60
60
  email: