flac2mp3 0.2.1 → 0.2.2

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.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.2 2008-03-30
2
+
3
+ * 1 bug fix:
4
+ * BPM is now actually carried over from FLAC to MP3 tags, not just thought to be.
5
+
1
6
  == 0.2.1 2008-03-30
2
7
 
3
8
  * 1 bug fix:
data/lib/flac2mp3.rb CHANGED
@@ -24,7 +24,7 @@ module Flac2mp3
24
24
  {
25
25
  :album => :album,
26
26
  :artist => :artist,
27
- :bpm => :bpm,
27
+ :bpm => :TBPM,
28
28
  :comment => :comments,
29
29
  :composer => :composer,
30
30
  :date => :year,
@@ -50,7 +50,9 @@ module Flac2mp3
50
50
  Mp3Info.open(filename) do |mp3|
51
51
  tags.each do |key, value|
52
52
  next unless mp3tag = tag_mapping[key]
53
- mp3.tag.send("#{mp3tag}=", value)
53
+ tag = mp3.tag
54
+ tag = mp3.tag2 if key == :bpm
55
+ tag.send("#{mp3tag}=", value)
54
56
  end
55
57
  end
56
58
  end
@@ -2,7 +2,7 @@ module Flac2mp3 #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,6 +1,14 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe 'flac2mp3 command' do
4
+ def run_command(*args)
5
+ Object.const_set(:ARGV, args)
6
+ begin
7
+ eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin flac2mp3]))
8
+ rescue SystemExit
9
+ end
10
+ end
11
+
4
12
  before :all do
5
13
  path = File.join(File.dirname(__FILE__), *%w[.. bin])
6
14
  ENV['PATH'] = [path, ENV['PATH']].join(':')
@@ -11,21 +19,22 @@ describe 'flac2mp3 command' do
11
19
  end
12
20
 
13
21
  it 'should exist' do
14
- pending 'figuring out how to test this command'
15
-
16
- system('flac2mp3 blah').should be_true
22
+ lambda { run_command('blah') }.should_not raise_error(Errno::ENOENT)
17
23
  end
18
24
 
19
25
  it 'should require a filename' do
20
- pending 'figuring out how to test this command'
21
-
22
- `flac2mp3`.should match(/usage:.+filename/i)
26
+ self.expects(:puts) { |text| text.match(/usage.+filename/i) }
27
+ run_command
23
28
  end
24
29
 
25
30
  it 'should pass the filename to Flac2mp3 for conversion' do
26
- pending 'figuring out how to test this command'
27
-
28
31
  Flac2mp3.expects(:convert).with('blah')
29
- system('flac2mp3 blah')
32
+ run_command('blah')
33
+ end
34
+
35
+ it 'should duplicate the filename' do
36
+ filename = 'blah'
37
+ filename.expects(:dup).returns(filename)
38
+ run_command(filename)
30
39
  end
31
40
  end
@@ -134,8 +134,8 @@ describe Flac2mp3, 'providing a mapping of tags' do
134
134
  Flac2mp3.tag_mapping[:artist].should == :artist
135
135
  end
136
136
 
137
- it "should map 'bpm' to 'bpm'" do
138
- Flac2mp3.tag_mapping[:bpm].should == :bpm
137
+ it "should map 'bpm' to 'TBPM'" do
138
+ Flac2mp3.tag_mapping[:bpm].should == :TBPM
139
139
  end
140
140
 
141
141
  it "should map 'comment' to 'comments'" do
@@ -257,7 +257,8 @@ describe Flac2mp3, 'when setting MP3 tag data' do
257
257
  @filename = 'blah.mp3'
258
258
  @tags = {}
259
259
  @mp3tags = stub('mp3info tags')
260
- @mp3info = stub('mp3info obj', :tag => @mp3tags)
260
+ @mp3tags2 = stub('mp3info tags 2')
261
+ @mp3info = stub('mp3info obj', :tag => @mp3tags, :tag2 => @mp3tags2)
261
262
  Mp3Info.stubs(:open).with(@filename).yields(@mp3info)
262
263
  end
263
264
 
@@ -307,9 +308,9 @@ describe Flac2mp3, 'when setting MP3 tag data' do
307
308
  @mp3tags.stubs(:artist=)
308
309
  @mp3tags.stubs(:genre_s=)
309
310
 
310
- @mp3tags.expects(:bpm=).never
311
311
  @mp3tags.expects(:comments=).never
312
312
  @mp3tags.expects(:year=).never
313
+ @mp3tags.expects(:tracknum=).never
313
314
 
314
315
  Flac2mp3.mp3data(@filename, @tags)
315
316
  end
@@ -323,4 +324,12 @@ describe Flac2mp3, 'when setting MP3 tag data' do
323
324
 
324
325
  Flac2mp3.mp3data(@filename, @tags)
325
326
  end
327
+
328
+ it 'should use tag2 for bpm' do
329
+ @tags[:bpm] = '5'
330
+
331
+ @mp3tags2.expects(:TBPM=).with(@tags[:bpm])
332
+
333
+ Flac2mp3.mp3data(@filename, @tags)
334
+ end
326
335
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flac2mp3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yossef Mendelssohn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-30 00:00:00 -05:00
12
+ date: 2008-04-18 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  requirements: []
90
90
 
91
91
  rubyforge_project: yomendel
92
- rubygems_version: 1.1.0
92
+ rubygems_version: 1.1.1
93
93
  signing_key:
94
94
  specification_version: 2
95
95
  summary: description of gem